// C++#include<iostream>#include<unistd.h>#include<omp.h>usingnamespacestd;intmain(){// Serial Region (master thread)// Parameters of the Applicationintlen=30;charname[30];// OpenMP Parametersintid,nthreads;// Master thread obtains information about itself and its environment.nthreads=omp_get_num_threads();// get number of threadsid=omp_get_thread_num();// get threadgethostname(name,len);// get run-host namecout<<"SERIAL REGION: Runhost:"<<name<<" Thread:"<<id<<" of "<<nthreads<<" thread hello, world"<<endl;// Open parallel region.// Each thread obtains information about itself and its environment.#pragma omp parallel private(name,id,nthreads){nthreads=omp_get_num_threads();// get number of threadsid=omp_get_thread_num();// get thread gethostname(name,len);// get run-host namecout<<"PARALLEL REGION: Runhost:"<<name<<" Thread:"<<id<<" of "<<nthreads<<" threads hello, world"<<endl;}// Close parallel region.// Serial Region (master thread)cout<<"SERIAL REGION: Runhost:"<<name<<" Thread:"<<id<<" of "<<nthreads<<" thread hello, world"<<endl;return0;}