Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/offline/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -147,26 +147,23 @@ PROG_MPI = cable-mpi
# from the compiled object files
OBJS := ${LSRC:.F90=.o}

#compiler switches and flags
CINC = -I$(NCMOD)

#suffixes we use
.SUFFIXES:
.SUFFIXES: .F90 .o
#default rules for these suffixes
.F90.o:
$(FC) $(CFLAGS) $(CINC) -c $<
$(FC) $(CFLAGS) -c $<

SUPPRESS_FLAGS := -warn nostderrors -diag-disable 10145

# the first target is the default target
.PHONY: serial
serial: cable_driver.F90 $(OBJS)
$(FC) $(SUPPRESS_FLAGS) $(CFLAGS) $(LDFLAGS) $(LD) -o $(PROG_SERIAL) $^ $(CINC)
$(FC) $(SUPPRESS_FLAGS) $(CFLAGS) -o $(PROG_SERIAL) $^ $(LDFLAGS)

.PHONY: mpi
mpi: cable_mpidrv.F90 cable_mpicommon.o cable_mpimaster.o cable_mpiworker.o pop_mpi.o $(OBJS)
$(FC) $(SUPPRESS_FLAGS) $(CFLAGS) $(LDFLAGS) -o $(PROG_MPI) $^ $(CINC) $(LD)
$(FC) $(SUPPRESS_FLAGS) $(CFLAGS) -o $(PROG_MPI) $^ $(LDFLAGS)

cable_mpicommon.o: cable_mpicommon.F90 $(OBJS)
pop_mpi.o: pop_mpi.F90 cable_mpicommon.o $(OBJS)
Expand Down
29 changes: 17 additions & 12 deletions src/offline/build3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,37 @@ host_gadi()
module purge
module add intel-compiler/2019.5.281
module add netcdf/4.6.3
# This is required so that the netcdf-fortran library is discoverable by
# pkg-config:
prepend_path PKG_CONFIG_PATH "${NETCDF_BASE}/lib/Intel/pkgconfig"

export NCDIR=$NETCDF_ROOT'/lib/Intel'
export NCMOD=$NETCDF_ROOT'/include/Intel'
export CFLAGS='-O2 -fp-model precise '
export LDFLAGS='-L'$NCDIR
export LD='-lnetcdf -lnetcdff'
if ! pkg-config --exists netcdf-fortran; then
echo -e "\nUnable to find netcdf-fortran via pkg-config. Exiting...\n"
exit 1
fi

if [[ $1 = 'mpi' ]]; then
module add intel-mpi/2019.5.281
export FC='mpif90'
else
export FC='ifort'
fi

CFLAGS="-O2 -fp-model precise"

if [[ $1 = 'MGK' ]]; then
export CFLAGS='-O2'
#export NCMOD=$NETCDF_ROOT'/include'
CFLAGS='-O2'
fi

if [[ $1 = 'debug' ]]; then
export CFLAGS='-O0 -traceback -g -fp-model precise -ftz -fpe0'
#export CFLAGS='-O0 -traceback -g -fp-model precise -ftz -fpe0 -check all,noarg_temp_created'
CFLAGS='-O0 -traceback -g -fp-model precise -ftz -fpe0'
#CFLAGS='-O0 -traceback -g -fp-model precise -ftz -fpe0 -check all,noarg_temp_created'
fi

CFLAGS+=" $(pkg-config --cflags netcdf-fortran)"
export CFLAGS
LDFLAGS=$(pkg-config --libs netcdf-fortran)
export LDFLAGS

if [[ $1 = 'mpi' ]]; then
build_build mpi
Expand Down Expand Up @@ -144,9 +152,6 @@ build_status()
echo ''
echo 'Oooops. Something went wrong'
echo ''
echo 'Other than compiler messages, known build issues:'
echo 'Some systems require additional library. '
echo 'e.g. Edit Makefile; add -lnetcdff to LD = ...'
fi
exit
}
Expand Down