Displaying 1 result from an estimated 1 matches for "testopenmp".
2013 May 24
0
Rcpp with OpenMP - Need example Makevars
Dear R experts,
recently I started developing a 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");
}...