Intel® MPI Library
Get help with building, analyzing, optimizing, and scaling high-performance computing (HPC) applications.
2221 Discussions

How to force CMake to link statically with Intel MPI

DataScientist
Valued Contributor I
2,020 Views

All my efforts to achieve this have so far failed. This included setting the proper compiler `-static` flags for Intel ifort and ifx. Is there a way to force static linking of MPI libraries?

1 Solution
TobiasK
Moderator
1,912 Views
4 Replies
TobiasK
Moderator
1,972 Views

@DataScientist


did you try to add -static_mpi ?


0 Kudos
DataScientist
Valued Contributor I
1,957 Views

Thank you @TobiasK for the suggestion. I have tried adding it to the list of CMake compile/link flags but the compiler returned an error stating the flag is unrecognized. It seems like only the MPI wrapper recognizes the flag. Is this true?

If yes, do you know any way to add this to CMake?

 

0 Kudos
TobiasK
Moderator
1,913 Views

@DataScientist


according to https://cmake.org/cmake/help/latest/module/FindMPI.html

MPI_<lang>_COMPILER_FLAGS

should be used to pass -static_mpi

(https://gitlab.kitware.com/cmake/cmake/-/merge_requests/893)


does that work for you?


DataScientist
Valued Contributor I
1,881 Views

Thank you. It seems like this solution worked.

0 Kudos
Reply