You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/code.jl
+15-5Lines changed: 15 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -464,23 +464,33 @@ end
464
464
465
465
struct Multithreaded end
466
466
"""
467
-
SpawnFetch{ParallelType}(exprs, reduce)
467
+
SpawnFetch{ParallelType}(funcs [, args], reduce)
468
468
469
-
Run every expr in `exprs` in its own task, and use the `reduce`
470
-
function to combine the results of executing `exprs`.
469
+
Run every expression in `funcs` in its own task, the expression
470
+
should be a `Func` object and is passed to `Threads.Task(f)`.
471
+
If `Func` takes arguments, then the arguments must be passed in as `args`--a vector of vector of arguments to each function in `funcs`. We don't use `@spawn` in order to support RuntimeGeneratedFunctions which disallow closures, instead we interpolate these functions or closures as smaller RuntimeGeneratedFunctions.
472
+
473
+
`reduce` function is used to combine the results of executing `exprs`. A SpawnFetch expression returns the reduced result.
474
+
475
+
476
+
Use `Symbolics.MultithreadedForm` ParallelType from the Symbolics.jl package to get the RuntimeGeneratedFunction version SpawnFetch.
471
477
472
478
`ParallelType` can be used to define more parallelism types
473
479
SymbolicUtils supports `Multithreaded` type. Which spawns
474
480
threaded tasks.
475
481
"""
476
482
struct SpawnFetch{Typ}
477
483
exprs::Vector
484
+
args::Union{Nothing, Vector}
478
485
combine
479
486
end
480
487
488
+
(::Type{SpawnFetch{T}})(exprs, combine) where {T} =SpawnFetch{T}(exprs, nothing, combine)
0 commit comments