module swap PrgEnv-pgi PrgEnv-pathscale export CC='cc -DpgiFortran' export FC='ftn -cpp -DpgiFortran -fno-second-underscore' export F90='ftn -DpgiFortran -cpp -fno-second-underscore' export CXX='CC -DpgiFortran' ./configure --prefix=/home/n01/n01/fionanem/netcdf/3.6.2 --disable-cxx make make check make install
The module swap PrgEnv-pgi PrgEnv-pathscale command swaps from the default (PGI) programming environment to the the PathScale programming environment. The -fno-second-underscore ensures only a single underscore is used when calling external library routines. The ./configure script must be run with the -disable-cxx option. This option prevents the C++ API from being built. If this option is not included then the link stage will fail when attempting to link the shared library libgcc_s.
To compile the NEMO model using the PathScale compiler the following flags are set in the Makefile:
EXEC_BIN = /work/n01/n01/fionanem/NEMO/ORCA025/bin/orca025k64_path # netcdf library and includes NCDF_INC = /home/n01/n01/fionanem/netcdf/3.6.2/include NCDF_LIB = -L/home/n01/n01/fionanem/netcdf/3.6.2/lib -lnetcdf P_C = ftn -Mcpp=comment P_O = M_K = gmake F_C = ftn -c -P F_L = ftn A_C = ar -r F_O = -O3 -r8 -I $(MODDIR) -I$(MODDIR)/oce -I$(NCDF_INC) L_X = -O3 -r8
As before, NCDF_INC and NCDF_LIB specify the paths to the netCDF library compiled using the PathScale compiler suite. The F_C flag needs the -P flag to ensure that the pre-processor removes lines containing # in the output. If these lines are not removed then the Fortran compiler attempts to compile these and the compilation will fail.