ukaea/ReMKiT1D

petscksp.mod not found

sassy-crick opened this issue · 2 comments

Dear all,
I am trying to install the latest version from GitHub and I am failing with this error message (using Ninja, simply to get a better output):

[1/404] /home/sassy/apps/software/GCCcore/11.3.0/bin/f95 -I/home/sassy/easybuild/remkit1d/source/git/ReMKiT1D/src/modules/solver_support -I/home/sassy/apps/software/HDF5/1.12.2-gompi-2022a/include -I/home/sassy/apps/software/json-fortran/8.3.0-GCCcore-11.3.0/include -I/home/sassy/easybuild/remkit1d/source/git/build/src/modules/solver_support/include -I/home/sassy/easybuild/remkit1d/source/git/build/src/modules/parameters/include -I/home/sassy/easybuild/remkit1d/source/git/build/src/modules/basic_support/include -I/home/sassy/easybuild/remkit1d/source/git/build/src/modules/grid/include -I/home/sassy/easybuild/remkit1d/source/git/build/src/modules/variables/include -I/home/sassy/easybuild/remkit1d/source/git/build/src/modules/mpi_support/include -I/home/sassy/apps/software/OpenMPI/4.1.4-GCC-11.3.0/include -I/home/sassy/apps/software/OpenMPI/4.1.4-GCC-11.3.0/lib -O3 -DNDEBUG -O3 -Jsrc/modules/solver_support/include -cpp -fpreprocessed -c src/modules/solver_support/CMakeFiles/solver_support.dir/petsc_controller.f90-pp.f90 -o src/modules/solver_support/CMakeFiles/solver_support.dir/petsc_controller.f90.o
FAILED: src/modules/solver_support/CMakeFiles/solver_support.dir/petsc_controller.f90.o src/modules/solver_support/include/petsc_controller_class.mod 
/home/sassy/apps/software/GCCcore/11.3.0/bin/f95 -I/home/sassy/easybuild/remkit1d/source/git/ReMKiT1D/src/modules/solver_support -I/home/sassy/apps/software/HDF5/1.12.2-gompi-2022a/include -I/home/sassy/apps/software/json-fortran/8.3.0-GCCcore-11.3.0/include -I/home/sassy/easybuild/remkit1d/source/git/build/src/modules/solver_support/include -I/home/sassy/easybuild/remkit1d/source/git/build/src/modules/parameters/include -I/home/sassy/easybuild/remkit1d/source/git/build/src/modules/basic_support/include -I/home/sassy/easybuild/remkit1d/source/git/build/src/modules/grid/include -I/home/sassy/easybuild/remkit1d/source/git/build/src/modules/variables/include -I/home/sassy/easybuild/remkit1d/source/git/build/src/modules/mpi_support/include -I/home/sassy/apps/software/OpenMPI/4.1.4-GCC-11.3.0/include -I/home/sassy/apps/software/OpenMPI/4.1.4-GCC-11.3.0/lib -O3 -DNDEBUG -O3 -Jsrc/modules/solver_support/include -cpp -fpreprocessed -c src/modules/solver_support/CMakeFiles/solver_support.dir/petsc_controller.f90-pp.f90 -o src/modules/solver_support/CMakeFiles/solver_support.dir/petsc_controller.f90.o
/home/sassy/easybuild/remkit1d/source/git/ReMKiT1D/src/modules/solver_support/petsc_controller.f90:28:9:

   28 |     use petscksp
      |         1
Fatal Error: Cannot open module file ‘petscksp.mod’ for reading at (1): No such file or directory
compilation terminated.
ninja: build stopped: subcommand failed.

However, the file actually exists in the PETSc include directory:

$ ls -lh /home/sassy/apps/software/PETSc/3.17.4-foss-2022a/include/petscksp.mod
-rw-r--r-- 1 sassy sassy 213K Dec 19  2022 /home/sassy/apps/software/PETSc/3.17.4-foss-2022a/include/petscksp.mod

Closer inspection reveals that the include-path is not set in build.ninja:

build src/modules/solver_support/CMakeFiles/solver_support.dir/petsc_controller.f90-pp.f90 | src/modules/solver_support/CMakeFiles/solver_support.dir/petsc_controller.f90.o.ddi: Fortran_PREPROCESS_SCAN__solver_support_RELEASE /home/sassy/easybuild/remkit1d/source/git/ReMKiT1D/src/modules/solver_support/petsc_controller.f90 || cmake_object_order_depends_target_solver_support
  DEP_FILE = src/modules/solver_support/CMakeFiles/solver_support.dir/petsc_controller.f90-pp.f90.d
  DYNDEP_INTERMEDIATE_FILE = src/modules/solver_support/CMakeFiles/solver_support.dir/petsc_controller.f90.o.ddi
  FLAGS = -O3 -DNDEBUG -O3 -Jsrc/modules/solver_support/include -cpp
  INCLUDES = -I/home/sassy/apps/software/HDF5/1.12.2-gompi-2022a/include -I/home/sassy/apps/software/json-fortran/8.3.0-GCCcore-11.3.0/include -I/home/sassy/easybuild/remkit1d/source/git/build/src/modules/solver_support/include -I/home/sassy/easybuild/remkit1d/source/git/build/src/modules/parameters/include -I/home/sassy/easybuild/remkit1d/source/git/build/src/modules/basic_support/include -I/home/sassy/easybuild/remkit1d/source/git/build/src/modules/grid/include -I/home/sassy/easybuild/remkit1d/source/git/build/src/modules/variables/include -I/home/sassy/easybuild/remkit1d/source/git/build/src/modules/mpi_support/include -I/home/sassy/apps/software/OpenMPI/4.1.4-GCC-11.3.0/include -I/home/sassy/apps/software/OpenMPI/4.1.4-GCC-11.3.0/lib
  OBJ_FILE = src/modules/solver_support/CMakeFiles/solver_support.dir/petsc_controller.f90.o

build src/modules/solver_support/CMakeFiles/solver_support.dir/petsc_controller.f90.o: Fortran_COMPILER__solver_support_RELEASE src/modules/solver_support/CMakeFiles/solver_support.dir/petsc_controller.f90-pp.f90 || src/modules/solver_support/CMakeFiles/solver_support.dir/Fortran.dd
  FLAGS = -O3 -DNDEBUG -O3 -Jsrc/modules/solver_support/include -cpp -fpreprocessed
  INCLUDES = -I/home/sassy/easybuild/remkit1d/source/git/ReMKiT1D/src/modules/solver_support -I/home/sassy/apps/software/HDF5/1.12.2-gompi-2022a/include -I/home/sassy/apps/software/json-fortran/8.3.0-GCCcore-11.3.0/include -I/home/sassy/easybuild/remkit1d/source/git/build/src/modules/solver_support/include -I/home/sassy/easybuild/remkit1d/source/git/build/src/modules/parameters/include -I/home/sassy/easybuild/remkit1d/source/git/build/src/modules/basic_support/include -I/home/sassy/easybuild/remkit1d/source/git/build/src/modules/grid/include -I/home/sassy/easybuild/remkit1d/source/git/build/src/modules/variables/include -I/home/sassy/easybuild/remkit1d/source/git/build/src/modules/mpi_support/include -I/home/sassy/apps/software/OpenMPI/4.1.4-GCC-11.3.0/include -I/home/sassy/apps/software/OpenMPI/4.1.4-GCC-11.3.0/lib
  OBJECT_DIR = src/modules/solver_support/CMakeFiles/solver_support.dir
  OBJECT_FILE_DIR = src/modules/solver_support/CMakeFiles/solver_support.dir
  dyndep = src/modules/solver_support/CMakeFiles/solver_support.dir/Fortran.dd

For me it appears that if PETSc is not installed via apt or so, although running cmake does find it, the include is not set:

$ cmake -B ../build4 -G Ninja 
-- The Fortran compiler identification is GNU 11.3.0
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /home/sassy/apps/software/GCCcore/11.3.0/bin/f95 - skipped
-- Found MPI_Fortran: /home/sassy/apps/software/OpenMPI/4.1.4-GCC-11.3.0/lib/libmpi_usempif08.so (found version "3.1") 
-- Found MPI: TRUE (found version "3.1")  
-- Found PkgConfig: /home/sassy/apps/software/pkgconf/1.8.0-GCCcore-11.3.0/bin/pkg-config (found version "1.8.0") 
-- Checking for module 'petsc'
--   Found petsc, version 3.17.4
[ ... ]

That looks like a bug to me. Would it be possible to fix that?
Also, is there a new release planned? It would be quite nice to install the software with a release-version, rather than a GitHub tag. This makes it a bit easier to reproduce the installation and also make quoting easier.

Thanks for your help!

SMijin commented

Thanks for raising this, and apologies for the late reply.

I believe I've come across this issue previously when I tried using gfortran-11.3.0 on my Ubuntu 22.04 laptop. Could you try reproducing the issue with an earlier minor version of gfortran-11 just to make sure my hunch isn't wrong? The default we use on HPC is 11.2.0.

Have you been trying to install from the dev branch for version 1.1.0? The release of that is not planned for at least another couple of months as there are a few more QoL features I'd like to have. There might be scope for a pre-release of those features, though.

SMijin commented

One thing to check is whether PETSC_DIR and PETSC_ARCH environment variables are set correctly, but it is pretty weird that cmake is finding the library and not putting it into includes. I hope to be able to dig deeper into this over the next week or so.