/* * "hello world" program * * number of threads can be specified with environment variable * OMP_NUM_THREADS, or defaults to something implementation-dependent * (probably the number of processing elements). */ #include #include #include /* OpenMP header file */ int main(void) { printf("starting program\n"); #pragma omp parallel { /* run this in each thread */ printf("hello, world, from thread %d\n", omp_get_thread_num()); } printf("all done\n"); return EXIT_SUCCESS; }