search for: hello_openmp_r

Displaying 1 result from an estimated 1 matches for "hello_openmp_r".

Did you mean: hello_openmp
2010 Jul 10
1
Set the number of threads using openmp with .C
..."Hello World from thread %d\n", th_id); #pragma omp barrier if ( th_id == 0 ) { nthreads = omp_get_num_threads(); Rprintf("There are %d threads\n",nthreads); } } } Where n is the number of threads that i want. I compite it with "R CMD SHLIB hello_openmp_R.c -fopenmp" and when I try to run it in R using: dyn.load("hello_openmp_R.so") hello_omp=function(n){.C("hello_omp",as.integer(n))} hello_omp(3) hello_omp(2) Only 1 thread is been used, instead of 3 and 2: > hello_omp(3) Hello World from thread 0 There are 1 threads [...