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

MOM5 cmake #3

Closed
wants to merge 3 commits into from
Closed

MOM5 cmake #3

wants to merge 3 commits into from

Conversation

aidanheerdegen
Copy link
Member

First stab at a MOM5 spack package using the CMake build infra.

@aidanheerdegen
Copy link
Member Author

Error compiling FMS

==> Error: ProcessError: Command exited with status 2:         
    'make' '-j16'                                              
                                                                 
5 errors found in build log:                              
     160    /apps/cmake/3.24.2/bin/cmake -E touch FMS/CMakeFiles/FMS.dir/scratch/tm70/aph502/tmp/spack-stage/spack-stage-mom5-5.1-ufdcvnzh4s3sw7koni75rqkt
            pyf6t7qx/spack-src/src/shared/mpp/test_mpp_pset.F90.o.provides.build
     161    /apps/cmake/3.24.2/bin/cmake -E touch FMS/CMakeFiles/FMS.dir/scratch/tm70/aph502/tmp/spack-stage/spack-stage-mom5-5.1-ufdcvnzh4s3sw7koni75rqkt
            pyf6t7qx/spack-src/src/shared/random_numbers/MersenneTwister.F90.o.provides.build
     162    /scratch/tm70/aph502/tmp/spack-stage/spack-stage-mom5-5.1-ufdcvnzh4s3sw7koni75rqktpyf6t7qx/spack-src/src/shared/mosaic/read_mosaic.c(38): warn
            ing #266: function "nc_strerror" declared implicitly                                                                                          
     163        sprintf( errmsg, "%s: %s", msg, (char *)nc_strerror(status) );                                                                                  164                                                ^
     165                                                                                                                                                  
  >> 166    /scratch/tm70/aph502/tmp/spack-stage/spack-stage-mom5-5.1-ufdcvnzh4s3sw7koni75rqktpyf6t7qx/spack-src/src/shared/mosaic/read_mosaic.c(232): err
            or: identifier "nc_type" is undefined                                                                                                         
     167        nc_type vartype;                
     168        ^                                                                                                                                         
     169                                                                                                                                                     
>> 170    /scratch/tm70/aph502/tmp/spack-stage/spack-stage-mom5-5.1-ufdcvnzh4s3sw7koni75rqktpyf6t7qx/spack-src/src/shared/mosaic/read_mosaic.c(292): err
            or: identifier "nc_type" is undefined                                                                                                         
     171        nc_type vartype;                                                                                                                          
     172        ^                                                                                                                                         
     173                                                                                                                                                        
     174    compilation aborted for /scratch/tm70/aph502/tmp/spack-stage/spack-stage-mom5-5.1-ufdcvnzh4s3sw7koni75rqktpyf6t7qx/spack-src/src/shared/mosaic
            /read_mosaic.c (code 2)                                                                                                                          
>> 175    make[2]: *** [FMS/CMakeFiles/FMS.dir/build.make:773: FMS/CMakeFiles/FMS.dir/scratch/tm70/aph502/tmp/spack-stage/spack-stage-mom5-5.1-ufdcvnzh4
            s3sw7koni75rqktpyf6t7qx/spack-src/src/shared/mosaic/read_mosaic.c.o] Error 2                                                                                        
     176    make[2]: *** Waiting for unfinished jobs....
     177    Using 8-byte addressing                                                                                                                             
     178    Using PURE
     179    Converting pointers to allocatable components                                                                                                  
     180    make[2]: Leaving directory '/scratch/tm70/aph502/tmp/spack-stage/spack-stage-mom5-5.1-ufdcvnzh4s3sw7koni75rqktpyf6t7qx/spack-build-ufdcvnz'
>> 181    make[1]: *** [CMakeFiles/Makefile2:433: FMS/CMakeFiles/FMS.dir/all] Error 2                                                                         
    182    make[1]: Leaving directory '/scratch/tm70/aph502/tmp/spack-stage/spack-stage-mom5-5.1-ufdcvnzh4s3sw7koni75rqktpyf6t7qx/spack-build-ufdcvnz'
>> 183    make: *** [Makefile:94: all] Error 2                                     

Seems to be an issue with the CMake build not correctly setting the CFLAGS for the compiler. Not sure why it worked in CI? Perhaps the netCDF install add those paths to the environment and they're picked up?

see mom-ocean/MOM5#373

@aidanheerdegen aidanheerdegen changed the title Mom5 cmake MOM5 cmake Jan 30, 2023
@aidanheerdegen
Copy link
Member Author

Getting this working requires modifications to the MOM5 CMake as well. I've started a PR for those changes here:

mom-ocean/MOM5#374

I wasn't going to merge those changes until the spack package was working, in case other changes were required.

Using this modified branch and running the exp/cmake_compile.csh script compiles fine.

A spack dev-build with that same branch throws this error:

$ spack dev-build mom5@develop %[email protected] ^[email protected]
==> [email protected] : has external module in ['cmake/3.24.2']    
[+] /apps/cmake/3.24.2 (external cmake-3.24.2-tr5446kifdb2z2ygjannnsdf5st2hqvl)
==> [email protected] : has external module in ['openmpi/4.1.4']
[+] /apps/openmpi/4.1.4 (external openmpi-4.1.4-yvq3ppqr2udizcor23x7j2x6qmd6xuxs)
[+] /usr (external pkgconf-1.4.2-vqr4piq7hjmtknwkpijthk2c6iehgcfq)
[+] /scratch/tm70/aph502/opt/spack/linux-rocky8-cascadelake/intel-2021.6.0/zlib-1.2.13-qbwlozg4cobphkvyaizqmi47xw3ara5o
[+] /usr (external m4-1.4.18-6lm7an562pgot5yidv7coxy2hp5yrknh)
[+] /scratch/tm70/aph502/opt/spack/linux-rocky8-cascadelake/intel-2021.6.0/zstd-1.5.2-hvjxleot65gcc6xeciefjgeimov4i72l
[+] /scratch/tm70/aph502/opt/spack/linux-rocky8-cascadelake/intel-2021.6.0/hdf5-1.12.2-xmsywdnkwqsjl5t3qqcngqeztbeybznn
[+] /scratch/tm70/aph502/opt/spack/linux-rocky8-cascadelake/intel-2021.6.0/netcdf-c-4.9.0-t5vmcraajgpax4rnsuceljayogf5zmdb
[+] /scratch/tm70/aph502/opt/spack/linux-rocky8-cascadelake/intel-2021.6.0/netcdf-fortran-4.6.0-l6jywjuwrnqdfheafvxrnslkvrafhpr7
==> Installing mom5-develop-62paz5tcrnugsygog5oh6fr2ja2fhvdr 
==> No binary for mom5-develop-62paz5tcrnugsygog5oh6fr2ja2fhvdr found: installing from source
==> Already patched mom5                                            
==> mom5: Executing phase: 'cmake'     
==> [2023-01-17-14:49:40.043232] '/apps/cmake/3.24.2/bin/cmake' '-G' 'Unix Makefiles' '-DCMAKE_INSTALL_PREFIX:STRING=/scratch/tm70/aph502/opt/spack/linux-rocky8-cascadelake/in$
el-2021.6.0/mom5-develop-62paz5tcrnugsygog5oh6fr2ja2fhvdr' '-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo' '-DBUILD_TESTING:BOOL=OFF' '-DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=OFF$
 '-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON' '-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=ON' '-DCMAKE_INSTALL_RPATH:STRING=/scratch/tm70/aph502/opt/spack/linux-rocky8-cascadelake/intel-2$
21.6.0/mom5-develop-62paz5tcrnugsygog5oh6fr2ja2fhvdr/lib;/scratch/tm70/aph502/opt/spack/linux-rocky8-cascadelake/intel-2021.6.0/mom5-develop-62paz5tcrnugsygog5oh6fr2ja2fhvdr/l$
b64;/scratch/tm70/aph502/opt/spack/linux-rocky8-cascadelake/intel-2021.6.0/netcdf-c-4.9.0-t5vmcraajgpax4rnsuceljayogf5zmdb/lib;/scratch/tm70/aph502/opt/spack/linux-rocky8-casc$
delake/intel-2021.6.0/hdf5-1.12.2-xmsywdnkwqsjl5t3qqcngqeztbeybznn/lib;/apps/openmpi/4.1.4/lib;/scratch/tm70/aph502/opt/spack/linux-rocky8-cascadelake/intel-2021.6.0/zlib-1.2.$
3-qbwlozg4cobphkvyaizqmi47xw3ara5o/lib;/scratch/tm70/aph502/opt/spack/linux-rocky8-cascadelake/intel-2021.6.0/zstd-1.5.2-hvjxleot65gcc6xeciefjgeimov4i72l/lib;/scratch/tm70/aph$
02/opt/spack/linux-rocky8-cascadelake/intel-2021.6.0/netcdf-fortran-4.6.0-l6jywjuwrnqdfheafvxrnslkvrafhpr7/lib' '-DCMAKE_PREFIX_PATH:STRING=/scratch/tm70/aph502/opt/spack/linu$
-rocky8-cascadelake/intel-2021.6.0/netcdf-fortran-4.6.0-l6jywjuwrnqdfheafvxrnslkvrafhpr7;/scratch/tm70/aph502/opt/spack/linux-rocky8-cascadelake/intel-2021.6.0/netcdf-c-4.9.0-$
5vmcraajgpax4rnsuceljayogf5zmdb;/scratch/tm70/aph502/opt/spack/linux-rocky8-cascadelake/intel-2021.6.0/zstd-1.5.2-hvjxleot65gcc6xeciefjgeimov4i72l;/scratch/tm70/aph502/opt/spa$
k/linux-rocky8-cascadelake/intel-2021.6.0/hdf5-1.12.2-xmsywdnkwqsjl5t3qqcngqeztbeybznn;/scratch/tm70/aph502/opt/spack/linux-rocky8-cascadelake/intel-2021.6.0/zlib-1.2.13-qbwlo$
g4cobphkvyaizqmi47xw3ara5o;/apps/openmpi/4.1.4;/apps/cmake/3.24.2' '-DCPPFLAGS:STRING=-Duse_netCDF=1 -Duse_libMPI=1 -DLAND_BND_TRACERS=1 -DUSE_OCEAN_BGC=1 -DENABLE_ODA=1 -DSPMD
=1' '/home/502/aph502/code/fortran/MOM5/cmake'
Build type: RelWithDebInfo
-- Could NOT find MPI_Fortran (missing: MPI_Fortran_F77_HEADER_DIR MPI_Fortran_MODULE_DIR) (found version "3.1")
CMake Error at /apps/cmake/3.24.2/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find MPI (missing: MPI_Fortran_FOUND Fortran) (found version
  "3.1")
Call Stack (most recent call first):
  /apps/cmake/3.24.2/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /apps/cmake/3.24.2/share/cmake-3.24/Modules/FindMPI.cmake:1835 (find_package_handle_standard_args)
  CMakeLists.txt:30 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/502/aph502/code/fortran/MOM5/cmake/CMakeFiles/CMakeOutput.log".
==> Error: ProcessError: Command exited with status 1:
    '/apps/cmake/3.24.2/bin/cmake' '-G' 'Unix Makefiles' '-DCMAKE_INSTALL_PREFIX:STRING=/scratch/tm70/aph502/opt/spack/linux-rocky8-cascadelake/intel-2021.6.0/mom5-develop-62pa
z5tcrnugsygog5oh6fr2ja2fhvdr' '-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo' '-DBUILD_TESTING:BOOL=OFF' '-DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=OFF' '-DCMAKE_VERBOSE_MAKEFILE:BO
OL=ON' '-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=ON' '-DCMAKE_INSTALL_RPATH:STRING=/scratch/tm70/aph502/opt/spack/linux-rocky8-cascadelake/intel-2021.6.0/mom5-develop-62paz5tcr
nugsygog5oh6fr2ja2fhvdr/lib;/scratch/tm70/aph502/opt/spack/linux-rocky8-cascadelake/intel-2021.6.0/mom5-develop-62paz5tcrnugsygog5oh6fr2ja2fhvdr/lib64;/scratch/tm70/aph502/opt/
spack/linux-rocky8-cascadelake/intel-2021.6.0/netcdf-c-4.9.0-t5vmcraajgpax4rnsuceljayogf5zmdb/lib;/scratch/tm70/aph502/opt/spack/linux-rocky8-cascadelake/intel-2021.6.0/hdf5-1.
12.2-xmsywdnkwqsjl5t3qqcngqeztbeybznn/lib;/apps/openmpi/4.1.4/lib;/scratch/tm70/aph502/opt/spack/linux-rocky8-cascadelake/intel-2021.6.0/zlib-1.2.13-qbwlozg4cobphkvyaizqmi47xw3
ara5o/lib;/scratch/tm70/aph502/opt/spack/linux-rocky8-cascadelake/intel-2021.6.0/zstd-1.5.2-hvjxleot65gcc6xeciefjgeimov4i72l/lib;/scratch/tm70/aph502/opt/spack/linux-rocky8-cas
cadelake/intel-2021.6.0/netcdf-fortran-4.6.0-l6jywjuwrnqdfheafvxrnslkvrafhpr7/lib' '-DCMAKE_PREFIX_PATH:STRING=/scratch/tm70/aph502/opt/spack/linux-rocky8-cascadelake/intel-202
1.6.0/netcdf-fortran-4.6.0-l6jywjuwrnqdfheafvxrnslkvrafhpr7;/scratch/tm70/aph502/opt/spack/linux-rocky8-cascadelake/intel-2021.6.0/netcdf-c-4.9.0-t5vmcraajgpax4rnsuceljayogf5zm
db;/scratch/tm70/aph502/opt/spack/linux-rocky8-cascadelake/intel-2021.6.0/zstd-1.5.2-hvjxleot65gcc6xeciefjgeimov4i72l;/scratch/tm70/aph502/opt/spack/linux-rocky8-cascadelake/in
tel-2021.6.0/hdf5-1.12.2-xmsywdnkwqsjl5t3qqcngqeztbeybznn;/scratch/tm70/aph502/opt/spack/linux-rocky8-cascadelake/intel-2021.6.0/zlib-1.2.13-qbwlozg4cobphkvyaizqmi47xw3ara5o;/a
pps/openmpi/4.1.4;/apps/cmake/3.24.2' '-DCPPFLAGS:STRING=-Duse_netCDF=1 -Duse_libMPI=1 -DLAND_BND_TRACERS=1 -DUSE_OCEAN_BGC=1 -DENABLE_ODA=1 -DSPMD=1' '/home/502/aph502/code/fo
rtran/MOM5/cmake'

1 error found in build log:
  >> 5    CMake Error at /apps/cmake/3.24.2/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
     6      Could NOT find MPI (missing: MPI_Fortran_FOUND Fortran) (found version
     7      "3.1")
     8    Call Stack (most recent call first):
     9      /apps/cmake/3.24.2/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
     10     /apps/cmake/3.24.2/share/cmake-3.24/Modules/FindMPI.cmake:1835 (find_package_handle_standard_args)
     11     CMakeLists.txt:30 (find_package)

See build log for details:
  /home/502/aph502/code/fortran/MOM5/spack-build-out.txt

This is an issue with finding the MPI libraries. The CMake was designed to cope with compiling on gadi with bespoke MPI libraries by just assuming everything was ok if MPIFORT_EXE was defined. I thought that was what was done in the exp/cmake_compile.csh script, but I can't see it now, so am a bit confused.

In any case, cleaning that up in the same manner as the libaccessom2 package should fix this I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants