// http://en.wikipedia.org/wiki/OpenMP#Hello_World // with an #include // if you also #include , this *really* blows up #include #include #include int main (int argc, char *argv[]) { int th_id, nthreads; #pragma omp parallel private(th_id) { th_id = omp_get_thread_num(); std::cout << "Hello World from thread" << th_id << "\n"; #pragma omp barrier if ( th_id == 0 ) { nthreads = omp_get_num_threads(); std::cout << "There are " << nthreads << " threads\n"; } } return 0; }