I'm trying to create a hybrid MPI/OpenMP program. Everything seems to work fine, except there's an OpenMP error when the code attempts to exit. Even though the code appears to have run correctly, this error is disconcerting. I've looked around, but haven't found anyone else that's had this problem.
I'm running the Intel C++ Compiler version 10.0.023 and Intel MPI 3.0 on a dual dual-core Intel Xeon system running Redhat EL3.
The source code (mpi_openmp_test.c) contains
------------------------------------------------------
#include <mpi.h>
#include <stdio.h>
#include <omp.h>
#include <unistd.h>
int main(int argc, char *argv[]) { char message[50];
int rank, size;
MPI_Status status;
MPI_Init (&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
gethostname(message,50);
printf("Process %d on %s\n",rank,message);
int nThreads;
#pragma omp parallel shared(nThreads)
{
int tid = omp_get_thread_num();
if (tid==0)
nThreads = omp_get_num_threads();
printf("Process %d - Thread %d \n",rank,tid);
}
printf("Process %d - %d total threads\n",rank,nThreads);
MPI_Finalize(); return(0);
}
------------------------------------------------------
The code was compiled with
$ mpiicc -openmp -o mpi_openmp_test mpi_openmp_test.c
When run as a serial program the output is as follows:
$ ./mpi_openmp_test
Process 0 on node0
Process 0 - Thread 0
Process 0 - Thread 1
Process 0 - Thread 3
Process 0 - Thread 2
Process 0 - 4 total threads
system error(22): __kmp_runtime_destroy: pthread_key_delete: Invalid argument
OMP abort: fatal system error detected.
Aborted
When run as an MPI program within a batch environment (PBSPro), the same behavior occurs with each process producing the OpenMP error.