Skip to content

Commit

Permalink
TRUNK UPDATE: ticket NCAR#6: port fv3 to theia.
Browse files Browse the repository at this point in the history
SURGE-slogin2 > svn st
 M      .
A  +    tests/Compile_theia.log
M       tests/default_vars.sh
A  +    tests/RegressionTests_theia.log
M       tests/rt.sh
A  +    tests/fv3_conf/fv3_qsub.IN_theia
M       tests/rt.conf
A  +    conf/configure.fv3.theia
M       conf/configure.fv3.wcoss_cray
A  +    conf/modules.fv3.theia
A  +    compile
M       makefile
  • Loading branch information
junwang-noaa committed Feb 3, 2017
1 parent 72a0a86 commit 73d0b89
Show file tree
Hide file tree
Showing 11 changed files with 1,114 additions and 17 deletions.
43 changes: 43 additions & 0 deletions compile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
set -eu

echo

if [[ ! -f conf/configure.fv3 ]]; then
echo "File conf/configure.fv3 not found!"
echo "Running ./configure .... "
./configure
fi

if [[ -f conf/modules.fv3 ]]; then
echo -n "Loading modules .... "
source conf/modules.fv3
echo "done."
echo
fi

set -x

echo "Running make" "$@"

make -j 8 "$@"

#make clean
#make -j 8 "$@"
#mv fv3.exe fv3_default.exe

#make clean
#make -j 8 HYDRO=Y "$@"
#mv fv3.exe fv3_hydro.exe

#make clean
#make -j 8 32BIT=Y "$@"
#mv fv3.exe fv3_32bit.exe

#make clean
#make -j 8 DEBUG=Y "$@"
#mv fv3.exe fv3_debug.exe

echo
echo "Compilation finished successfully."
echo
129 changes: 129 additions & 0 deletions conf/configure.fv3.theia
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@

############
# commands #
############
FC = mpiifort
CC = mpiicc
CXX = mpiicpc
LD = mpiifort -mkl=sequential

#########
# flags #
#########
# default is 64-bit OpenMP non-hydrostatic build using AVX2
DEBUG =
REPRO =
VERBOSE =
OPENMP = Y
AVX2 = Y
HYDRO = N

include $(ESMFMKFILE)
ESMF_INC = $(ESMF_F90COMPILEPATHS)

NCEPLIBS = $(BACIO_LIB4) $(SP_LIBd) $(W3EMC_LIBd) $(W3NCO_LIBd)

##############################################
# Need to use at least GNU Make version 3.81 #
##############################################
need := 3.81
ok := $(filter $(need),$(firstword $(sort $(MAKE_VERSION) $(need))))
ifneq ($(need),$(ok))
$(error Need at least make version $(need). Load module gmake/3.81)
endif

NETCDF_ROOT = $(NETCDF)
INCLUDE = -I$(NETCDF_ROOT)/include

FPPFLAGS := -fpp -Wp,-w $(INCLUDE)
CFLAGS := $(INCLUDE)

FFLAGS := $(INCLUDE) -fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -nowarn -sox -align array64byte

ifeq ($(HYDRO),Y)
CPPDEFS += -Duse_libMPI -Duse_netCDF -DSPMD -DUSE_LOG_DIAG_FIELD_INFO -Duse_LARGEFILE -DUSE_GFSL63 -DGFS_PHYS
else
CPPDEFS += -Duse_libMPI -Duse_netCDF -DSPMD -DUSE_LOG_DIAG_FIELD_INFO -Duse_LARGEFILE -DUSE_GFSL63 -DGFS_PHYS -DMOIST_CAPPA -DUSE_COND
endif

CPPDEFS += -DNEW_TAUCTMAX

ifeq ($(32BIT),Y)
CPPDEFS += -DOVERLOAD_R4
FFLAGS += -i4 -real-size 32
else
FFLAGS += -i4 -real-size 64 -no-prec-div -no-prec-sqrt
endif

ifeq ($(AVX2),Y)
FFLAGS += -xCORE-AVX2 -qno-opt-dynamic-align
CFLAGS += -xCORE-AVX2 -qno-opt-dynamic-align
else
FFLAGS += -xHOST -qno-opt-dynamic-align
CFLAGS += -xHOST -qno-opt-dynamic-align
endif

FFLAGS_OPT = -O2 -debug minimal -fp-model source -qoverride-limits -qopt-prefetch=3
FFLAGS_REPRO = -O2 -debug minimal -fp-model source -qoverride-limits -g -traceback
FFLAGS_DEBUG = -g -O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fp-stack-check -fstack-protector-all -fpe0 -debug -traceback -ftrapuv

TRANSCENDENTALS := -fast-transcendentals
FFLAGS_OPENMP = -qopenmp
FFLAGS_VERBOSE = -v -V -what

CFLAGS += -D__IFC -sox -fp-model source

CFLAGS_OPT = -O2 -debug minimal
CFLAGS_REPRO = -O2 -debug minimal
CFLAGS_OPENMP = -qopenmp
CFLAGS_DEBUG = -O0 -g -ftrapuv -traceback

# Optional Testing compile flags. Mutually exclusive from DEBUG, REPRO, and OPT
# *_TEST will match the production if no new option(s) is(are) to be tested.
FFLAGS_TEST = -O3 -debug minimal -fp-model source -qoverride-limits
CFLAGS_TEST = -O2

LDFLAGS :=
LDFLAGS_OPENMP := -qopenmp
LDFLAGS_VERBOSE := -Wl,-V,--verbose,-cref,-M

# start with blank LIBS
LIBS :=

ifneq ($(REPRO),)
CFLAGS += $(CFLAGS_REPRO)
FFLAGS += $(FFLAGS_REPRO)
FAST :=
else ifneq ($(DEBUG),)
CFLAGS += $(CFLAGS_DEBUG)
FFLAGS += $(FFLAGS_DEBUG)
FAST :=
else ifneq ($(TEST),)
CFLAGS += $(CFLAGS_TEST)
FFLAGS += $(FFLAGS_TEST)
FAST :=
else
CFLAGS += $(CFLAGS_OPT)
FFLAGS += $(FFLAGS_OPT)
FAST := $(TRANSCENDENTALS)
endif

ifneq ($(OPENMP),)
CFLAGS += $(CFLAGS_OPENMP)
FFLAGS += $(FFLAGS_OPENMP)
LDFLAGS += $(LDFLAGS_OPENMP)
endif

ifneq ($(VERBOSE),)
CFLAGS += $(CFLAGS_VERBOSE)
FFLAGS += $(FFLAGS_VERBOSE)
LDFLAGS += $(LDFLAGS_VERBOSE)
endif

ifneq ($(findstring netcdf/4,$(LOADEDMODULES)),)
LIBS += -L$(NETCDF)/lib -lnetcdff -lnetcdf
else
LIBS += -L$(NETCDF)/lib -lnetcdff -lnetcdf
endif

LDFLAGS += $(LIBS)
15 changes: 2 additions & 13 deletions conf/configure.fv3.wcoss_cray
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ VERBOSE =
OPENMP = Y
AVX2 = Y
HYDRO = N
NETCDF = 3

include $(ESMFMKFILE)
ESMF_INC = $(ESMF_F90COMPILEPATHS)
Expand All @@ -33,13 +32,11 @@ ifneq ($(need),$(ok))
$(error Need at least make version $(need). Load module gmake/3.81)
endif

#MAKEFLAGS += --jobs=8

NETCDF_ROOT = $(NETCDF_DIR)
MPI_ROOT = $(MPICH_DIR)
INCLUDE = -I$(NETCDF_ROOT)/include

FPPFLAGS := -fpp -Wp,-w $(INCLUDE)
CFLAGS := $(INCLUDE)

FFLAGS := $(INCLUDE) -fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -nowarn -sox -align array64byte

Expand Down Expand Up @@ -74,7 +71,7 @@ TRANSCENDENTALS := -fast-transcendentals
FFLAGS_OPENMP = -qopenmp
FFLAGS_VERBOSE = -v -V -what

CFLAGS := -D__IFC -sox -fp-model source
CFLAGS += -D__IFC -sox -fp-model source

CFLAGS_OPT = -O2 -debug minimal
CFLAGS_REPRO = -O2 -debug minimal
Expand Down Expand Up @@ -125,18 +122,10 @@ FFLAGS += $(FFLAGS_VERBOSE)
LDFLAGS += $(LDFLAGS_VERBOSE)
endif

ifeq ($(NETCDF),3)
# add the use_LARGEFILE cppdef
ifneq ($(findstring -Duse_netCDF,$(CPPDEFS)),)
CPPDEFS += -Duse_LARGEFILE
endif
endif

ifneq ($(findstring netcdf/4,$(LOADEDMODULES)),)
LIBS += -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz
else
LIBS += -lnetcdf
endif

LIBS +=
LDFLAGS += $(LIBS)
24 changes: 24 additions & 0 deletions conf/modules.fv3.theia
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
##
## purge all currently loaded modules.
## do not rely on user's environment
##
module purge

##
## load programming environment
## this typically includes compiler, MPI and job scheduler
##
module load intel/15.1.133
module load impi/5.0.3.048
module load netcdf/4.3.0
module load esmf/7.0.0

##
## load nwprod libraries
##
module use -a /scratch3/NCEPDEV/nwprod/lib/modulefiles
module load bacio/v2.0.1
module load sp/v2.0.2
module load ip/v2.0.0
module load w3nco/v2.0.6
module load w3emc/v2.0.5
6 changes: 3 additions & 3 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ esmf_make_fragment:

# fv3 library installation defaults (for NEMS):
DESTDIR := $(PWD)
INSTDATE := $(shell date '+%Y-%m-%d-%H-%M-%S')
#INSTDATE := $(shell date '+%Y-%m-%d-%H-%M-%S')
#INSTDIR := FV3_$(INSTDATE)
INSTDIR := FV3_INSTALL

Expand All @@ -69,10 +69,10 @@ clean:
(cd fms && make clean)
(cd gfsphys && make clean)
(cd fv3core && make clean)
$(RM) -f $(FV3_EXE) $(FV3CAP_LIB) *.o *.mod *.lst depend
$(RM) -f $(FV3_EXE) $(FV3CAP_LIB) *.o *.mod *.lst depend

cleanall: clean
$(RM) -rf nems_dir fv3.mk FV3_INSTALL
$(RM) -rf nems_dir fv3.mk $(INSTDIR)
$(RM) -f conf/modules.fv3
$(RM) -f conf/configure.fv3

Expand Down
Loading

0 comments on commit 73d0b89

Please sign in to comment.