cea-hpc / wi4mpi

Wrapper interface for MPI
BSD 3-Clause "New" or "Revised" License
80 stars 15 forks source link

Failing at configure #13

Closed ocaisa closed 2 years ago

ocaisa commented 3 years ago

Your CMake check:

if(MPI_C_FOUND AND MPI_Fortran_FOUND) #Need to be OpenMPI
    execute_process(COMMAND "${MPI_C_COMPILER}" -show
                    OUTPUT_VARIABLE ERR_VAR1
                    OUTPUT_FILE "compiler_out"
                    ERROR_QUIET)
    execute_process(COMMAND "grep" openmpi
                    INPUT_FILE "compiler_out"
                    OUTPUT_VARIABLE ERR_VAR2
                    RESULT_VARIABLE COMMAND_RESULT1
                    ERROR_QUIET)
    #execute_process(COMMAND "${MPI_C_COMPILER}" -show
    #                COMMAND "grep" -io openmpi
    #                 RESULT_VARIABLE RV)
    #message(STATUS "res command : ${ERR_VAR2}")
    if(NOT ERR_VAR2)
      message(FATAL_ERROR "Be sure to have an OpenMPI librarie in your PATH")
    endif()
        get_filename_component(OPENMPI_ROOT ${MPI_C_INCLUDE_PATH} DIRECTORY)
endif()

is failing for me even though I provide -DOPENMPI_ROOT=$EBROOTOPENMPI (and all the other checks for MPI have passed).

The content of compiler_out is

gcc -I/users/ocaisa/.local/easybuild/software/OpenMPI/4.1.0-GCC-10.2.0/include -L/users/ocaisa/.local/easybuild/software/hwloc/2.2.0-GCCcore-10.2.0/lib -L/users/ocaisa/.local/easybuild/software/libevent/2.1.12-GCCcore-10.2.0/lib64 -Wl,-rpath -Wl,/users/ocaisa/.local/easybuild/software/hwloc/2.2.0-GCCcore-10.2.0/lib -Wl,-rpath -Wl,/users/ocaisa/.local/easybuild/software/libevent/2.1.12-GCCcore-10.2.0/lib64 -Wl,-rpath -Wl,/users/ocaisa/.local/easybuild/software/OpenMPI/4.1.0-GCC-10.2.0/lib -Wl,--enable-new-dtags -L/users/ocaisa/.local/easybuild/software/OpenMPI/4.1.0-GCC-10.2.0/lib -lmpi

I was wondering if there is a reason to do a case sensitive search (I see the commented out version is case insensitive).

Maybe I am missing the point of this test? If the point is to check if mpicc is OpenMPI, you could use

[ocaisa@generoso ~]$ mpicc --showme:version
mpicc: Open MPI 4.1.0 (Language: C)

which would be a more explicit check.

ocaisa commented 3 years ago

That works at least as far back as OpenMPI 3.1.1:

[ocaisa@generoso ~]$ mpicc --showme:version | grep "Open MPI" && echo Success
mpicc: Open MPI 3.1.1 (Language: C)
Success
adrien-cotte commented 3 years ago

The patch given in #8 should help you. Can you try it and tell me if -DOPENMPI_ROOT=$EBROOTOPENMPI works after applying?