Version 1 (modified by 10 years ago) ( diff ) | ,
---|
OpenMP C++
Hello World
// // hellp_omp.cpp: display a message on the screen // #include <iostream> #include <omp.h> int main () { int id; std::cout << "C++ Start" << std::endl; #pragma omp parallel private(id) { id = omp_get_thread_num(); std::cout << "hello from " << id << std::endl; #pragma omp barrier if ( id == 0 ) { int nthreads = omp_get_num_threads(); std::cout << nthreads << " threads said hello!" << std::endl; } } std::cout << "End" << std::endl; }
Compile with GNU C++
g++ hello_omp.c -fopemp
Compile with PGI C++
pgcpp hello_omp.c -mp
Compile with Intel C++
icpc hello_omp.c -openmp
Example of Jobscript
See
Note:
See TracWiki
for help on using the wiki.