<div dir="ltr">Well that's frustrating.<div><br></div><div>I've tried the OpenMPController package without success, and tried to explicitly disable BLAS in the Armadillo headers and removing the linking code in the Makevars files.</div>
<div><br></div><div>If my reading of this thread: <a href="http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2012-June/003888.html">http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2012-June/003888.html</a> is correct, I should be able to switch to RcppEigen since it uses its own routines.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On 12 August 2014 14:07, Dirk Eddelbuettel <span dir="ltr"><<a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class=""><br>
On 11 August 2014 at 19:23, Yixuan Qiu wrote:<br>
| Good point by Dirk.<br>
|<br>
| And why not just adding a line "export OPENBLAS_NUM_THREADS=1" to your .bashrc<br>
| file, or compiling OpenBlas again by setting NUM_THREADS = 1 in the<br>
| Makefile.rule?<br>
<br>
</div>Unless you insist on it you should not need to recompile OpenBLAS.<br>
<br>
You should have a choice of distributions or system which does this right.<br>
<span class="HOEnZb"><font color="#888888"><br>
Dirk<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
|<br>
| Best,<br>
| Yixuan<br>
|<br>
|<br>
| 2014-08-11 18:55 GMT-04:00 Dirk Eddelbuettel <<a href="mailto:edd@debian.org">edd@debian.org</a>>:<br>
|<br>
|<br>
|     Hi Scott,<br>
|<br>
|<br>
|     On 12 August 2014 at 08:43, Scott Ritchie wrote:<br>
|     | Hi Everyone,<br>
|     |<br>
|     | I'm having trouble with restricting the Armadillo function "svd_econ" to<br>
|     run on<br>
|     | a single thread.<br>
|     |<br>
|     | I am able to restrict it if I `export OPENBLAS_NUM_THREADS=1` before<br>
|     opening an<br>
|     | R session, but not from within R (`Sys.setenv(OPENBLAS_NUM_THREADS=1)`<br>
|     has no<br>
|     | effect).<br>
|     |<br>
|     | I'm wondering if theirs an option native to armadillo/RcppArmadillo that<br>
|     I'm<br>
|     | missing to enable me to:<br>
|     |<br>
|     |   • Restrict the number of threads used to 1<br>
|     |   • In a library agnostic manner (i.e. if the user has a different LAPACK<br>
|     or<br>
|     |     BLAS library installed).<br>
|     |<br>
|     | or if I can "trick" Rcpp into thinking the machine only has 1 core?<br>
|<br>
|     I fear you may be misstating / misdiagnosing the problem.<br>
|<br>
|     I am fairly certain that there is not a single line in Rcpp or<br>
|     (Rcpp)Armadillo which sets thread counts for your LAPACK / BLAS.<br>
|<br>
|     Rather, and this is a point that I tried to make in the 'Benchmarking GPUs<br>
|     and CPUs on Debian-based systems' package (gcbd on CRAN etc) and its<br>
|     vignette<br>
|     is that __BLAS and LAPACK sit behind a standardized interface__ and can be<br>
|     installed / swapped via plug and play. (Which in turn enables the<br>
|     benchmarking ...)<br>
|<br>
|     If you're on a Debian-based system, just remove openblas and use atlas.<br>
|     Case<br>
|     closed.  Atlas will not multithread (unless something changed recently).<br>
|<br>
|     There is also a helper function or package somewhere, and a post by Claudia<br>
|     Beleites on StackOverflow, which show the explicit function call to reset<br>
|     OpenBLAS in its count.  But if everything else fails -- just use a<br>
|     different<br>
|     BLAS.  I sometimes do that too when I use multicore / parallel to launch<br>
|     multiple R jobs and each one of those should not spawn additional linear<br>
|     algebra threads.<br>
|<br>
|     Hope this helps,  Dirk<br>
|<br>
|<br>
|<br>
|     | Regards,<br>
|     |<br>
|     | Scott Ritchie<br>
|     | _______________________________________________<br>
|     | Rcpp-devel mailing list<br>
|     | <a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>
|     | <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
|<br>
|     --<br>
|     <a href="http://dirk.eddelbuettel.com" target="_blank">http://dirk.eddelbuettel.com</a> | @eddelbuettel | <a href="mailto:edd@debian.org">edd@debian.org</a><br>
|     _______________________________________________<br>
|     Rcpp-devel mailing list<br>
|     <a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>
|     <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
|<br>
|<br>
|<br>
|<br>
| --<br>
| Yixuan Qiu <<a href="mailto:yixuan.qiu@cos.name">yixuan.qiu@cos.name</a>><br>
| Department of Statistics,<br>
| Purdue University<br>
<br>
--<br>
<a href="http://dirk.eddelbuettel.com" target="_blank">http://dirk.eddelbuettel.com</a> | @eddelbuettel | <a href="mailto:edd@debian.org">edd@debian.org</a><br>
</div></div></blockquote></div><br></div>