OpenMP: HPCSE course review

Compile and link using openMP:
[bash]g++ -fopenmp openmp1.cpp[/bash]
Directives control multi-threading, in c/c++:
[cpp]#include <iostream>
#include <omp.h>
int main(){
#pragma omp pararrel
{
std::cout << "I am thread" << get_omp_thread_num()
<< "of" <<omp_get_num_threads() << "threads."<<std::endl;
}
}[/cpp]

Leave a Reply

Your email address will not be published. Required fields are marked *