Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/torch7.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Rosa <bruno.rosa@eldorado.org.br>2017-05-11 21:31:11 +0300
committerSoumith Chintala <soumith@gmail.com>2017-07-04 03:40:21 +0300
commit6b32a6149564762a6028703f7655c8ef00dd4852 (patch)
tree1fe371ce43c18afbfa8c67dd15359ee1ef9518df
parent9d30c3a5a39ead4721bdeb902564c3df7356d270 (diff)
Add critical section to BLAS gemm.
This is needed because of possible races in SpatialConvolutionMM (and others that use gemm) if the BLAS library is not thread-safe. In terms of performance, there's not much benefit to run two gemms in parallel, because the BLAS libraries have their own all-occupying gemms anyways.
-rw-r--r--lib/TH/generic/THTensorMath.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/TH/generic/THTensorMath.c b/lib/TH/generic/THTensorMath.c
index 24fe11e..b955319 100644
--- a/lib/TH/generic/THTensorMath.c
+++ b/lib/TH/generic/THTensorMath.c
@@ -1346,6 +1346,7 @@ void THTensor_(addmm)(THTensor *r_, real beta, THTensor *t, real alpha, THTensor
m2_ = THTensor_(newContiguous)(m2);
}
+#pragma omp critical(blasgemm)
/* do the operation */
THBlas_(gemm)(transpose_m1,
transpose_m2,