Created
January 4, 2017 06:12
-
-
Save glennklockwood/79262be4403c341b858deff1f94fa9b8 to your computer and use it in GitHub Desktop.
Test to display how OpenMP threads are bound
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <sched.h> | |
int main( int argc, char**argv ) | |
{ | |
#pragma omp parallel | |
{ | |
printf( "Hello world from thread %d of %d running on cpu %2d!\n", | |
omp_get_thread_num()+1, | |
omp_get_num_threads(), | |
sched_getcpu()); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment