-
Notifications
You must be signed in to change notification settings - Fork 0
`sequential` examples
This line is intentionally not left blank.
In binomial we don't need "sequential", but our change will also make it unnecessary to use a Haskell foldl and the division into individual kernels will not be visible from the Nikola code, but will happen automatically.
finalPut :: Vector G (Exp F) -> Vector G (Exp F) -> Vector D (Exp F)
prevPut :: Vector G (Exp F) -> Vector G (Exp F) -> Exp Int32 -> Vector G (Exp F) -> Exp Int32 -> Vector D (Exp F)
binom = head $ fold (prevPut ...) (finalPut ...) [n..1]
where
.....
binomCompiled = compile binom
Assume we can generate a sobol sequence given the length and an array of direction vectors:
sobolSequence_ :: Exp Index -> Array D DIM1 (Exp Elem) -> Array D DIM1 (Exp SpecReal)
We now want to generate an n-dimensional sobol sequence / several sobol sequences:
sobolSequences :: Exp Index -> Array D DIM2 (Exp Elem) -> Array D DIM2 (Exp SpecReal)
Currently, we would have to rewrite sobolSequence_ to do that. With the new approach we could do it in two ways:
sobolSequence n dirs = map (sobolSequence_ n) dirs
or
sobolSequence n dirs = map (sequential $ sobolSequence_ n) dirs
We still don't know the best way to parallelize this, but using this approach it would at least be a lot easier to experiment with different methods. For example, when writing polyfit, we would like to write an LU/Cholesky/QR-decomposition algorithm, but only for 3x3 matrices, so that would probably be more efficient to do sequentially.