Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WW3 does not compile on femto/intel with wrong compiler selection #129

Open
platipodium opened this issue Sep 7, 2022 · 7 comments
Open

Comments

@platipodium
Copy link
Contributor

./build.sh -plat femto -component WW3  -compiler intel

fails with

[INFO] list of the programs selected : ww3_prnc

Processing ww3_prnc
---------------------
make[2]: Entering directory `/sciclone/home20/clemmen/devel/noaa/CoastalApp/WW3/model/ftn'
ad3 : processing w3nmlprncmd
mv: der Aufruf von stat für „w3nmlprncmd.o“ ist nicht möglich: Datei oder Verzeichnis nicht gefunden
ad3 : processing ww3_prnc
mv: der Aufruf von stat für „ww3_prnc.o“ ist nicht möglich: Datei oder Verzeichnis nicht gefunden
      Linking ww3_prnc
      *** file ww3_prnc.o not found ***
      *** file w3nmlprncmd.o not found ***
@platipodium
Copy link
Contributor Author

We previously discussed this in #102, I am summarising here:

With intel:

cat ~/devel/noaa/CoastalApp/WW3/model/tmp/ww3_prnc.err
/sciclone/home20/clemmen/devel/noaa/CoastalApp/WW3/model/bin/comp: Zeile 96: /opt/spack/lib/spack/env/intel/ifort: Keine Berechtigung

This seems to be related to NetCDF issues, there was a fix proposed (and working for gnu) by @acrosby

We did the following for our ADCIRC/WW3/ATMESH Docker image build to resolve the WW3 gnu/linux build issues with the netcdf dependent WW3 components:

sed 's/`$NETCDF_CONFIG --fc`/gfortran/g' -i WW3/model/bin/comp.tmpl
sed 's/`$NETCDF_CONFIG --includedir`/\/usr\/local\/include/g' -i WW3/model/bin/comp.tmpl
sed 's/`$NETCDF_CONFIG --fc`/gfortran/g' -i WW3/model/bin/link.tmpl
sed 's/`$NETCDF_CONFIG --includedir`/\/usr\/local\/include/g' -i WW3/model/bin/link.tmpl
sed 's/`$NETCDF_CONFIG --flibs`/-L\/usr\/local\/lib -lnetcdff -lnetcdf /g' -i WW3/model/bin/link.tmpl

Not sure why the backticks are not getting processed correctly, but this brute forces the required outputs for our cases, where we have manually built netcdf4, netcdf fortran and hdf5 into the /usr/local prefix.

@platipodium
Copy link
Contributor Author

platipodium commented Sep 7, 2022

From NEMS:

$(ww3_mk): configure
        +$(MODULE_LOGIC) ; set -x ; cd $(WW3_SRCDIR)/esmf       ; \
        export $(WW3_ALL_OPTS)                                  ; \
        exec $(MAKE) -j 1 WW3_COMP="$(WW3_CONFOPT)" COMP_BINDIR="$(WW3_BINDIR)" ww3_nems

WW3_ALL_OPTS= \
  COMP_SRCDIR="$(WW3_SRCDIR)" \
  COMP_BINDIR="$(WW3_BINDIR)" \
  WW3_COMP="$(WW3_CONFOPT)"

@platipodium
Copy link
Contributor Author

One of the culprits is the determination of the fortran compiler via nf-config in WW3/model/bin/comp

 # netcdf include dir
  if [ "$netcdf_compile" = 'yes' ]
  then
    case $WWATCH3_NETCDF in
      NC3) opt="$opt -I$NETCDF_INCDIR" ;;
      NC4) if [ "$mpi_mod" = 'no' ]; then comp="`$NETCDF_CONFIG --fc`"; fi
           opt="$opt -I`$NETCDF_CONFIG --includedir`" ;;
    esac
  fi

On femto, this results in a wrong compiler selected, as nc-config --fc differs from $ESMF_F90COMPILER

@platipodium
Copy link
Contributor Author

@awest-noaa How do you set the variable $comp to align with $ESMF_F90COMPILER?

@platipodium
Copy link
Contributor Author

I have a workaround:

  • in the environment, export ESMF_F90COMPILER to the one identified with grep ESMF_F90COMPILER $ESMFMKFILE
  • in comp.tmpl and link.tmpl, set comp=$ESMF_F90COMPILER around line 96

@platipodium
Copy link
Contributor Author

The problem can be reduced to cmplr.env , which basically states:

if [ "$cmplr" == "intel" ] ; then
  comp_seq='ifort'
  comp_mpi='mpiifort'
fi

This is problematic @awest-noaa for two reasons:

  1. On some systems, the intel parallel MPI fortran is called mpifort or mpif90 (single i)
  2. The ifort on $PATH selected here may be a different one than the one ESMF was compiled with.

I recommend to check whether we compile with ESMF and then simply select the $ESMF_F90COMPILER. If not compiled with ESMF, this needs some checking for mpif90/mpiifort/mpifort the least.

@platipodium platipodium changed the title WW3 does not compile on femto/intel WW3 does not compile on femto/intel with wrong compiler selection Oct 11, 2022
@platipodium
Copy link
Contributor Author

platipodium commented Dec 29, 2022

(moved to #152)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant