Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.

Hybrid MPI/OpenMP error on exit


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


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);
printf("Process %d on %s ",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 ",rank,tid);
 printf("Process %d - %d total threads

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.

When run as an MPI program within a batch environment (PBSPro), the same behavior occurs with each process producing the OpenMP error.

0 Kudos
1 Reply


I was unable to reproduce the system error using the latest versions of the Intel compiler and MPI library. Here's the system info and program output from my system:

[henry@demon mpi_openmp_test]$ cat /share/apps/intel/impi/3.1/mpisupport.txt
Please use the following information when submitting customer support requests

Package ID: l_mpi_p_3.1.026
Package Contents: Intel MPI Library, Development Kit for Linux*

Please direct customer support requests through Premier Support at

[henry@demon mpi_openmp_test]$ icc -V
Intel C Compiler for applications running on Intel 64, Version 10.1 Build 20071116 Package ID: l_cc_p_10.1.011
Copyright (C) 1985-2007 Intel Corporation. All rights reserved.

[henry@demon mpi_openmp_test]$ uname -a
Linux 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:32:02 EDT 2006 x86_64 x86_64 x86_64 GNU/Linux

[henry@demon mpi_openmp_test]$ mpiicc -openmp mpi_openmp_test.c -o mpi_openmp_test
mpi_openmp_test.c(20): (col. 3) remark: OpenMP DEFINED REGION WAS PARALLELIZED.

[henry@demon mpi_openmp_test]$ ./mpi_openmp_test
Process 0 on
Process 0 - Thread 0
Process 0 - Thread 1
Process 0 - Thread 3
Process 0 - Thread 2
Process 0 - 4 total threads

The latestversion of Intel MPI has new features for MPI/OpenMP support.

Best regards,


0 Kudos