Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add conda environment, fix Makefile and Macros, implement -nomodules #296

Merged
merged 6 commits into from
Feb 14, 2020
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
4 changes: 0 additions & 4 deletions configuration/scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@ db_flags:
# the needed macros
#-------------------------------------------------------------------------------

ifndef $(CFLAGS_HOST)
CFLAGS_HOST :=
endif

$(DEPGEN): $(ICE_CASEDIR)/makdep.c
$(SCC) -o $@ $(CFLAGS_HOST) $<

Expand Down
5 changes: 5 additions & 0 deletions configuration/scripts/icepack.batch.csh
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ cat >> ${jobfile} << EOFB
# nothing to do
EOFB

else if (${ICE_MACHINE} =~ conda*) then
cat >> ${jobfile} << EOFB
# nothing to do
EOFB

else
echo "${0} ERROR: ${ICE_MACHINE} unknown"
exit -1
Expand Down
4 changes: 2 additions & 2 deletions configuration/scripts/machines/Macros.cheyenne_intel
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ LIB_MPI := $(IMPILIBDIR)
#SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff -L$(LIB_PNETCDF) -lpnetcdf -lgptl
SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff

ifeq ($(compile_threaded), true)
ifeq ($(ICE_THREADED), true)
LDFLAGS += -qopenmp
CFLAGS += -qopenmp
FFLAGS += -qopenmp
endif

### if using parallel I/O, load all 3 libraries. PIO must be first!
ifeq ($(IO_TYPE), pio)
ifeq ($(ICE_IOTYPE), pio)
PIO_PATH:=/glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/lib
INCLDIR += -I/glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/include
SLIBS := $(SLIBS) -L$(PIO_PATH) -lpiof
Expand Down
35 changes: 35 additions & 0 deletions configuration/scripts/machines/Macros.conda_linux
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#==============================================================================
# Makefile macros for conda environment, GNU/Linux systems
#==============================================================================

# Preprocessor macros
CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS}

# Flags for the C compiler
CFLAGS := -c -O2

# Flags for the Fortran compiler
FREEFLAGS := -ffree-form
FFLAGS := -fconvert=big-endian -fbacktrace -ffree-line-length-none

# Additional flags for the Fortran compiler when compiling in debug mode
ifeq ($(ICE_BLDDEBUG), true)
FFLAGS += -O0 -g -fcheck=bounds -finit-real=nan -fimplicit-none -ffpe-trap=invalid,zero,overflow
else
FFLAGS += -O2
endif

# C and Fortran compilers
SCC := gcc
SFC := gfortran
CC := $(SCC)
FC := $(SFC)
LD := $(FC)

# Necessary flag to compile with OpenMP support
ifeq ($(ICE_THREADED), true)
LDFLAGS += -fopenmp
CFLAGS += -fopenmp
FFLAGS += -fopenmp
endif

38 changes: 38 additions & 0 deletions configuration/scripts/machines/Macros.conda_macos
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#==============================================================================
# Makefile macros for conda environment, macOS systems
#==============================================================================

# Preprocessor macros
CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS}

# Flags for the C compiler
CFLAGS := -c -O2

# Flags for the Fortran compiler
FREEFLAGS := -ffree-form
FFLAGS := -fconvert=big-endian -fbacktrace -ffree-line-length-none

# Additional flags for the Fortran compiler when compiling in debug mode
ifeq ($(ICE_BLDDEBUG), true)
FFLAGS += -O0 -g -fcheck=bounds -finit-real=nan -fimplicit-none -ffpe-trap=invalid,zero,overflow
else
FFLAGS += -O2
endif

# C and Fortran compilers
SCC := clang
SFC := gfortran
CC := $(SCC)
FC := $(SFC)
LD := $(FC)

# Location of the system C header files (required on recent macOS to compile makdep)
CFLAGS_HOST = -isysroot$(shell xcrun --show-sdk-path)

# Necessary flag to compile with OpenMP support
ifeq ($(ICE_THREADED), true)
LDFLAGS += -fopenmp
CFLAGS += -fopenmp
FFLAGS += -fopenmp
endif

4 changes: 2 additions & 2 deletions configuration/scripts/machines/Macros.testmachine_intel
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ LIB_MPI := $(IMPILIBDIR)

SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff -L$(LIB_PNETCDF) -lpnetcdf -lgptl

ifeq ($(compile_threaded), true)
ifeq ($(ICE_THREADED), true)
LDFLAGS += -openmp
CFLAGS += -openmp
FFLAGS += -openmp
endif

### if using parallel I/O, load all 3 libraries. PIO must be first!
ifeq ($(IO_TYPE), pio)
ifeq ($(ICE_IOTYPE), pio)
PIO_PATH:=/glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/lib
INCLDIR += -I/glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/include
SLIBS := $(SLIBS) -L$(PIO_PATH) -lpiof
Expand Down
41 changes: 41 additions & 0 deletions configuration/scripts/machines/env.conda_linux
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/csh -f

set inp = "undefined"
if ($#argv == 1) then
set inp = $1
endif

if ("$inp" != "-nomodules") then

# Init conda
if ! $?CONDA_EXE then
echo ""
echo "${0}: conda executable not found, see the Icepack documentation for how to initialize your login shell to use conda"
echo ""
exit 1
endif
source `$CONDA_EXE info --base`/etc/profile.d/conda.csh
# Activate "icepack" conda environment
conda activate icepack
if $status then
echo ""
echo "${0}: 'icepack' conda environment not found, see the Icepack documentation for how to create the conda icepack env"
echo ""
exit 1
endif

endif

setenv ICE_MACHINE_ENVNAME conda
setenv ICE_MACHINE_COMPILER linux
setenv ICE_MACHINE_MAKE make
setenv ICE_MACHINE_WKDIR $HOME/icepack-dirs/runs
setenv ICE_MACHINE_INPUTDATA $HOME/icepack-dirs/input
setenv ICE_MACHINE_BASELINE $HOME/icepack-dirs/baseline
setenv ICE_MACHINE_SUBMIT " "
setenv ICE_MACHINE_TPNODE 4
setenv ICE_MACHINE_ACCT P0000000
setenv ICE_MACHINE_QUEUE "debug"
setenv ICE_MACHINE_BLDTHRDS 4
setenv ICE_MACHINE_QSTAT " "

41 changes: 41 additions & 0 deletions configuration/scripts/machines/env.conda_macos
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/csh -f

set inp = "undefined"
if ($#argv == 1) then
set inp = $1
endif

if ("$inp" != "-nomodules") then

# Init conda
if ! $?CONDA_EXE then
echo ""
echo "${0}: conda executable not found, see the Icepack documentation for how to initialize your login shell to use conda"
echo ""
exit 1
endif
source `$CONDA_EXE info --base`/etc/profile.d/conda.csh
# Activate "icepack" conda environment
conda activate cice
if $status then
echo ""
echo "${0}: 'cice' conda environment not found, see the Icepack documentation for how to create the conda icepack env"
echo ""
exit 1
endif

endif

setenv ICE_MACHINE_ENVNAME conda
setenv ICE_MACHINE_COMPILER macos
setenv ICE_MACHINE_MAKE make
setenv ICE_MACHINE_WKDIR $HOME/icepack-dirs/runs
setenv ICE_MACHINE_INPUTDATA $HOME/icepack-dirs/input
setenv ICE_MACHINE_BASELINE $HOME/icepack-dirs/baseline
setenv ICE_MACHINE_SUBMIT " "
setenv ICE_MACHINE_TPNODE 4
setenv ICE_MACHINE_ACCT P0000000
setenv ICE_MACHINE_QUEUE "debug"
setenv ICE_MACHINE_BLDTHRDS 4
setenv ICE_MACHINE_QSTAT " "

11 changes: 11 additions & 0 deletions configuration/scripts/machines/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: icepack
channels:
- conda-forge
- nodefaults
dependencies:
# Build dependencies
- compilers
- make
# Python dependencies for building the HTML documentation
- sphinx
- sphinxcontrib-bibtex
2 changes: 1 addition & 1 deletion configuration/scripts/setup_run_dirs.csh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /bin/csh -f

source ./icepack.settings
source ${ICE_CASEDIR}/env.${ICE_MACHCOMP} || exit 2
source ${ICE_CASEDIR}/env.${ICE_MACHCOMP} -nomodules || exit 2

if !(-d ${ICE_RUNDIR}) then
echo "mkdir ${ICE_RUNDIR}"
Expand Down
Loading