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

Katec/derecho update #58

Merged
merged 18 commits into from
Nov 28, 2023
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
7 changes: 6 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CISM Changelog

Changes in CISM tag cism_main_2.01.002
Changes in CISM tag cism_main_2.01.013
======================================

Updates to support building and running on Derecho. Removing redundant use statements that slowed the Intel build. Changes to Python tests to make them python3 compatible and bit for bit. Changes to update old SLAP code and make it slightly nicer for modern compilers.

Changes in CISM tag cism_main_2.01.003
======================================
ESCOMP/cism/main 792e43f and 410b384

Expand Down
2 changes: 1 addition & 1 deletion builds/cheyenne-intel/cheyenne-intel-cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ else
fi

echo CISM: "${cism_top}"

source /etc/profile.d/modules.sh

module purge
module load ncarenv/1.2
Expand Down
30 changes: 30 additions & 0 deletions builds/derecho-intel/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
This directory contains posix-compliant CMake build scripts (*-cmake.sh) and
shell agnostic build scripts (*-cmake), which are mostly intended for csh/tcsh
users.

The posix scripts are recommended because they support out of source builds by
using the first command-line argument to set the (top-level) CISM source
directory. For example, to build in this directory, you may run the command:

source PLATFORM-COMPILER-cmake.sh

Likewise, if your CISM source is located in $CISM, you may build in a $BUILD
subdirectory by:

mkdir -p $BUILD && cd $BUILD source
$CISM/builds/PLATFORM-COMPILER/PLATFORM-COMPILER-cmake.sh $CISM

This functionality is necessary for using the build and test structure (BATS,
located in $CISM/tests/regression/), will allow you to build multiple versions
of CISM for testing, and make cleaning up the build directory easier.

Because there isn't a reasonable way to make out-of-source capable build
scripts work across both posix-compliant shells (sh, bash, zsh, etc.) and
non-compliant shells (csh, tcsh), a shell agnostic build script is also
available for csh/tcsh users.

NOTE: If you edit one of these script, please reflect your changes in the other
script!

WARNING: It is possible these scripts will have diverged, so if you're having
build problems, first check the differences between the two scripts.
60 changes: 60 additions & 0 deletions builds/derecho-intel/derecho-intel-cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Run this script by typing: source cheyenne-intel-cmake
# After this script completes, type: make -j 8
# If rebuilding, type 'make clean' before running 'make -j 8'

# This cmake configuration script is set up to perform a parallel build with Trilinos

module purge
module load ncarenv/23.06
module load intel/2023.0.0
module load intel-mpi/2021.8.0
module load mkl/2023.0.0
#module load mpt/2.19
module load netcdf/4.9.2
module load ncarcompilers/1.0.0
#module load pnetcdf/1.11.0
module load cmake/3.26.3
#module load python/2.7.13
#module load numpy/1.12.0
#module load netcdf4-python/1.2.7

# remove old build data:
rm -f ./CMakeCache.txt
rm -rf ./CMakeFiles

echo
echo "Doing CMake Configuration step"

# Note: the compilation flags were taken from the defaults for a CESM build on
# cheyenne-intel (using cime at 84aafd5). Some of these options are probably
# unnecessary for a standalone cism build, but I am keeping things consistent
# with the CESM build for simplicity.

cmake \
-D CISM_BUILD_CISM_DRIVER:BOOL=ON \
-D CISM_ENABLE_BISICLES=OFF \
-D CISM_ENABLE_FELIX=OFF \
\
-D CISM_USE_TRILINOS:BOOL=OFF \
-D CISM_MPI_MODE:BOOL=ON \
-D CISM_SERIAL_MODE:BOOL=OFF \
\
-D CISM_USE_GPTL_INSTRUMENTATION:BOOL=OFF \
-D CISM_COUPLED:BOOL=OFF \
-D CISM_USE_CISM_FRONT_END:BOOL=OFF \
\
-D CISM_NETCDF_DIR=$NETCDF \
-D CMAKE_VERBOSE_MAKEFILE:BOOL=OFF \
\
-D CMAKE_CXX_COMPILER=mpiicpc \
-D CMAKE_C_COMPILER=mpicc \
-D CMAKE_Fortran_COMPILER=mpif90 \
\
-D CMAKE_EXE_LINKER_FLAGS="-mkl=cluster" \
\
-D CMAKE_Fortran_FLAGS:STRING="-qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source -qopt-report -O2 -debug minimal " \
-D CMAKE_C_FLAGS:STRING="-qno-opt-dynamic-align -fp-model precise -std=gnu99 -qopt-report -O2 -debug minimal " \
-D CMAKE_CXX_FLAGS:STRING="-qno-opt-dynamic-align -fp-model precise -std=gnu99 -qopt-report -O2 -debug minimal " \
../..

# Note: last argument above "../.." is path to top-level cism directory
73 changes: 73 additions & 0 deletions builds/derecho-intel/derecho-intel-cmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/bin/sh

# After this script completes, type: make -j 8
# If rebuilding, type 'make clean' before running 'make -j 8'

# Set path to top cism directory
# Note, this is an easy way to build out of source.
# In directory you want to build in, run:
# $ source $CISM/builds/linux-gnu-cism/linux-gnu-cism-cmake $CISM
# where $CISM is the path to the top level cism directory.
if [ $# -eq 0 ]
then
cism_top="../.."
else
cism_top=${1%/}
fi

echo CISM: "${cism_top}"


module purge
module load ncarenv/23.06
module load intel/2023.0.0
module load mkl/2023.0.0
#module load mpt/2.15f
module load netcdf/4.9.2
module load ncarcompilers/1.0.0
#module load pnetcdf/1.8.0
module load cmake/3.26.3
#module load python/2.7.13
#module load numpy/1.12.0
#module load netcdf4-python/1.2.7

# remove old build data:
rm -f ./CMakeCache.txt
rm -rf ./CMakeFiles

echo
echo "Doing CMake Configuration step"

# Note: the compilation flags were taken from the defaults for a CESM build on
# cheyenne-intel (using cime at 84aafd5). Some of these options are probably
# unnecessary for a standalone cism build, but I am keeping things consistent
# with the CESM build for simplicity.

# CISM_USE_GPTL_INSTRUMENTATION -- ON by default, set to OFF to not use GPTL instrumentation.

cmake \
-D CISM_BUILD_CISM_DRIVER:BOOL=ON \
-D CISM_ENABLE_BISICLES=OFF \
-D CISM_ENABLE_FELIX=OFF \
\
-D CISM_USE_TRILINOS:BOOL=OFF \
-D CISM_MPI_MODE:BOOL=ON \
-D CISM_SERIAL_MODE:BOOL=OFF \
\
-D CISM_USE_GPTL_INSTRUMENTATION:BOOL="${CISM_USE_GPTL_INSTRUMENTATION:=ON}" \
-D CISM_COUPLED:BOOL=OFF \
-D CISM_USE_CISM_FRONT_END:BOOL=OFF \
\
-D CISM_NETCDF_DIR="$NETCDF" \
-D CISM_GPTL_DIR= "utils/libgptl" \
-D CMAKE_VERBOSE_MAKEFILE:BOOL=OFF \
\
-D CMAKE_CXX_COMPILER=mpiicpc \
-D CMAKE_C_COMPILER=mpicc \
-D CMAKE_Fortran_COMPILER=mpif90 \
\
-D CMAKE_Fortran_FLAGS:STRING="-qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source -qopt-report -O2 -debug minimal " \
-D CMAKE_C_FLAGS:STRING="-qno-opt-dynamic-align -fp-model precise -std=gnu99 -qopt-report -O2 -debug minimal " \
-D CMAKE_CXX_FLAGS:STRING="-qno-opt-dynamic-align -fp-model precise -std=gnu99 -qopt-report -O2 -debug minimal " \
"${cism_top}"

16 changes: 8 additions & 8 deletions libglimmer-solve/SLAP/dlapqc.f
Original file line number Diff line number Diff line change
Expand Up @@ -574,15 +574,15 @@ SUBROUTINE DRMGEN( NELTMX, FACTOR, IERR, N, NELT, ISYM,
DOUBLE PRECISION FACTOR, A(NELTMX)
DOUBLE PRECISION F(N), SOLN(N), DSUM(N)
INTEGER DUMMY
REAL, EXTERNAL :: RAND
REAL, EXTERNAL :: SLRAND
C
C Start by setting the random number generator seed.
C This is done for reproducablility in debuggin. Remove
C the seed seeting call for production testing.
C
C***FIRST EXECUTABLE STATEMENT DRMGEN
DUMMY = 16381
ISEED = RAND( DUMMY )
ISEED = SLRAND( DUMMY )
IERR = 0
DO 10 I = 1, N
IDIAG(I) = 0
Expand All @@ -599,7 +599,7 @@ SUBROUTINE DRMGEN( NELTMX, FACTOR, IERR, N, NELT, ISYM,
C
C To keep things sparse divide by two, three or four or ...
C
INUM = (IFIX( RAND(DUMMY)*NL ) + 1)/3
INUM = (IFIX( SLRAND(DUMMY)*NL ) + 1)/3
CALL DMPL( NL, INUM, ITMP )
C
C Set up this column (and row, if non-sym structure).
Expand All @@ -616,7 +616,7 @@ SUBROUTINE DRMGEN( NELTMX, FACTOR, IERR, N, NELT, ISYM,
IF( IA(NELT).EQ.ICOL ) THEN
IDIAG(ICOL) = NELT
ELSE
A(NELT) = -RAND(DUMMY)
A(NELT) = -SLRAND(DUMMY)
DSUM(ICOL) = DSUM(ICOL) + A(NELT)
IF( ISYM.EQ.0 ) THEN
C
Expand Down Expand Up @@ -666,7 +666,7 @@ SUBROUTINE DRMGEN( NELTMX, FACTOR, IERR, N, NELT, ISYM,
CVD$ NOVECTOR
CVD$ NOCONCUR
DO 50 I = 1, N
SOLN(I) = RAND(DUMMY)
SOLN(I) = SLRAND(DUMMY)
F(I) = 0.0D0
50 CONTINUE
C
Expand Down Expand Up @@ -702,7 +702,7 @@ SUBROUTINE DMPL( N, M, INDX )
C***ROUTINES CALLED RAND
C***END PROLOGUE
IMPLICIT DOUBLE PRECISION(A-H,O-Z)
REAL, EXTERNAL :: RAND
REAL, EXTERNAL :: SLRAND
INTEGER DUMMY
INTEGER N, M, INDX(M)
C
Expand All @@ -712,10 +712,10 @@ SUBROUTINE DMPL( N, M, INDX )
IF( N*M.LT.0 .OR. M.GT.N ) RETURN
C
C.. Set the indeicies.
INDX(1) = IFIX( RAND(DUMMY)*N ) + 1
INDX(1) = IFIX( SLRAND(DUMMY)*N ) + 1
CVD$ NOCONCUR
DO 30 I = 2, M
10 ID = IFIX( RAND(DUMMY)*N ) + 1
10 ID = IFIX( SLRAND(DUMMY)*N ) + 1
C
C.. Check to see if id has already been chosen.
CVD$ NOVECTOR
Expand Down
28 changes: 14 additions & 14 deletions libglimmer-solve/SLAP/xersla.f
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ subroutine xerabt(messg,nmessg)
c 1982.
c***routines called (none)
c***end prologue xerabt
dimension messg(nmessg)
character*(*) messg
c***first executable statement xerabt
stop 1
end
Expand Down Expand Up @@ -300,7 +300,7 @@ subroutine xerrwv(messg,nmessg,nerr,level,ni,i1,i2,nr,r1,r2)
if (lkntrl.le.0) go to 40
c error number
write (iunit,30) lerr
30 format (15h error number =,i10)
30 format ('15h error number =',i10)
40 continue
50 continue
c trace-back
Expand Down Expand Up @@ -380,8 +380,8 @@ subroutine xersav(messg,nmessg,nerr,level,icount)
if (iunit.eq.0) iunit = i1mach(4)
c print table header
write (iunit,10)
10 format (32h0 error message summary/
1 51h message start nerr level count)
10 format ('32h0 error message summary'/
1 '51h message start , nerr, level, count')
c print body of table
do 20 i=1,10
if (kount(i).eq.0) go to 30
Expand All @@ -391,7 +391,7 @@ subroutine xersav(messg,nmessg,nerr,level,icount)
30 continue
c print number of other errors
if (kountx.ne.0) write (iunit,40) kountx
40 format (41h0other errors not individually tabulated=,i10)
40 format ('41h0other errors not individually tabulated=',i10)
write (iunit,50)
50 format (1x)
60 continue
Expand Down Expand Up @@ -811,8 +811,8 @@ subroutine xsetun(iunit)
junk = j4save(5,1,.true.)
return
end
FUNCTION RAND(R)
C***BEGIN PROLOGUE RAND
FUNCTION SLRAND(R)
C***BEGIN PROLOGUE SLRAND
C***DATE WRITTEN 770401 (YYMMDD)
C***REVISION DATE 861211 (YYMMDD)
C***CATEGORY NO. L6A21
Expand All @@ -823,7 +823,7 @@ FUNCTION RAND(R)
C***DESCRIPTION
C
C This pseudo-random number generator is portable among a wide
C variety of computers. RAND(R) undoubtedly is not as good as many
C variety of computers. SLRAND(R) undoubtedly is not as good as many
C readily available installation dependent versions, and so this
C routine is not recommended for widespread usage. Its redeeming
C feature is that the exact same random numbers (to within final round-
Expand Down Expand Up @@ -887,18 +887,18 @@ FUNCTION RAND(R)
C possible use in a restart procedure.
C If R .GT. 0., the sequence of random numbers will start with
C the seed R mod 1. This seed is also returned as the value of
C RAND provided the arithmetic is done exactly.
C SLRAND provided the arithmetic is done exactly.
C
C Output Value --
C RAND a pseudo-random number between 0. and 1.
C SLRAND a pseudo-random number between 0. and 1.
C***REFERENCES (NONE)
C***ROUTINES CALLED (NONE)
C***END PROLOGUE RAND
C***END PROLOGUE SLRAND
SAVE IA1, IA0, IA1MA0, IC, IX1, IX0
DATA IA1, IA0, IA1MA0 /1536, 1029, 507/
DATA IC /1731/
DATA IX1, IX0 /0, 0/
C***FIRST EXECUTABLE STATEMENT RAND
C***FIRST EXECUTABLE STATEMENT SLRAND
IF (R.LT.0.) GO TO 10
IF (R.GT.0.) GO TO 20
C
Expand All @@ -912,8 +912,8 @@ FUNCTION RAND(R)
IY1 = IY1 + (IY0-IX0)/2048
IX1 = MOD (IY1, 2048)
C
10 RAND = IX1*2048 + IX0
RAND = RAND / 4194304.
10 SLRAND = IX1*2048 + IX0
SLRAND = SLRAND / 4194304.
RETURN
C
20 IX1 = AMOD(R,1.)*4194304. + 0.5
Expand Down
Loading