From 9b46fae6d3b6da44cd973a18c0a31a41d229976c Mon Sep 17 00:00:00 2001 From: Miles A Curry Date: Tue, 2 Jun 2020 16:51:51 +0000 Subject: [PATCH 1/4] Update GNU-9 modset of reddwarf.yaml This commit updates the the GNU-9 modset of the reddwarf.yaml file. This commit is in hope to try to standardized passing compiler and linker flags to compile commands in tests. --- envs/reddwarf.yaml | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/envs/reddwarf.yaml b/envs/reddwarf.yaml index 00a4c4e..273bddd 100644 --- a/envs/reddwarf.yaml +++ b/envs/reddwarf.yaml @@ -6,7 +6,7 @@ Description: Name: Reddwarf - Max Cores: 10 + Max Cores: 4 Modules: True LMOD_CMD: /usr/local/lmod/lmod/libexec/lmod HPC: False @@ -54,12 +54,36 @@ Modsets: - USE_PIO2: Name: USE_PIO2 Value: "true" - - MPAS_EXTERNAL_LIBS: - Name: MPAS_EXTERNAL_LIBS - Value: "-L${PIO}/lib -L${LIBBASE}/lib/lib -lpio -lpnetcdf -lnetcdf -lhdf5_hl -lhdf5 -ldl -lz" + - PNETCDF_INCLUDES: + Name: PNETCDF_INCLUDES + Value: "-I/users/mcurry/build-gnu-9.1.0/lib/include" + - PNETCDF_LIBS: + Name: PNETCDF_LIBS + Value: "-L/users/mcurry/build-gnu-9.1.0/lib/lib -lpnetcdf" + - NETCDF_INCLUDES: + Name: NETCDF_INCLUDES + Value: "-I/users/mcurry/build-gnu-9.1.0/lib/include" + - NETCDF_LIBS: + Name: NETCDF_LIBS + Value: "-L/users/mcurry/build-gnu-9.1.0/lib/lib -lnetcdf -lpnetcdf + -lhdf5_hl -lhdf5 -ldl -lz -lm" + - PIO_INCLUDES: + Name: PIO_INCLUDES + Value: "-I/users/mcurry/build-gnu-9.1.0/lib/include -I/users/mcurry/build-gnu-9.1.0/pio/2.4.3/include" + - PIO_LIBS: + Name: PIO_LIBS + Value: "-L/users/mcurry/build-gnu-9.1.0/pio/2.3.4/lib + -L/users/mcurry/build-gnu-9.1.0/pio/2.4.3/lib -lpiof -lpio + -lnetcdf -lpnetcdf -lhdf5_hl -lz -lm" - MPAS_EXTERNAL_INCLUDES: Name: MPAS_EXTERNAL_INCLUDES - Value: "-I${LIBBASE}/lib/include -I${PIO}/lib/include" + Value: "-I/users/mcurry/build-gnu-9.1.0/lib/include + -I/users/mcurry/build-gnu-9.1.0/pio/2.4.3/include" + - MPAS_EXTERNAL_LIBS: + Name: MPAS_EXTERNAL_LIBS + Value: "-L/users/mcurry/build-gnu-9.1.0/lib/lib + -L/users/mcurry/build-gnu-9.1.0/pio/2.4.3/include -lpiof -lpio + -lpnetcdf -lnetcdf -lhdf5_hl -lhdf5 -ldl -lz -lm" ############ # GNU-8.3.0 From 1f5ed253f9a04a4dd880ed8abc07037375ead18e Mon Sep 17 00:00:00 2001 From: Miles A Curry Date: Tue, 2 Jun 2020 20:59:21 +0000 Subject: [PATCH 2/4] Enable env vars to be used in Environment.yaml files This commit updates env._load_library to expand environment variables that are within other environment variables. --- smarts/env.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smarts/env.py b/smarts/env.py index 93ac7c6..61d49b7 100644 --- a/smarts/env.py +++ b/smarts/env.py @@ -402,7 +402,7 @@ def _load_library(self, library, *args, **kwargs): value = library['Value'] print("SMARTS: Setting the env variable:", env_name, "to value:", value) - os.environ[env_name] = value + os.environ[env_name] = os.path.expandvars(value) print("SMARTS: Environment variable is: ", os.environ[env_name]) else: print("ERROR: For the library", library['Name'], "does not have a maching value name") From e974aa6f44a81c99eca148e348d2e226cc787c2b Mon Sep 17 00:00:00 2001 From: Miles A Curry Date: Tue, 2 Jun 2020 21:02:44 +0000 Subject: [PATCH 3/4] Update MPAS compile tests to use standard env vars This commit updates two of the MPAS-A compile tests to use a standard set of environment vars. This change is in hopes of creating a standard way of compiling programs that may have different compiler and linker flags on different systems. --- .../mpas_atm_gnu_compile.py | 2 +- .../mpas_gnu_libs_check/mpas_gnu_libs_check.py | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/tests/mpas_atm_gnu_compile/mpas_atm_gnu_compile.py b/tests/mpas_atm_gnu_compile/mpas_atm_gnu_compile.py index 8d16e9f..d50bc0d 100644 --- a/tests/mpas_atm_gnu_compile/mpas_atm_gnu_compile.py +++ b/tests/mpas_atm_gnu_compile/mpas_atm_gnu_compile.py @@ -43,7 +43,7 @@ def run(self, env, result, src_dir, test_dir, hpc=None, *args, **kwargs): result.msg = "Could not clean MPAS atmosphere core" return - print("MPAS_INTEL_COMPILE: Compiling MPAS Atmosphere CORE ....") + print("MPAS_GNU_COMPILE: Compiling MPAS Atmosphere CORE ....") ierr = os.system('make -j4 gfortran CORE=atmosphere &> ../atmosphere-compile.log') if ierr != 0: result.result = "FAILED" diff --git a/tests/mpas_gnu_libs_check/mpas_gnu_libs_check.py b/tests/mpas_gnu_libs_check/mpas_gnu_libs_check.py index b1003fe..10bce48 100644 --- a/tests/mpas_gnu_libs_check/mpas_gnu_libs_check.py +++ b/tests/mpas_gnu_libs_check/mpas_gnu_libs_check.py @@ -65,8 +65,13 @@ def run(self, env, result, srcDir, testDir, hpc=None, *args, **kwargs): # PNetCDF - C and Fortran + from subprocess import Popen + ## C - if os.system('mpicc -o c_pnetcdf pnetcdf.c -I$PNETCDF/include -L$PNETCDF/lib -lpnetcdf'): + + + os.system('echo c_pnetcdf $PNETCDF_INCLUDES pnetcdf.c $PNETCDF_LIBS > out') + if os.system('mpicc -o c_pnetcdf $PNETCDF_INCLUDES pnetcdf.c $PNETCDF_LIBS'): print("Failed to compile pnetcdf.c with mpicc") result.result = "FAILED" result.msg = "Failed to compile a C PNetCDF (pnetcdf.c) with mpicc!" @@ -75,7 +80,7 @@ def run(self, env, result, srcDir, testDir, hpc=None, *args, **kwargs): print("MPAS_GNU_LIBS_CHECK: Can compile a C PNetCDF Program!") ## Fortran - if os.system('mpif90 -c pnetcdf.f90 -I$PNETCDF/include -L$PNETCDF/lib -lpnetcdf'): + if os.system('mpif90 -c pnetcdf.f90 $PNETCDF_INCLUDES $PNETCDF_LIBS'): print("Failed to compile mpi.f90 with mpif90") result.result = "FAILED" result.msg = "Failed to copmile a Fortran PNetCDF (pnetcdf.f90) with mpif90!" @@ -86,7 +91,8 @@ def run(self, env, result, srcDir, testDir, hpc=None, *args, **kwargs): # NetCDF - C and Fortran ## C - if os.system('mpicc -o c_netcdf netcdf.c -I$NETCDF/include -I$PNETCDF/include -L$NETCDF/lib -L$PNETCDF/lib -lnetcdf -lpnetcdf -lhdf5_hl -lhdf5 -ldl -lz'): + if os.system('mpicc -o c_netcdf netcdf.c $NETCDF_INCLUDES $PNETCDF_INCLUDES' + ' $NETCDF_LIBS $PNETCDF_LIBS'): print("Failed to compile netcdf.c with mpicc") result.result = "FAILED" result.msg = "Failed to compile a C NetCDF program (netcdf.c) with mpicc!" @@ -95,7 +101,8 @@ def run(self, env, result, srcDir, testDir, hpc=None, *args, **kwargs): print("MPAS_GNU_LIBS_CHECK: Can compile a C NetCDF Program!") ## Fortran - if os.system('mpif90 -c netcdf.f90 -I$NETCDF/include -I$PNETCDF/include -L$NETCDF/lib -L$PNETCDF/lib -lnetcdf -lpnetcdf -lhdf5_hl -lhdf5 -ldl -lz -lm'): + if os.system('mpif90 -c netcdf.f90 $NETCDF_INCLUDES $PNETCDF_INCLUDES' + ' $NETCDF_LIBS $PNETCDF_LIBS'): print("Failed to compile netcdf.f90 with mpif90") result.result = "FAILED" result.msg = "Failed to compile a Fortran NetCDF program (netcdf.f90) with mpif90!" @@ -117,7 +124,8 @@ def run(self, env, result, srcDir, testDir, hpc=None, *args, **kwargs): ## Fortran print("PIO: ", os.environ['PIO']) - if os.system('mpif90 -o piof piof.f90 -I$PIO/include -I$NETCDF/include -I$PNETCDF/include -L$PIO/lib -L$NETCDF/lib -L$PNETCDF/lib -lpiof -lpioc -lgptl -lnetcdf -lpnetcdf -lhdf5_hl -lhdf5 -ldl -lz -lm'): + if os.system('mpif90 -o piof piof.f90 $PIO_INCLUDES $NETCDF_INCLUDES $PNETCDF_INCLUDE' + ' $PIO_LIBS $NETCDF_LIBS $PNETCDF_LIBS'): print("Failed to compile piof.f90 with mpif90") result.result = "FAILED" result.msg = "Failed to compile a Fortran PIO program (pio.f90) with mpif90!" From 4433c92804786eb92f1f12359bffaab3796f3164 Mon Sep 17 00:00:00 2001 From: Miles A Curry Date: Tue, 2 Jun 2020 21:04:46 +0000 Subject: [PATCH 4/4] Update envs/reddwarf.yaml to meet env var stds of last commit This commit updates the reddwarf.yaml file to use the environment variables that were defined in the previous commit. This commit allows reddwarf.yaml to run those tests with the gnu-9 compiler. --- envs/reddwarf.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/envs/reddwarf.yaml b/envs/reddwarf.yaml index 273bddd..f59a2d3 100644 --- a/envs/reddwarf.yaml +++ b/envs/reddwarf.yaml @@ -56,24 +56,24 @@ Modsets: Value: "true" - PNETCDF_INCLUDES: Name: PNETCDF_INCLUDES - Value: "-I/users/mcurry/build-gnu-9.1.0/lib/include" + Value: "-I$PNETCDF/include" - PNETCDF_LIBS: Name: PNETCDF_LIBS - Value: "-L/users/mcurry/build-gnu-9.1.0/lib/lib -lpnetcdf" + Value: "-L$PNETCDF/lib -lpnetcdf" - NETCDF_INCLUDES: Name: NETCDF_INCLUDES - Value: "-I/users/mcurry/build-gnu-9.1.0/lib/include" + Value: "-I$NETCDF/include" - NETCDF_LIBS: Name: NETCDF_LIBS - Value: "-L/users/mcurry/build-gnu-9.1.0/lib/lib -lnetcdf -lpnetcdf + Value: "-L$NETCDF/lib -lnetcdf -lpnetcdf -lhdf5_hl -lhdf5 -ldl -lz -lm" - PIO_INCLUDES: Name: PIO_INCLUDES - Value: "-I/users/mcurry/build-gnu-9.1.0/lib/include -I/users/mcurry/build-gnu-9.1.0/pio/2.4.3/include" + Value: "-I$PNETCDF/include -I$PIO/include" - PIO_LIBS: Name: PIO_LIBS - Value: "-L/users/mcurry/build-gnu-9.1.0/pio/2.3.4/lib - -L/users/mcurry/build-gnu-9.1.0/pio/2.4.3/lib -lpiof -lpio + Value: "-L$NETCDF/lib + -L$PIO/lib -lpiof -lpio -lnetcdf -lpnetcdf -lhdf5_hl -lz -lm" - MPAS_EXTERNAL_INCLUDES: Name: MPAS_EXTERNAL_INCLUDES