/* File: hello3.cpp Simple use of '#pragma omp parallel' This version uses cout which is NOT "critical" Can specify critical region with another #pragma to keep the output from getting jumbled compile with: g++ hello1.cpp -fopenmp */ #include #include using namespace std ; int main() { cout << "Hello from master thread." << endl ; #pragma omp parallel { int id = omp_get_thread_num() ; int max = omp_get_num_threads() ; #pragma omp critical { cout << "Team member " << id << " reporting from team of " << max << endl ; } } cout << "Master thread finished, goodbye." << endl ; }