Here are the compiler flags that worked for me (CCSM passed DB, ER, HR, and YR tests, plus 20 year run looks reasonable when compared with NCAR control run using AMWG diagnostic package). Some of the flags are redundant, but it works, so I don't want to waste time if it doesn't change the output. If you see a problem with anything, please let me know though.
I'm using ifort (/opt/intel/fce/10.1.015/bin/ifort) and OpenMPI. OS is CentOS (latest Rocks release). Intel E5420 chips. If you want additional info, let me know.
Macros.Linux:
INCLDIR := -I. -I$(INC_NETCDF) -I$(INCROOT) -I$(INC_MPI) -I$(NETCDF_MOD)
SLIBS := -L$(LIB_NETCDF) -lnetcdf -llapack -lblas -L$(LIB_MPI) -lmpi_f77 -lmpi
ULIBS := -L$(LIBROOT) -lesmf -lmct -lmpeu -lmph
CPP := NONE
CPPFLAGS := -DLINUX -DPGF90 -DNO_SHR_VMATH
CPPDEFS := -DLINUX
CC := icc
CFLAGS := -c
CFLAGS += -DUSE_GCC
FIXEDFLAGS :=
FC := ifort
FFLAGS := -cpp -c -r8 -i4 -132 -autodouble -convert big_endian -fp-model precise -prec-div -prec-sqrt
# c: prevents linking
# cpp: use c pre-processor
# r8 8byte reals (autodouble does this as well)
# i4 4 byte ints
# 132 statements end at column 132
CPPFLAGS := -DLINUX -DPGF90 -DNO_SHR_VMATH -DINTEL_COMPILER -DpgiFortran -Df2cFortran
# some of these probably can be eliminated. I didn't want to spend too much time refining this, since I have something that works
MOD_SUFFIX := mod
LD := $(FC)
AR := ar
ifeq ($(MODEL),pop)
CPPDEFS := $(CPPDEFS) -DPOSIX -Dimpvmix -Dcoupled
-DNPROC_X=$(NX) -DNPROC_Y=$(NY)
FIXEDFLAGS := -convert big_endian -assume byterecl
endif
ifeq ($(MODEL),csim)
CPPDEFS := $(CPPDEFS) -Dcoupled -DNPROC_X=$(NX) -DNPROC_Y=$(NY) -D_MPI
FIXEDFLAGS := -convert big_endian -assume byterecl
endif
ifeq ($(THREAD),TRUE)
CPPDEFS := $(CPPDEFS) -D_OPENMP -DTHREADED_PTHREADS
FREEFLAGS := $(FREEFLAGS) -openmp
LDFLAGS := $(LDFLAGS) -openmp
endif
# haven't checked OMP flags yet.
ifeq ($(DEBUG),TRUE)
FFLAGS := $(FFLAGS) -debug
endif
I haven't tried hybrid MPI/openmp yet. I submit the jobs with sun grid engine, and my mpirun command (in the run script) is
mpirun -v -x KMP_STACKSIZE -np $NTASKS[1] $COMPONENTS[1] : -np $NTASKS[2] $COMPONENTS[2] : -np $NTASKS[3] $COMPONENTS[3] : -np $NTASKS[4] $COMPONENTS[4] : -np $NTASKS[5] $COMPONENTS[5]
My env.linux.machine file includes:
set MPICH = /usr/mpi/intel/openmpi-1.2.5
setenv INC_MPI $MPICH/include
setenv LIB_MPI $MPICH/lib64
setenv PATH ${MPICH}/bin:${PATH}
setenv MPI_LIB_NAME mpi_f77
setenv INC_NETCDF /usr/local/include
setenv LIB_NETCDF /usr/local/lib64
Enjoy!
-Karen
I'm using ifort (/opt/intel/fce/10.1.015/bin/ifort) and OpenMPI. OS is CentOS (latest Rocks release). Intel E5420 chips. If you want additional info, let me know.
Macros.Linux:
INCLDIR := -I. -I$(INC_NETCDF) -I$(INCROOT) -I$(INC_MPI) -I$(NETCDF_MOD)
SLIBS := -L$(LIB_NETCDF) -lnetcdf -llapack -lblas -L$(LIB_MPI) -lmpi_f77 -lmpi
ULIBS := -L$(LIBROOT) -lesmf -lmct -lmpeu -lmph
CPP := NONE
CPPFLAGS := -DLINUX -DPGF90 -DNO_SHR_VMATH
CPPDEFS := -DLINUX
CC := icc
CFLAGS := -c
CFLAGS += -DUSE_GCC
FIXEDFLAGS :=
FC := ifort
FFLAGS := -cpp -c -r8 -i4 -132 -autodouble -convert big_endian -fp-model precise -prec-div -prec-sqrt
# c: prevents linking
# cpp: use c pre-processor
# r8 8byte reals (autodouble does this as well)
# i4 4 byte ints
# 132 statements end at column 132
CPPFLAGS := -DLINUX -DPGF90 -DNO_SHR_VMATH -DINTEL_COMPILER -DpgiFortran -Df2cFortran
# some of these probably can be eliminated. I didn't want to spend too much time refining this, since I have something that works
MOD_SUFFIX := mod
LD := $(FC)
AR := ar
ifeq ($(MODEL),pop)
CPPDEFS := $(CPPDEFS) -DPOSIX -Dimpvmix -Dcoupled
-DNPROC_X=$(NX) -DNPROC_Y=$(NY)
FIXEDFLAGS := -convert big_endian -assume byterecl
endif
ifeq ($(MODEL),csim)
CPPDEFS := $(CPPDEFS) -Dcoupled -DNPROC_X=$(NX) -DNPROC_Y=$(NY) -D_MPI
FIXEDFLAGS := -convert big_endian -assume byterecl
endif
ifeq ($(THREAD),TRUE)
CPPDEFS := $(CPPDEFS) -D_OPENMP -DTHREADED_PTHREADS
FREEFLAGS := $(FREEFLAGS) -openmp
LDFLAGS := $(LDFLAGS) -openmp
endif
# haven't checked OMP flags yet.
ifeq ($(DEBUG),TRUE)
FFLAGS := $(FFLAGS) -debug
endif
I haven't tried hybrid MPI/openmp yet. I submit the jobs with sun grid engine, and my mpirun command (in the run script) is
mpirun -v -x KMP_STACKSIZE -np $NTASKS[1] $COMPONENTS[1] : -np $NTASKS[2] $COMPONENTS[2] : -np $NTASKS[3] $COMPONENTS[3] : -np $NTASKS[4] $COMPONENTS[4] : -np $NTASKS[5] $COMPONENTS[5]
My env.linux.machine file includes:
set MPICH = /usr/mpi/intel/openmpi-1.2.5
setenv INC_MPI $MPICH/include
setenv LIB_MPI $MPICH/lib64
setenv PATH ${MPICH}/bin:${PATH}
setenv MPI_LIB_NAME mpi_f77
setenv INC_NETCDF /usr/local/include
setenv LIB_NETCDF /usr/local/lib64
Enjoy!
-Karen