pFUnit_demos icon indicating copy to clipboard operation
pFUnit_demos copied to clipboard

Issue with Basic CMake tests

Open mathomp4 opened this issue 4 years ago • 2 comments

Exposed during testing with latest pFUnit (on main):

$ ./build_with_cmake_and_run.x
-- The Fortran compiler identification is GNU 10.1.0
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /usr/local/other/gcc/10.1.0/bin/gfortran - skipped
-- Checking whether /usr/local/other/gcc/10.1.0/bin/gfortran supports Fortran 90
-- Checking whether /usr/local/other/gcc/10.1.0/bin/gfortran supports Fortran 90 - yes
-- Found Python: /usr/bin/python3.4 (found version "3.4.6") found components: Interpreter
-- Found OpenMP_Fortran: -fopenmp (found version "4.5")
-- Found OpenMP: TRUE (found version "4.5")
-- Configuring done
-- Generating done
-- Build files have been written to: /discover/nobackup/mathomp4/FixGFE/pFUnit_demos/Basic/build
Scanning dependencies of target sut
[  4%] Building Fortran object src/CMakeFiles/sut.dir/throw.F90.o
[  8%] Building Fortran object src/CMakeFiles/sut.dir/broken_sut.F90.o
[ 13%] Building Fortran object src/CMakeFiles/sut.dir/working_sut.F90.o
[ 17%] Linking Fortran static library libsut.a
[ 17%] Built target sut
[ 21%] Generating test_disable.F90
Processing file ../../tests/test_disable.pf
Processing disable:
 ... Done.  Results in test_disable.F90
Scanning dependencies of target disabled_test
[ 26%] Building Fortran object tests/CMakeFiles/disabled_test.dir/discover/nobackup/mathomp4/FixGFE/pFUnit/build/installed/PFUNIT-4.1/include/driver.F90.o
[ 30%] Building Fortran object tests/CMakeFiles/disabled_test.dir/test_disable.F90.o
[ 34%] Linking Fortran executable disabled_test
[ 34%] Built target disabled_test
[ 39%] Generating test_error_handling.F90
Processing file ../../tests/test_error_handling.pf
 ... Done.  Results in test_error_handling.F90
Scanning dependencies of target error_handling
[ 43%] Building Fortran object tests/CMakeFiles/error_handling.dir/discover/nobackup/mathomp4/FixGFE/pFUnit/build/installed/PFUNIT-4.1/include/driver.F90.o
/discover/nobackup/mathomp4/FixGFE/pFUnit/build/installed/PFUNIT-4.1/include/driver.F90:56:11:

   56 |       use PFUNIT_EXTRA_USE
      |           1
Fatal Error: Cannot open module file ‘throw_with_pfunit_mod.mod’ for reading at (1): No such file or directory
compilation terminated.
tests/CMakeFiles/error_handling.dir/build.make:111: recipe for target 'tests/CMakeFiles/error_handling.dir/discover/nobackup/mathomp4/FixGFE/pFUnit/build/installed/PFUNIT-4.1/include/driver.F90.o' failed
make[2]: *** [tests/CMakeFiles/error_handling.dir/discover/nobackup/mathomp4/FixGFE/pFUnit/build/installed/PFUNIT-4.1/include/driver.F90.o] Error 1
CMakeFiles/Makefile2:193: recipe for target 'tests/CMakeFiles/error_handling.dir/all' failed
make[1]: *** [tests/CMakeFiles/error_handling.dir/all] Error 2
Makefile:113: recipe for target 'all' failed
make: *** [all] Error 2

mathomp4 avatar Feb 05 '21 16:02 mathomp4

This appears to be a change in how CMake deals with the macro. We sort of got lucky that this was working before. One fix would be to compile the OTHER_SOURCES in a separate library and thereby ensure the dependencies are enforced.

Another possibility that I'm now considering is to have CMake explicitly copy driver.F90 and use CMake variables for the preprocessing. This is overkill for the current issue but addresses a different rare problem seen in large parallel builds where the Intel compiler steps on its own toes as it preprocesses driver.F90 for multiple test suites and the -save-temps flag is used. (E.g., the develop branch of gFTL currently has this issue, so the flag has been removed temporarily.)

tclune avatar Feb 05 '21 17:02 tclune

Oh - and the reason to not do the CMake file copy is that it would break other use cases where users have their own CMake/Make logic for building a test suite.

tclune avatar Feb 05 '21 17:02 tclune