Displaying 1 result from an estimated 1 matches for "numberthread".
Did you mean:
numberthreads
2013 May 24
0
Rcpp with OpenMP - Need example Makevars
...Rcpp package "OpenMPTest".
Within that package I want to use OpenMP, as in the following code example:
// header file
#include <omp.h>
using namespace Rcpp ;
RcppExport SEXP testOpenMP( SEXP nThreads ) ;
// cpp file
SEXP testOpenMP( SEXP nThreads ) {
BEGIN_RCPP
NumericVector numberThreads = NumericVector( nThreads );
omp_set_num_threads( numberThreads(0) );
#pragma omp parallel
{
// Code inside this region runs in parallel.
printf("Hello!\n");
}
END_RCPP
}
As I am an absolute newbie with writing C++ extensions and have not
much understanding of the Mak...