NOAA-GFDL/SHiELD_build

gnu.mk file OPENMP, Undefined reference to `omp_get_ ...

Closed this issue · 2 comments

The mk_make script builds with:

(cd exec/${CONFIG}_${COMPILER} ; make -j 8 OPENMP=Y NETCDF=3 ${COMP} AVX=${AVX} ${BIT} NCEPLIBS="${NCEPLIBS}" -f Makefile_fv3)

which indicates the use of OPENMP=Y. However in the gnu.mk template file
https://github.com/NOAA-GFDL/SHiELD_build/blob/main/site/gnu.mk
it has the openmp flag commented out, for example:
FFLAGS_OPENMP = #-fopenmp
at:

FFLAGS_OPENMP = #-fopenmp

CFLAGS_OPENMP = #-fopenmp

LDFLAGS_OPENMP := #-fopenmp

This causes a series of compile-time errors of the type omp_get_ ...

At the moment I'm changing this using:

sed "s/#-fopenmp/-fopenmp/g" < ${BUILD_ROOT}/${TEMPLATE} > OUT \
  && mv OUT ${BUILD_ROOT}/${TEMPLATE}

and the model seems to compile successfully.

Is there a reason for removing the openmp flags?

I do not see any compilation errors associated with the lack of -fopenmp in the gnu.mk template. Regardless, it does make sense to activate it and a future PR will address it.

Resolved by PR #12