snl-dakota / dakota-packages

The core TPL repo
1 stars 5 forks source link

MPI conflicts in HOPSPACK #5

Open bassenj opened 1 year ago

bassenj commented 1 year ago

In Dakota, MPI is detected before the packages sub-directory is included.

On one of our systems this results in MPI_FOUND being set in the external package hopspack while hopspack should be compiled without MPI support. hopspack uses the CMake variable mpi to enable MPI support, which sets MPI_FOUND and HAVE_MPI, if MPI support is requested. In my case HAVE_MPI is not set while MPI_FOUND is set from the outer scope. (See hopspack/ConfigureMPI.cmake)

Unfortunately, hopspack uses MPI_FOUND to choose files for compilation: hopspack/src/src-executor/CMakeLists.txt

But the headers use HAVE_MPI: hopspack/src/src-shared/HOPSPACK_GenProcComm.hpp

Therefore, hopspack tries to compile the MPI enabled cpp file with the serial hpp file.

Using HAVE_MPI instead of FOUND_MPI in hopspack/src/src-executor/CMakeLists.txt resolves the issue. So, consistently using HOPSPACK_HAVE_MPI similar to DAKOTA_HAVE_MPI instead of using multiple variables to control MPI support in hopspack could be a solution.

However, I haven't seen this issue before on other systems or in conda-forge/dakota-feedstock. So, it might be limited to my system.