[Rcpp-devel] Parallel R::bessel_k function in Rcpp

Hoang Nguyen nhoang.neu at gmail.com
Thu Mar 24 01:02:08 CET 2016


Hi,
I am working with Rcpp and need to call function bessel_k from *R::bessel_k*
in parallel. I got usually crash in Rstudio, and still not find out which
is the mistake

Here is my code in R:

Sys.setenv("PKG_CXXFLAGS"="-fopenmp")
Sys.setenv("PKG_LIBS"="-fopenmp")
library(Rcpp)
sourceCpp("Bessel.cpp")
xseq = rt(10000,df = 8)
param <- c(0.0000000,  2.8284271, -0.4954229,  8.0000000)
BasselCm <- BasselC(xseq,param)

here is my code in Bessel.cpp:
if I set num threads(2) it was crash but run smooth if I set back to 1.

Thank you so much for your consideration.

Best regards.




> sessionInfo()
R version 3.2.4 Revised (2016-03-16 r70336)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.4 LTS

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
LC_TIME=es_ES.UTF-8
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=es_ES.UTF-8
LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=es_ES.UTF-8       LC_NAME=C
LC_ADDRESS=C
[10] LC_TELEPHONE=C             LC_MEASUREMENT=es_ES.UTF-8
LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] Rcpp_0.12.3

loaded via a namespace (and not attached):
[1] tools_3.2.4               RcppArmadillo_0.6.600.4.0​


--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20160324/aa3ad6db/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Bessel.cpp
Type: text/x-c++src
Size: 1265 bytes
Desc: not available
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20160324/aa3ad6db/attachment.cpp>


More information about the Rcpp-devel mailing list