-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Dataflow graph parallelism v2 (#94)
* Stash pledges, blocked by nim-lang/Nim#13048 * Workaround nim-lang/Nim#13048 * Pass the pledges implementation tests * Prepare for supporting mixed single and iteration pledges * move pledge access counter to the impl. + Move file to channels subfolder * add iteration pledges * Sanity checks for loop pledges * create fulfill public API * Prepare parallel_tasks for supporting pledges * Add dataflow graph parallelism 💥 🎆 * Add daflow support to parallel for loops * Fix atomics + assert templates visibility on some platforms * remove anti overwrite check (not true as compilers don't always zero-init) * Please the template early symbol resolution god * Nestable GEMM reaching 2.87TFlops for a speedup of 17.96 on 18 cores machines * dependent loops * Prepare for multiple pledge dependencies support * Support joining dataflow graph * bindSym + augment TaskDataSize * Awaitable for loop now returns true if it was the last iteration to await * Fix + test againt vendor BLAS, still one non-nestable barrier :/ (but consistently 17.5x speedup) * typos * Allow failure on C++
- Loading branch information
Showing
23 changed files
with
1,149 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Weave | ||
# Copyright (c) 2019 Mamy André-Ratsimbazafy | ||
# Licensed and distributed under either of | ||
# * MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT). | ||
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0). | ||
# at your option. This file may not be copied, modified, or distributed except according to those terms. | ||
|
||
import | ||
./laser_omp_gemm, | ||
./mkl_gemm, # OpenBLAS nd MKL cannot be linked at the same time | ||
./weave_gemm, | ||
./gemm_bench_common, | ||
./gemm_bench_config, | ||
../../weave | ||
|
||
# This aggregate all benchmarks in one | ||
# Warning: Bench results are not reliable, it seems like threads/calls | ||
# interfere with each other, even when only calling OpenMP-based code. | ||
|
||
when isMainModule: | ||
import std/[random, sequtils] | ||
|
||
randomize(42) # For reproducibility | ||
|
||
let a = newSeqWith(M*K, float32 rand(-0.1..0.1)) | ||
let b = newSeqWith(K*N, float32 rand(-0.1..0.1)) | ||
|
||
warmup() | ||
echo "Warning: The aggregate bench is unreliable, the libraries interfere with each other." | ||
|
||
block: | ||
reportConfig("Intel MKL + Laser OMP + Weave", float32, (M, K), (K, N)) | ||
let mkl = benchMKL(a, b, (M,K), (K,N), NbSamples) | ||
|
||
# let laser = benchLaserGEMM(a, b, (M,K), (K,N), NbSamples) | ||
|
||
init(Weave) | ||
let weave = benchWeaveGEMM(a, b, (M,K), (K,N), NbSamples) | ||
exit(Weave) | ||
|
||
let weaveError = mean_relative_error(weave, mkl) | ||
echo "Mean Relative Error of Weave vs reference: ", weaveError | ||
doAssert weaveError <= 1e-5'f32, $weaveError | ||
|
||
# let laserError = mean_relative_error(laser, mkl) | ||
# echo "Mean Relative Error of Laser vs reference: ", laserError | ||
# doAssert laserError <= 1e-5'f32, $laserError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
clibdir:"/opt/intel/mkl/lib/intel64" | ||
passl:"/opt/intel/mkl/lib/intel64/libmkl_intel_lp64.a" | ||
passl:"-lmkl_core" | ||
passl:"-lmkl_intel_thread" | ||
passl:"-liomp5" | ||
dynlibOverride:"mkl_intel_lp64" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.