Skip to content

Instantly share code, notes, and snippets.

@glennklockwood
Created January 4, 2017 06:12
Show Gist options
  • Save glennklockwood/79262be4403c341b858deff1f94fa9b8 to your computer and use it in GitHub Desktop.
Save glennklockwood/79262be4403c341b858deff1f94fa9b8 to your computer and use it in GitHub Desktop.
Test to display how OpenMP threads are bound
#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