Displaying 1 result from an estimated 1 matches for "hello_omp".
2010 Jul 10
1
Set the number of threads using openmp with .C
Hi everybody! Could somebody help me with the following?
I'm trying to run a simple Hello World code in openmp using .C function. The
C code i have is:
#include <omp.h>
#include <stdio.h>
#include <R.h>
void hello_omp(int *n) {
int th_id, nthreads;
omp_set_num_threads(*n);
#pragma omp parallel private(th_id)
{
th_id = omp_get_thread_num();
Rprintf("Hello World from thread %d\n", th_id);
#pragma omp barrier
if ( th_id == 0 ) {
nthreads = omp_get_num_threads();...