Closed reuterbal closed 5 months ago
Documentation for this branch can be viewed at https://sites.ecmwf.int/docs/loki/294/index.html
Attention: Patch coverage is 83.72093%
with 14 lines
in your changes are missing coverage. Please review.
Project coverage is 94.93%. Comparing base (
59303e4
) to head (d3aca00
).
Files | Patch % | Lines |
---|---|---|
loki/build/compiler.py | 83.52% | 14 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Thanks, and apologies for not actually checking this properly...
I had a go at this and there is indeed a simple hook in f2py to specify the Fortran compiler. I've pushed two commits to fix this. We're now consistently using the corresponding methods from the Compiler
class to invoke f2py and f90wrap, and provide the compiler selector argument. The only caveat seems to be, that f2py does not seem to work with any other C compiler than gcc...
With this, loading the nvidia
module on Atos HPCF (which sets FC
, F90
etc. accordingly) and then running the tests with
CC=gcc pytest loki
works correctly in principle (i.e., tests that use JIT compilation, and even some transpilation tests, validate). There's a fair number of tests failing with compiler errors, but that seems to be the Nvidia compiler being genuinely unhappy with some of the files in the tests.
So, I'd be comfortable leaving the NvidiaCompiler
class in and claim that the build module supports its use, but not claim full compatibility of the test base with nvfortran. Instead, I'd suggest we defer resolving that to a separate PR.
After a slightly longer glimpse, it seems most failing tests are due to the use of Fortran 2008's iso_fortran_env and particularly real64
from that. I'm finding only conflicting information but it looks like nvfortran's support of that is limited.
JIT compilation was hard coded to
gfortran
and not using theCompiler
class in thecompile_and_load
method used throughout the test base. This prevented testing with other gfortran versions or different compilers.The first change in this PR is to make Loki use consistently the
Compiler
class for JIT compilation. This unlocks the use of other compilers when executing tests.The second change is to inspect the environment for common variables setting the compiler (
CC
,FC
,F90
) and choose an appropriate compiler. This consists of two steps:As a side-effect, this enables tests that require compilation also on MacOS. With a user-installed GNU compiler suite (e.g. via homebrew) and setting
CC=gcc-13 FC=gfortran-13 F90=gfortran-13
, the tests use now correctly the user-supplied compilers instead of the system-default "gcc-relabeled" clang compiler.