Closed adityagupta1089 closed 5 months ago
Thanks! This is amazing PR with a plot and everything ❤️
A minor change request: instead of renaming GetCilkWorkerNum
to GetOmpWorkerNum
, can you name it GetThreadId
or GetThreadNum
? Just something not tied to a specific implementation. So if we switch from openmp to something else, we don't have to change it every time. I'm also thinking if we should run all the icfp21 benchmarks with this patch, just to know what the difference is... It's probably not worth it since we have to switch anyway because Cilk is not an option anymore.
Another alternative to Cilk was discussed last week, parlaylib. So we should discuss this change as a group once more.
Thanks! This is amazing PR with a plot and everything heart
A minor change request: instead of renaming
GetCilkWorkerNum
toGetOmpWorkerNum
, can you name itGetThreadId
orGetThreadNum
? Just something not tied to a specific implementation. So if we switch from openmp to something else, we don't have to change it every time. I'm also thinking if we should run all the icfp21 benchmarks with this patch, just to know what the difference is... It's probably not worth it since we have to switch anyway because Cilk is not an option anymore.
I was able to rename and have all the tests pass I will look into running icfp21 benchmarks between cilk and openmp.
Another alternative to Cilk was discussed last week, parlaylib. So we should discuss this change as a group once more.
I will take a look at using parlaylib.
The PR was closed automatically because the master
branch it targeted was not active for months and was removed. Please, feel free to reopen the PR against the main
branch (after rebasing).
Trying to port cilk to openmp to reduce dependency on it (part of bigger goal of upgrading dependencies and making all tests work)
GetCilkWorkerNum
toGetOmpWorkerNum
and used-fopenmp
andomp_get_thread_num()
Major changes in
gibbon-compiler/src/Gibbon/Passes/Codegen.hs
to
pragma omp task // spawnStms[0] in CodeGen.hs
Changed
spawnexp
tospawnStms
and made assignment identifier as a parameter, i.e.spawnStms :: Maybe Var -> [C.BlockItem]
, e.g.to
Testing
Correctness
gibbon_main = go 20
0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 '#()
bar :: Int -> Int bar b = let _ = printsym (quote "World") in b
gibbon_main :: () gibbonmain = let a = spawn (foo 2) b = bar 3 = sync _ = printint (a+b) in ()
WorldHello5'#()
HelloWorld5'#()
Timing
examples/parallel/MergeSort.hs
) in parallel (with8
threads) and serial: