-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lecture 11: omp_get_num_threads() #21
Comments
This is just a snippet of code which, somewhat implicitly, assumes that the threads have been set at some point before that location via Which raises the question, "If you don't explicitly set the number of threads then what is the default?" On my machine it happens to be eight threads. |
I have tried to experiment with the included code. void func1()
{
omp_set_num_threads( 10 );
unsigned num_of_threads = omp_get_num_threads();
#pragma omp parallel \
// num_threads(num_of_threads)
{
printf("id = %d\n", omp_get_thread_num());
}
return;
} |
Wow. That's a very good observation. I suppose I have been (un)fortunate enough to not sure |
Around minute 42:00, it seems that the code on the slide calls
omp_get_num_threads()
before starting theomp parallel
block. Wouldn't that return just 1-thread?The text was updated successfully, but these errors were encountered: