-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add conda environment, fix Makefile and Macros, implement
-nomodules
(
#296) * machines: add conda environment for macOS and Linux Closes #294 * Makefile: remove uneeded (and faulty) logic around CFLAGS_HOST The CFLAG_HOST variable was added in #257, and some Makefile logic was added to define the variable to be blank if the included Macros file does not define it. However, the Make syntax is wrong, as 'ifndef' takes a variable name and not a reference to a variable [1], so ifndef $(CFLAGS_HOST) should have been written ifndef CFLAGS_HOST The effect of this error is to invert the logic of the check (!) since if CFLAGS_HOST is defined, Make will check if a variable with name equal to whatever CFLAGS_HOST is defined to be exists, which will most probably be false, and the conditional will then evaluate to true and CFLAG_HOSTS will be redefined to be blank, defeating the whole purpose of the flag. Since there's no harm in Make referencing and empty variable, fix this by just removing the conditional check. [1] https://www.gnu.org/software/make/manual/html_node/Conditional-Syntax.html * doc: add documentation for conda environment * machines: fix Macros file for cheyenne and testmachine These two files used outdated environment variables for threading ("compile_threaded") and PIO ("IO_TYPE"). Replace these with the correct variables, ICE_THREADED and ICE_IOTYPE. Mirrors CICE-Consortium/CICE#396 * scripts: implement '-nomodules' logic for env files Some env files wrap the calls for loading the build and run environment in a conditional based on the argument `-nomodules`, so that scripts that source the env file just to get the variables defined in it do not run slower because they have to load the environment. This logic was copied from CICE but was not implemented in the Icepack scripts icepack.setup and setup_run_dirs.csh. Add the argument '-nomodules' so that the logic becomes effective. * doc: conda: add note about csh/tcsh On Ubuntu and its derivatives, the csh shell at /bin/csh, which is used in the shebangs of the Icepack scripts, is not compatible with conda. Mention that in the documentation and explain how to install tcsh as an alternative, and configure the system such that /bin/csh points to /bin/tcsh.
- Loading branch information
1 parent
e23e302
commit 03a9345
Showing
12 changed files
with
442 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 " " | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 " " | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.