[Rcpp-devel] OpenMP and Parallel BLAS
Balamuta, James Joseph
balamut2 at illinois.edu
Mon Jun 1 01:42:01 CEST 2015
Greetings and Salutations,
The answer is yes, multiple processes can concurrently modify different parts of the object. So, the object is not “locked.”
In this case, it’s important to note the scope of the object being “shared” and not “private.”
Also, the object is not being used in any computations that could introduce a race condition.
To confirm, here is a simple test using cores = 1:5 and a matrix of 100 x 100 dimensions:
Unit: milliseconds
expr min lq mean median uq max neval
reg 149.16828 150.57064 151.50028 151.14911 151.77306 167.89586 100
omp_1core 148.61683 150.38602 150.97419 150.92021 151.42784 153.87262 100
omp_2core 76.87057 77.67058 78.72599 78.07599 78.75143 88.49076 100
omp_3core 52.86078 53.41599 55.48897 53.81420 56.09687 66.68860 100
omp_4core 40.09745 42.64505 46.52619 44.09979 49.99153 63.37927 100
omp_5core 39.23680 44.04410 46.22926 45.22581 48.45514 51.05932 100
> all.equal(updateImplicitX(test,test,test,test,5),updateImplicitX_p(test,test,test,test,5,3))
[1] TRUE
So, there is ~2x – 3.4x speed up vs. the non-parallel version.
Parallel version using my suggestions and benchmarking…
https://gist.github.com/coatless/5c4f95c69f7a1b61b2a5
Sincerely,
JJB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20150531/88c33a0b/attachment.html>
More information about the Rcpp-devel
mailing list