[Solved] How to make threads write their numbers in reverse order using OpenMP?
I don’t really understand the purpose of what you are asking but this works #include “omp.h” #include <iostream> using namespace std; int main() { #pragma omp parallel { int nthreads = omp_get_num_threads(); for(int i=nthreads-1; i>=0; i–) { #pragma omp barrier { if(i==omp_get_thread_num()) { #pragma omp critical cout << “I am thread “<< i <<endl; } … Read more