#include <iostream>
#include <omp.h>
using namespace std;

int main(){
	cout<<"====================================="<<endl;
	cout<<"    OPENMP: THE MODERN CHEAT CODE    "<<endl;
	cout<<"=====================================\n"<<endl;
	cout<<"[SYSTEM] Running standard serial code. Only 1 thread is active."<<endl;
	omp_set_num_threads(4);
	cout<<"[System] Hitting the OpenMP Pragma. Forking threads NOW...\n"<<endl;
	#pragma omp parallel
	{
		int thread_id=omp_get_thread_num();
		int total_threads=omp_get_num_threads();
		#pragma omp critical
		{
			cout<<"  ->[OPENMP WORKER] Hello! I am Thread "<<thread_id<<" out of "
			<<total_threads<<"."<<endl;
		}
	}
	cout<<"\n[SYSTEM] OpenMP block finished. We are back to 1 thread. Shutting down."<<endl;
	return 0;
}
