Skip to content

Commit

Permalink
Change default --bind-to
Browse files Browse the repository at this point in the history
For hybrid runs (OpenMP with OpenMPI) the process binding under MPI can
not be 'core' which prohibits OpenMP from running on more than one core.
  • Loading branch information
nicolasbock committed Apr 27, 2017
1 parent d1dd1e1 commit ed8f08b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions examples/gpmdcov/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ if ${MPIRUN} --version > /dev/null 2>&1; then
${MPIRUN} \
-np ${NODES} \
--map-by ${MAP} \
--bind-to board \
--hostfile ~/hostfile \
--mca plm_rsh_no_tree_spawn 1 \
--mca orte_base_help_aggregate 0 \
Expand Down
11 changes: 6 additions & 5 deletions examples/gpmdcov/test_openmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,28 @@ int main(int argc, char **argv)
int counter;
int provided;

//MPI_Init(&argc, &argv);
MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);
MPI_Init(&argc, &argv);
//MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);
//MPI_Init_thread(&argc, &argv, MPI_THREAD_SERIALIZED, &provided);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);

if (rank == 0) {
printf("MPI size %d\n", size);
printf("MPI_THREAD_SERIALIZED = %d\n", MPI_THREAD_SERIALIZED);
printf("MPI_THREAD_MULTIPLE = %d\n", MPI_THREAD_MULTIPLE);
printf("provided = %d\n", provided);
}

#pragma omp parallel
{
#pragma omp master
printf("Running on %d threads\n", omp_get_num_threads());
printf("Rank %d, running on %d threads\n", rank, omp_get_num_threads());
}

printf("MPI rank %d\n", rank);
#pragma omp parallel private(counter)
{
printf("Thread %d starting up\n", omp_get_thread_num());
printf("Rank %d, thread %d starting up\n", rank, omp_get_thread_num());
while (1) {
counter++;
counter = counter%100;
Expand Down

0 comments on commit ed8f08b

Please sign in to comment.