Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

OpenMP leaves thread open

Doan__Thomas
Beginner
394 Views

I'm just starting with Intel C++18.0 under Visual Studio 15. I mainly am mainly interested in switching to Intel from the MS compiler because of the poor support for OpenMP in the native VS compiler. I'm testing speed on the following piece of code:

    #pragma omp parallel for private(i) shared(a,b,c,m,n) if (m > symtest1 && n > symtest2)
    for (i = 0 ; i < n ; i++) {
        MatrixMultSymmVect(a,b+i*m,c+i*m,m);
    }

(with various test values for symtest1 and symtest2--yes, I know the shared clause is overkill). When I run this, it seems to do the parallel computing OK (sometimes better, sometimes worse depending upon the number of trips), however, when I close the application, it continues to show in the Task Manager as a "background process" hogging one thread worth of CPU resources.  If openMP is never invoked, that doesn't happen. I did not have this problem with the VS compiler.

Note that the controlling application itself uses two threads---one for computation (which would be the active thread when it hits the above code), and one for interface. I don't know if there's something about OpenMP that's interfering with that.

 

0 Kudos
2 Replies
TimP
Honored Contributor III
394 Views

The thread pool of Intel OpenMP runtime is kept active for KMP_BLOCKTIME (default 200ms).  You can shorten the time by setting the environment variable.  When Microsoft was working on OpenMP they maintained the delay should be much larger.  You must ensure that you link only one copy of OpenMP runtime (the Intel one). 

If you have any functions compiled against Microsoft OpenMP, the library commands added by using ICL -Qopenmp to link will ensure that the Microsoft OpenMP calls are directed to the Intel library. Otherwise, you must add those commands removing the Microsoft OpenMP and adding the Intel one explicitly.

0 Kudos
TimP
Honored Contributor III
394 Views

The thread pool of Intel OpenMP runtime is kept active for KMP_BLOCKTIME (default 200ms).  You can shorten the time by setting the environment variable.  When Microsoft was working on OpenMP they maintained the delay should be much larger.  You must ensure that you link only one copy of OpenMP runtime (the Intel one). 

If you have any functions compiled against Microsoft OpenMP, the library commands added by using ICL -Qopenmp to link will ensure that the Microsoft OpenMP calls are directed to the Intel library. Otherwise, you must add those commands removing the Microsoft OpenMP and adding the Intel one explicitly.

0 Kudos
Reply