Page MenuHomec4science

hello_world_omp.c
No OneTemporary

File Metadata

Created
Sun, May 26, 16:45

hello_world_omp.c

#include <stdio.h>
#include <omp.h>
int main(int argc, char *argv[]) {
int myrank=0;
int mysize=1;
#if defined (_OPENMP)
#pragma omp parallel default(shared) private(myrank, mysize)
{
mysize = omp_get_num_threads();
myrank = omp_get_thread_num();
#endif
printf("Hello from thread %d out of %d\n", myrank, mysize);
#if defined (_OPENMP)
}
#endif
return 0;
}

Event Timeline