Closed beddalumia closed 2 years ago
Side note: apparently ifort
has no problems whatsoever
mpif90
is not needed for a fully functional MPI build-DUSE_MPI=false
it somehow manages to compile(this is a mistery to me, is it maybe buiding an MPI-aware library nonentheless? Note that the total number of targets has gone from 543 to 475, so the CMake option is indeed being recognized...)
No ok, they do not seem to be a lot, except for PARPACK, that is already handled by:
In fact grep tells us that:
$ git grep "USE MPI"
src/SF_MPI/SF_MPI.f90: ! USE MPI
$ git grep mpif.h
Only src/SF_LINALG/linalg_blacs_aux.f90
, src/SF_MPI/SF_MPI.f90
and src/SF_SP_LINALG/SF_SP_LINALG.f90
include mpif.h
(other than PARPACK) and the latter two resolve the issue by preprocessor directives:
So probably we just need to add an #ifdef _MPI
outer block here:
Of course this was also needed:
Now I manage to compile with both gfortran and ifort, so the issue appears to be solved.
If we force plain
gfortran
(instead ofmpif90
) as:The build fails even if we explicitly request for not including mpi:
click to see output
``` -- The Fortran compiler identification is GNU 12.2.0 -- Check for working Fortran compiler: /home/linuxbrew/.linuxbrew/bin/gfortran -- Check for working Fortran compiler: /home/linuxbrew/.linuxbrew/bin/gfortran -- works -- Detecting Fortran compiler ABI info -- Detecting Fortran compiler ABI info - done -- Checking whether /home/linuxbrew/.linuxbrew/bin/gfortran supports Fortran 90 -- Checking whether /home/linuxbrew/.linuxbrew/bin/gfortran supports Fortran 90 -- yes -- OS: Linux 5.15.0-46-generic -- BUILD_TYPE=RELEASE -- MKL found at: /opt/intel/compilers_and_libraries_2020.4.304/linux/mkl -- MKL supports Scalapack+Blacs -- Fortran Compiler id = GNU -- Fortran Compiler ver. = 12.2.0 -- Fortran Compiler options = -cpp -ffree-line-length-none -fPIC -w -fallow-argument-mismatch -O3 -funroll-loops -- Found Git: /usr/bin/git (found version "2.25.1") -- Git SHA1: 4f49e7d81a3067c84dcaf8ee6bf9b768e7665a3e -- Git branch: master -- Git tag: 4.9.6 -- Testing P-ARPACK patch: zdotc.patch -- Patch applied: zdotc.patch -- SF compilation lines: -L${libdir} -lscifor -L/opt/intel/compilers_and_libraries_2020.4.304/linux/mkl/lib/intel64 -lmkl_gf_lp64 -lmkl_sequential -lmkl_core -lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64 -L/usr/lib/x86_64-linux-gnu -lpthread -lm -ldl -- Version file: /home/gbellomia/Dropbox/SISSA/QcmPlab/SciFortran/buildNinja/etc/modules/scifor/gnu/.version -- Module file: scifor/gnu/4.9.6 -- Library version: 4.9.6 -- Library will be installed in: /home/gbellomia/opt/scifor/gnu/4.9.6 -- >> TO CONCLUDE INSTALLATION << Compile with: $ make Install with: $ make install Uninstall with: $ make uninstall -- Configuring done -- Generating done -- Build files have been written to: /home/gbellomia/Dropbox/SISSA/QcmPlab/SciFortran/build ```click to see output
``` Scanning dependencies of target SF_PARSE_INPUTLIB [ 0%] Building Fortran object src/SF_PARSE_INPUT/CMakeFiles/SF_PARSE_INPUTLIB.dir/LIST_INPUT.f90.o [ 1%] Building Fortran object src/SF_PARSE_INPUT/CMakeFiles/SF_PARSE_INPUTLIB.dir/SF_PARSE_INPUT.f90.o [ 1%] Built target SF_PARSE_INPUTLIB Scanning dependencies of target SF_INITLIB [ 2%] Building Fortran object src/SF_INIT/CMakeFiles/SF_INITLIB.dir/SF_ARRAYS.f90.o [ 2%] Building Fortran object src/SF_INIT/CMakeFiles/SF_INITLIB.dir/SF_COLORS.f90.o [ 3%] Building Fortran object src/SF_INIT/CMakeFiles/SF_INITLIB.dir/SF_CONSTANTS.f90.o [ 3%] Building Fortran object src/SF_INIT/CMakeFiles/SF_INITLIB.dir/SF_FONTS.f90.o [ 3%] Building Fortran object src/SF_INIT/CMakeFiles/SF_INITLIB.dir/SF_MISC.f90.o [ 4%] Building Fortran object src/SF_INIT/CMakeFiles/SF_INITLIB.dir/SF_PAULI.f90.o [ 4%] Building Fortran object src/SF_INIT/CMakeFiles/SF_INITLIB.dir/SF_TIMER.f90.o [ 4%] Built target SF_INITLIB Scanning dependencies of target SF_MPILIB [ 4%] Building Fortran object src/SF_MPI/CMakeFiles/SF_MPILIB.dir/SF_BLACS.f90.o [ 5%] Building Fortran object src/SF_MPI/CMakeFiles/SF_MPILIB.dir/SF_MPI.f90.o [ 5%] Built target SF_MPILIB Scanning dependencies of target SF_IOTOOLSLIB [ 5%] Building Fortran object src/SF_IOTOOLS/CMakeFiles/SF_IOTOOLSLIB.dir/IOFILE.f90.o [ 5%] Building Fortran object src/SF_IOTOOLS/CMakeFiles/SF_IOTOOLSLIB.dir/IOPLOT.f90.o [ 6%] Building Fortran object src/SF_IOTOOLS/CMakeFiles/SF_IOTOOLSLIB.dir/IOREAD.f90.o [ 6%] Building Fortran object src/SF_IOTOOLS/CMakeFiles/SF_IOTOOLSLIB.dir/SF_IOTOOLS.f90.o [ 6%] Built target SF_IOTOOLSLIB Scanning dependencies of target SF_DERIVATELIB [ 7%] Building Fortran object src/SF_DERIVATE/CMakeFiles/SF_DERIVATELIB.dir/SF_DERIVATE.f90.o [ 7%] Built target SF_DERIVATELIB Scanning dependencies of target SF_INTEGRATELIB [ 8%] Building Fortran object src/SF_INTEGRATE/CMakeFiles/SF_INTEGRATELIB.dir/GAUSS_QUADRATURE.f90.o [ 8%] Building Fortran object src/SF_INTEGRATE/CMakeFiles/SF_INTEGRATELIB.dir/SF_INTEGRATE.f90.o [ 8%] Built target SF_INTEGRATELIB Scanning dependencies of target SF_INTERPOLATELIB [ 9%] Building Fortran object src/SF_INTERPOLATE/CMakeFiles/SF_INTERPOLATELIB.dir/SF_INTERPOLATE.f90.o [ 9%] Built target SF_INTERPOLATELIB Scanning dependencies of target SF_LINALGLIB [ 10%] Building Fortran object src/SF_LINALG/CMakeFiles/SF_LINALGLIB.dir/SF_LINALG.f90.o linalg_blacs_aux.f90:3:0: Fatal Error: Cannot open included file 'mpif.h' compilation terminated. make[2]: *** [src/SF_LINALG/CMakeFiles/SF_LINALGLIB.dir/build.make:63: src/SF_LINALG/CMakeFiles/SF_LINALGLIB.dir/SF_LINALG.f90.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:823: src/SF_LINALG/CMakeFiles/SF_LINALGLIB.dir/all] Error 2 make: *** [Makefile:130: all] Error 2 ```Where I want to highlight the actual fortran error:
The very same error is encountered by ninja (I first discovered it here, but then cross-checked with make)
So, having it with both, I guess it is not a build-system (dependency-related) error.
Could it come from commit d9c675805ceaa2e64310fed1ecc44aad02d849c3, where the incriminate source file has moved from a
USE MPI
statement toinclude mpif.h
? As previously discussed in 71b8aead0326000dace4ab2447131aa1c83c2c4a this is crucial to avoid version mismatches but indeed it requires thempif90
wrapper, to provide its own version of thempif.h
header. Well, I'm not actually sure it would have worked with a use statement neither: what happens to theMPI
module if the compiler is not mpi-aware?I imagine that PARPACK does not raise an issue since we do not request to compile it with the
-DUSE_MPI=false
option, but for sure we need to compilelinalg_blacs_aux.f90
and there MPI is explicitly requested: https://github.com/QcmPlab/SciFortran/blob/4f49e7d81a3067c84dcaf8ee6bf9b768e7665a3e/src/SF_LINALG/linalg_blacs_aux.f90#L2-L3I actually believe that all the work needed to carefully disentangle the MPI and non-MPI features (and somehow document what you can actually use with a non-MPI install...) would not really be rewarded by any notable benefit.[See later comments, it's easier than what I expected]