-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow concurrent evaluation #170
Comments
Linking the #804 here, Obsidian guys seems got a better idea of achieving non-blocking parallelism, their Scopes and Standart Thunk relates to the question. And I also started to look at the question as to non-blocking parallelism, which I expressed in: #879 (comment) Additionally, expression blocks as long as they parsed semantically correct - are an abelian (commutative) monoid (also because of the language). All those guarantees are already provided for us and kept by the reference implementation. The only thing that is not provided for us - is the definite termination, but it unsolvable anyway for the HNix case, so the best that we can do is 1. some basic termination rules for abnormal computations, aka the And after all that maybe additionally pick some minor windmills fights, why windmill - since of the halting problem and Edsger Dijkstra already talked about the complexity of loop detection, loop detection is famously complex & nonfull thing - so maybe doing some basic loop detection mechanism on the side, while well, Because all guarantees are already provided - we need to think about how to manage the position to gracefully lay the code on that unseen guarantees structure and allow those already existing kept guarantees to show the proper design of the algorithm, I currently have no idea how to do it, probably when HNix would be open for parallelism - possibility would reveal itself. ⬆️ But that is a look into the future currently.
Also falls into concurrency/parallelism. Also, currently, a number of approaches were developed, as As Nix is an abelian monoid - I'd looked into what law properties can be established through Currenly:
|
Right now parsing is our slowest task, and yet parsing occurs during evaluation all the time due to
import
expressions. It would be nice if we could assign a pool of N workers (using theasync-pool
library), and perform these slow evaluations concurrently since none of them can have interfering side-effects. This should speed up the evaluation ofnixpkgs
considerably if there are many capabilities available.To do this will need a few steps:
Make
Thunk.hs
thread-safe by introducing a variable that causes other threads to wait for pending evaluations to complete. Right now there is a boolean flag in anIORef
; it might be sufficient to just turn this into a trinary flag in aTVar
.Create
MonadConcurrent
to abstract when concurrent evaluation is possible. It wouldn't be for the symbolic evaluator, for example, but would for an evaluator that runs in IO, such asLazy
.Replace the calls to
traverse
that happen inExec.hs
forNList
andNSet
to instead use a newconcurrentTraverse
method defined inMonadConcurrent
, which for IO would be implemented by callingControl.Concurrent.Async.Pool.mapTasks <group>
and for pure evaluation would just calltraverse
as before.Pinging @ryantrinkle, who requested this feature.
The text was updated successfully, but these errors were encountered: