What is the best way to find the number of threads that will be used for omp parallel for ? I want to allocate enough memory to use with all threads, but I can not use omp_get_num_threads until I get to the parallel section. For instance:
int thread_count = ? float *data = (float*)malloc(thread_count * data_count * sizeof(float)); #pragma omp parallel for default(shared) private(x) for (x=0; x<N; x++) { int threadid = omp_get_thread_num();
What is the right way to do this so that I can know how many threads will be used and can be allocated accordingly? Thanks
source share