modern-fortran / tsunami

A parallel shallow water equations solver
https://modern-fortran.github.io/tsunami
MIT License
149 stars 47 forks source link

find_package(Coarray REQUIRED) breaks parallel caf build #7

Closed milancurcic closed 4 years ago

milancurcic commented 5 years ago

@scivision Unfortunately, only tonight I realized that recent updates to CMakeLists.txt broke my local parallel build.

I didn't catch this before because it seemed to build successfully, but I haven't been paying attention to cmake output -- it's been building in -fcoarray=single mode exclusively.

If I do specify a path to my OpenCoarrays install dir, the cmake config fails altogether.

$ cmake .. -DOpenCoarrays_DIR=/home/milan/opt/OpenCoarrays-2.2.0/build/CMakeFiles
-- The Fortran compiler identification is GNU 8.3.1
-- Check for working Fortran compiler: /usr/bin/f95
-- Check for working Fortran compiler: /usr/bin/f95  -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/bin/f95 supports Fortran 90
-- Checking whether /usr/bin/f95 supports Fortran 90 -- yes
-- Configuring build for 32-bit integers
-- Configuring build for 32-bit reals
CMake Error at /home/milan/opt/OpenCoarrays-2.2.0/build/CMakeFiles/OpenCoarraysConfig.cmake:1 (include):
  include could not find load file:

    /home/milan/opt/OpenCoarrays-2.2.0/build/CMakeFiles/OpenCoarraysTargets.cmake
Call Stack (most recent call first):
  cmake/Modules/FindCoarray.cmake:63 (find_package)
  CMakeLists.txt:57 (find_package)

-- Performing Test f08coarray
CMake Error at /home/milan/Work/modern-fortran/tsunami/build/CMakeFiles/CMakeTmp/CMakeLists.txt:15 (add_executable):
  Target "cmTC_54fd1" links to target "OpenCoarrays::caf_mpi" but the target
  was not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?

CMake Error at /usr/share/cmake/Modules/CheckFortranSourceCompiles.cmake:132 (try_compile):
  Failed to generate test project build system.
Call Stack (most recent call first):
  cmake/Modules/FindCoarray.cmake:87 (check_fortran_source_compiles)
  CMakeLists.txt:57 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/milan/Work/modern-fortran/tsunami/build/CMakeFiles/CMakeOutput.log".

If I comment out find_package(Coarray REQUIRED) in CMakeLists.txt, then I can successfully configure and build in the old way:

FC=caf cmake ..

I expect this issue is something trivial as it works for you and it does on Travis. Let me know if you have an idea, otherwise I currently don't have the bandwidth to debug this.

milancurcic commented 5 years ago

I began the transition to a more traditional, "directory-per-chapter" code organizations, and moving away from organization by git tag, see https://github.com/modern-fortran/tsunami/tree/refactor-by-chapter. I thought organizing by git tags would be useful (and I really enjoyed it in another book that inspired me to take that path), however it's become a nightmare to manage with the shifting around of chapters and what not. Also, based on 2nd external review, not many readers appreciate this style. Many also find friction with cmake so we'll be likely moving away from that as well, back to simpler, make-based builds.

Keeping this open for now, but will likely become a non-issue very soon

milancurcic commented 4 years ago

Clean up done and now merged in master. Closing.