Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake build for ww3_tp2.14 fails due to missing MPI flags #1352

Open
MHBalsmeier opened this issue Jan 23, 2025 · 0 comments
Open

CMake build for ww3_tp2.14 fails due to missing MPI flags #1352

MHBalsmeier opened this issue Jan 23, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@MHBalsmeier
Copy link

Describe the bug
I am trying to run ww3_tp2.14 on Ubuntu 24. All previous tests in the matrix compile and run. However, with ww3_tp.14, I get the following error during the compilation:

cd /home/max/code/WW3/regtests/ww3_tp2.14/work_OASACM/build_SHRD/model/src && /usr/bin/gfortran -DENDIANNESS="'big_endian'" -DW3_BS0 -DW3_BT4 -DW3_COU -DW3_CRT1 -DW3_CRX1 -DW3_DB1 -DW3_FLX0 -DW3_IC2 -DW3_IS0 -DW3_LN1 -DW3_MLIM -DW3_NL1 -DW3_NOGRB -DW3_O0 -DW3_O1 -DW3_O2 -DW3_O2a -DW3_O2b -DW3_O2c -DW3_O3 -DW3_O4 -DW3_O5 -DW3_O6 -DW3_O7 -DW3_OASACM -DW3_OASIS -DW3_PR3 -DW3_REF1 -DW3_RWND -DW3_SHRD -DW3_ST4 -DW3_STAB0 -DW3_TR0 -DW3_TRKNC -DW3_UQ -DW3_WNT0 -DW3_WNX1 -I/home/max/code/WW3/regtests/ww3_tp2.14/work_OASACM/build_SHRD/model/src/mod -I/home/max/code/WW3/regtests/ww3_tp2.14/work_OASACM/work_oasis3-mct/build/lib/psmile.MPI1 -I/usr/include -O3 -DNDEBUG -O3 -Jmod -fallow-argument-mismatch -g -fno-second-underscore -ffree-line-length-none -O3 -c /home/max/code/WW3/model/src/w3agcmmd.F90 -o CMakeFiles/ww3_lib.dir/w3agcmmd.F90.o
/usr/bin/cmake -E cmake_copy_f90_mod model/src/mod/w3wdatmd.mod model/src/CMakeFiles/ww3_lib.dir/w3wdatmd.mod.stamp GNU
/home/max/code/WW3/model/src/w3agcmmd.F90:72:0:

   72 |   INCLUDE "mpif.h"
      | 
Fatal Error: Cannot open included file ‘mpif.h’
compilation terminated.

I have MPI installed on my system, which I can verify by running ww3_tp2.21, for example.

To Reproduce
./bin/run_cmake_test -s OASACM -i input_oasacm -w work_OASACM -C OASIS -f -p mpirun -n 1 ../model ww3_tp2.14

Expected behavior
The compilation is successful if MPI is installed on the system.

Additional context
The reason for this is most likely that the module is compiled without the MPI flag. In model/src/CMakeLists.txt we have

if("MPI" IN_LIST switches)
  find_package(MPI REQUIRED COMPONENTS Fortran)
  target_link_libraries(ww3_lib PUBLIC MPI::MPI_Fortran)
endif()

Since the MPI flag is not set the MPI libraries are not linked. The reason for the error not occurring for other users is likely that their MPI library is in one of the other directories that are included. A fix might be to include a special rule in the CMakeLists.txt to enforce that w3agcmmd.F90 is always linked to MPI.

Another fix might be to use preprocessor directives in w3agcmmd.F90.

If this is considered useful, I could try a fix using one of the two approaches.

@MHBalsmeier MHBalsmeier added the bug Something isn't working label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant