From 8211f9e98062f4c30a6eb9143cf9380c723633ea Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 19 Oct 2023 10:20:28 -0400 Subject: [PATCH 1/5] Fixes for running coupled on macOS --- gcm_forecast.tmpl | 2 +- gcm_post.j | 4 +-- gcm_regress.j | 2 +- gcm_run.j | 84 ++++++++++++++++++++++----------------------- gcm_run_benchmark.j | 2 +- gcm_setup | 13 +++++-- geoschemchem_setup | 13 +++++-- gmichem_setup | 13 +++++-- stratchem_setup | 13 +++++-- 9 files changed, 91 insertions(+), 55 deletions(-) diff --git a/gcm_forecast.tmpl b/gcm_forecast.tmpl index 7d9b7c3f..2c1eb2d6 100755 --- a/gcm_forecast.tmpl +++ b/gcm_forecast.tmpl @@ -34,7 +34,7 @@ setenv GEOSUTIL @GEOSSRC @NATIVE_BUILD source $GEOSBIN/g5_modules @NATIVE_BUILD setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib:${GEOSDIR}/lib -setenv RUN_CMD "$GEOSBIN/esma_mpirun -np " +setenv RUN_CMD "@RUN_CMD" setenv GCMVER `cat $GEOSETC/.AGCM_VERSION` echo VERSION: $GCMVER diff --git a/gcm_post.j b/gcm_post.j index 7ebec1a3..1683e7ba 100755 --- a/gcm_post.j +++ b/gcm_post.j @@ -39,10 +39,10 @@ source $GEOSBIN/g5_modules setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib if( $?SLURM_NTASKS ) then - setenv RUN_CMD "$GEOSBIN/esma_mpirun -np " + setenv RUN_CMD "@RUN_CMD" set NCPUS = $SLURM_NTASKS else if( $?PBS_NODEFILE ) then - setenv RUN_CMD "$GEOSBIN/esma_mpirun -np " + setenv RUN_CMD "@RUN_CMD" set NCPUS = `cat $PBS_NODEFILE | wc -l` else set NCPUS = NULL diff --git a/gcm_regress.j b/gcm_regress.j index a0d8dd14..5c0f5f59 100755 --- a/gcm_regress.j +++ b/gcm_regress.j @@ -92,7 +92,7 @@ setenv GEOSBIN @GEOSBIN source $GEOSBIN/g5_modules setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib:${GEOSDIR}/lib -setenv RUN_CMD "$GEOSBIN/esma_mpirun -np " +setenv RUN_CMD "@RUN_CMD" ####################################################################### # Experiment Specific Environment Variables diff --git a/gcm_run.j b/gcm_run.j index f602a7bc..fec054c7 100755 --- a/gcm_run.j +++ b/gcm_run.j @@ -35,7 +35,7 @@ setenv GEOSUTIL @GEOSSRC source $GEOSBIN/g5_modules setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib:${GEOSDIR}/lib -setenv RUN_CMD "$GEOSBIN/esma_mpirun -np " +setenv RUN_CMD "@RUN_CMD" setenv GCMVER `cat $GEOSETC/.AGCM_VERSION` echo VERSION: $GCMVER @@ -325,7 +325,7 @@ setenv EMISSIONS @EMISSIONS @MOM5setenv BCTAG `basename $ABCSDIR` @MOM6setenv BCTAG `basename $ABCSDIR` #this is hard-wired for NAS for now - should make it more general -@MITsetenv GRIDDIR /nobackupp18/afahad/GEOSMITgcmFiles/GRIDDIR/a${AGCM_IM}x${AGCM_JM}_o${OGCM_IM}x${OGCM_JM} +@MITsetenv GRIDDIR /nobackupp18/afahad/GEOSMITgcmFiles/GRIDDIR/a${AGCM_IM}x${AGCM_JM}_o${OGCM_IM}x${OGCM_JM} @MITsetenv BCTAG `basename $GRIDDIR` @DATAOCEANsetenv BCTAG `basename $BCSDIR` @@ -545,7 +545,7 @@ set tile_rsts = (catch catchcn route lake landice openwater saltwater seaicether # ---------------------------------- set rst_by_face = NO if( $GCMEMIP == TRUE ) then - if(-e $EXPDIR/restarts/$RSTDATE/fvcore_internal_rst & -e $EXPDIR/restarts/$RSTDATE/fvcore_internal_face_1_rst) then + if(-e $EXPDIR/restarts/$RSTDATE/fvcore_internal_rst & -e $EXPDIR/restarts/$RSTDATE/fvcore_internal_face_1_rst) then echo "grid-based internal_rst and internal_face_x_rst should not co-exist" echo "please remove all *internal_rst except these tile-based restarts :" foreach rst ( $tile_rsts ) @@ -553,7 +553,7 @@ if( $GCMEMIP == TRUE ) then end exit endif - if(-e $EXPDIR/restarts/$RSTDATE/fvcore_internal_face_1_rst) then + if(-e $EXPDIR/restarts/$RSTDATE/fvcore_internal_face_1_rst) then set rst_by_face = YES endif else @@ -565,7 +565,7 @@ else end exit endif - if(-e $EXPDIR/fvcore_internal_face_1_rst) then + if(-e $EXPDIR/fvcore_internal_face_1_rst) then set rst_by_face = YES endif endif @@ -610,7 +610,7 @@ foreach rst ( $dummy ) if ( $rst =~ *$tile_rst* ) then set is_tile_rst = TRUE break - endif + endif end endif if ($is_tile_rst == FALSE & $rst_by_face == YES) then @@ -619,7 +619,7 @@ foreach rst ( $dummy ) set rst = ${part1}_face_${n}_rst set rst_file_names = `echo $rst_file_names $rst` end - else + else set rst_file_names = `echo $rst_file_names $rst` endif end @@ -1005,7 +1005,7 @@ endif # Run bundleParser.py #--------------------- -python bundleParser.py +python3 bundleParser.py # If REPLAY, link necessary forcing files # --------------------------------------- @@ -1039,53 +1039,53 @@ endif @MIT # --------------------------------------------------- @MIT # For MITgcm restarts - before running GEOSgcm.x @MIT # --------------------------------------------------- -@MIT +@MIT @MIT # set time interval for segment in seconds -@MIT +@MIT @MIT set yearc = `echo $nymdc | cut -c1-4` @MIT set monthc = `echo $nymdc | cut -c5-6` @MIT set dayc = `echo $nymdc | cut -c7-8` @MIT set hourc = `echo $nhmsc | cut -c1-2` @MIT set minutec = `echo $nhmsc | cut -c3-4` @MIT set secondc = `echo $nhmsc | cut -c5-6` -@MIT +@MIT @MIT set yearf = `echo $nymdf | cut -c1-4` @MIT set monthf = `echo $nymdf | cut -c5-6` @MIT set dayf = `echo $nymdf | cut -c7-8` @MIT set hourf = `echo $nhmsf | cut -c1-2` @MIT set minutef = `echo $nhmsf | cut -c3-4` @MIT set secondf = `echo $nhmsf | cut -c5-6` -@MIT +@MIT @MIT set yearf = `echo $nymdf | cut -c1-4` -@MIT +@MIT @MIT set time1 = `date -u -d "${yearc}-${monthc}-${dayc}T${hourc}:${minutec}:${secondc}" "+%s"` @MIT set time2 = `date -u -d "${yearf}-${monthf}-${dayf}T${hourf}:${minutef}:${secondf}" "+%s"` -@MIT +@MIT @MIT @ mitdt = $time2 - $time1 @MIT echo "Segment time: $mitdt" -@MIT -@MIT +@MIT +@MIT @MIT # Set-up MITgcm run directory @MIT if (! -e mitocean_run) mkdir -p mitocean_run @MIT cd mitocean_run -@MIT +@MIT @MIT # link mit configuration and initialization files @MIT ln -sf $EXPDIR/mit_input/* . @MIT # link mitgcm restarts if exist @MIT /bin/ln -sf $EXPDIR/restarts/pic* . @MIT # make an archive folder for mitgcm run @MIT mkdir $EXPDIR/mit_output -@MIT +@MIT @MIT # Calculate segment time steps @MIT set mit_nTimeSteps = `cat ${SCRDIR}/AGCM.rc | grep OGCM_RUN_DT: | cut -d: -f2 | tr -s " " | cut -d" " -f2` @MIT @ mit_nTimeSteps = ${mitdt} / $mit_nTimeSteps -@MIT +@MIT @MIT #change namelist variables in data - nTimeSteps, chkptFreq and monitorFreq @MIT sed -i "s/nTimeSteps.*/nTimeSteps = ${mit_nTimeSteps},/" data @MIT sed -i "s/chkptFreq.*/chkptFreq = ${mitdt}.0,/" data @MIT sed -i "s/pChkptFreq.*/pChkptFreq = ${mitdt}.0,/" data @MIT # get nIter0 -@MIT +@MIT @MIT if (! -e ${EXPDIR}/restarts/MITgcm_restart_dates.txt ) then @MIT set nIter0 = `grep nIter0 data | tr -s " " | cut -d"=" -f2 | cut -d"," -f1 | awk '{$1=$1;print}'` @MIT else @@ -1100,7 +1100,7 @@ endif @MIT sed -i "s/nIter0.*/ nIter0 = ${nIter0},/" data @MIT endif @MIT endif -@MIT +@MIT @MIT cd .. @MIT # --------------------------------------------------- @MIT # End MITgcm restarts - before running GEOSgcm.x @@ -1137,29 +1137,29 @@ echo GEOSgcm Run Status: $rc @MIT # --------------------------------------------------- @MIT # For MITgcm restarts - after running GEOSgcm.x @MIT # --------------------------------------------------- -@MIT +@MIT @MIT set STEADY_STATE_OCEAN=`grep STEADY_STATE_OCEAN AGCM.rc | cut -d':' -f2 | tr -d " "` -@MIT +@MIT @MIT # update ocean only if activated. Otherwize use the same pickups (passive ocean). @MIT if ( ${STEADY_STATE_OCEAN} != 0 ) then -@MIT +@MIT @MIT if ( ${rc} == 0 ) then -@MIT +@MIT @MIT # Update nIter0 for next segment @MIT set znIter00 = `echo $nIter0 | awk '{printf("%010d",$1)}'` @MIT @ nIter0 = $nIter0 + $mit_nTimeSteps @MIT set znIter0 = `echo $nIter0 | awk '{printf("%010d",$1)}'` -@MIT +@MIT @MIT # to update MITgcm restart list file @MIT sed -i "/${nIter0}/d" ${EXPDIR}/restarts/MITgcm_restart_dates.txt @MIT echo "Date_GEOS5 $nymdf $nhmsf NITER0_MITgcm ${nIter0}" >> ${EXPDIR}/restarts/MITgcm_restart_dates.txt -@MIT +@MIT @MIT /bin/mv $SCRDIR/mitocean_run/STDOUT.0000 $EXPDIR/mit_output/STDOUT.${znIter00} -@MIT +@MIT @MIT endif -@MIT +@MIT @MIT cd $SCRDIR/mitocean_run -@MIT +@MIT @MIT # Check existance of roling pickups @MIT set nonomatch rp = ( pickup*ckptA* ) @MIT echo $rp @@ -1173,7 +1173,7 @@ echo GEOSgcm Run Status: $rc @MIT /bin/mv ${fname} $EXPDIR/restarts/${bname}.${timeStepNumber}.${aname} @MIT end @MIT endif -@MIT +@MIT @MIT # Check existance of permanent pickups @MIT set nonomatch pp = ( pickup* ) @MIT echo $pp @@ -1183,7 +1183,7 @@ echo GEOSgcm Run Status: $rc @MIT if ( ! -e $EXPDIR/restarts/${fname} ) /bin/mv ${fname} $EXPDIR/restarts/${fname} @MIT end @MIT endif -@MIT +@MIT @MIT /bin/mv T.* $EXPDIR/mit_output/ @MIT /bin/mv S.* $EXPDIR/mit_output/ @MIT /bin/mv U.* $EXPDIR/mit_output/ @@ -1191,31 +1191,31 @@ echo GEOSgcm Run Status: $rc @MIT /bin/mv W.* $EXPDIR/mit_output/ @MIT /bin/mv PH* $EXPDIR/mit_output/ @MIT /bin/mv Eta.* $EXPDIR/mit_output/ -@MIT +@MIT @MIT /bin/mv AREA.* $EXPDIR/mit_output/ @MIT /bin/mv HEFF.* $EXPDIR/mit_output/ @MIT /bin/mv HSNOW.* $EXPDIR/mit_output/ @MIT /bin/mv UICE.* $EXPDIR/mit_output/ @MIT /bin/mv VICE.* $EXPDIR/mit_output/ -@MIT +@MIT @MIT #copy mit output to mit_output @MIT foreach i (`grep -i filename data.diagnostics | grep "^ " | cut -d"=" -f2 | cut -d"'" -f2 | awk '{$1=$1;print}'`) @MIT /bin/mv ${i}* $EXPDIR/mit_output/ @MIT end -@MIT +@MIT @MIT foreach i (`grep -i stat_fName data.diagnostics | grep "^ " | cut -d"=" -f2 | cut -d"'" -f2 | awk '{$1=$1;print}'`) @MIT /bin/mv ${i}* $EXPDIR/mit_output/ @MIT end -@MIT +@MIT @MIT cd $SCRDIR -@MIT +@MIT @MIT endif -@MIT +@MIT @MIT # --------------------------------------------------- @MIT # End MITgcm restarts - after running GEOSgcm.x @MIT # --------------------------------------------------- - + ####################################################################### # Rename Final Checkpoints => Restarts for Next Segment and Archive # Note: cap_restart contains the current NYMD and NHMS @@ -1314,12 +1314,12 @@ end @CICE6 set dsets="iceh" @CICE6 foreach dset ( $dsets ) @CICE6 set num = `/bin/ls -1 $dset.*.nc | wc -l` -@CICE6 if($num != 0) then +@CICE6 if($num != 0) then @CICE6 if(! -e $EXPDIR/CICE_Output) mkdir -p $EXPDIR/CICE_Output @CICE6 /bin/mv $SCRDIR/$dset.*.nc $EXPDIR/CICE_Output/ @CICE6 endif -@CICE6 end -@CICE6 +@CICE6 end +@CICE6 ####################################################################### # Run Post-Processing and Forecasts ####################################################################### diff --git a/gcm_run_benchmark.j b/gcm_run_benchmark.j index 3b2463dd..cac98ebb 100755 --- a/gcm_run_benchmark.j +++ b/gcm_run_benchmark.j @@ -35,7 +35,7 @@ setenv GEOSUTIL @GEOSSRC source $GEOSBIN/g5_modules setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib:${GEOSDIR}/lib -setenv RUN_CMD "$GEOSBIN/esma_mpirun -np " +setenv RUN_CMD "@RUN_CMD" setenv GCMVER `cat $GEOSETC/.AGCM_VERSION` echo VERSION: $GCMVER diff --git a/gcm_setup b/gcm_setup index 4573188f..b75f6c5e 100755 --- a/gcm_setup +++ b/gcm_setup @@ -38,8 +38,14 @@ setenv NODE `uname -n` if ($ARCH == Darwin) then set FINDPATH = realpath + set PRELOAD_COMMAND = 'DYLD_INSERT_LIBRARIES' + # On macOS we seem to need to call mpirun directly and not use esma_mpirun + # For some reason SIP does not let the libraries be preloaded + set RUN_CMD = 'mpirun -np' else set FINDPATH = 'readlink -f' + set PRELOAD_COMMAND = 'LD_PRELOAD' + set RUN_CMD = '$GEOSBIN/esma_mpirun -np' endif set GCMSETUP = `$FINDPATH $0` set BINDIR = `dirname $GCMSETUP` @@ -630,7 +636,7 @@ if( $OGCM == TRUE ) then # suffix is different on Linux and macOS. This is set by configure_file() if ( "$OCNMODEL" == "MOM5" ) then set OCEAN_NAME="MOM" - set OCEAN_PRELOAD = 'env LD_PRELOAD=$GEOSDIR/lib/libmom@CMAKE_SHARED_LIBRARY_SUFFIX@' + set OCEAN_PRELOAD = 'env @PRELOAD_COMMAND=$GEOSDIR/lib/libmom@CMAKE_SHARED_LIBRARY_SUFFIX@' set MOM5="" set MOM6 = "#DELETE" set DEFAULT_HISTORY_TEMPLATE="HISTORY.AOGCM-MOM5.rc.tmpl" @@ -640,7 +646,7 @@ if( $OGCM == TRUE ) then set MIT = "#DELETE" else if ( "$OCNMODEL" == "MOM6" ) then set OCEAN_NAME="MOM6" - set OCEAN_PRELOAD = 'env LD_PRELOAD=$GEOSDIR/lib/libmom6@CMAKE_SHARED_LIBRARY_SUFFIX@' + set OCEAN_PRELOAD = 'env @PRELOAD_COMMAND=\$GEOSDIR/lib/libmom6@CMAKE_SHARED_LIBRARY_SUFFIX@' set MOM6="" set MOM5 = "#DELETE" set DEFAULT_HISTORY_TEMPLATE="HISTORY.AOGCM.rc.tmpl" @@ -2466,6 +2472,9 @@ s?@BACM_1M_?$BACM_1M_?g s?@GFDL_1M_?$GFDL_1M_?g s?@MGB2_2M_?$MGB2_2M_?g +s/@PRELOAD_COMMAND/$PRELOAD_COMMAND/g +s/@RUN_CMD/$RUN_CMD/g + EOF # Added FV3/GFDL-MP Specific Parameters diff --git a/geoschemchem_setup b/geoschemchem_setup index 575f8ff6..d74a4919 100755 --- a/geoschemchem_setup +++ b/geoschemchem_setup @@ -38,8 +38,14 @@ setenv NODE `uname -n` if ($ARCH == Darwin) then set FINDPATH = realpath + set PRELOAD_COMMAND = 'DYLD_INSERT_LIBRARIES' + # On macOS we seem to need to call mpirun directly and not use esma_mpirun + # For some reason SIP does not let the libraries be preloaded + set RUN_CMD = 'mpirun -np' else set FINDPATH = 'readlink -f' + set PRELOAD_COMMAND = 'LD_PRELOAD' + set RUN_CMD = '$GEOSBIN/esma_mpirun -np' endif set GCMSETUP = `$FINDPATH $0` set BINDIR = `dirname $GCMSETUP` @@ -630,7 +636,7 @@ if( $OGCM == TRUE ) then # suffix is different on Linux and macOS. This is set by configure_file() if ( "$OCNMODEL" == "MOM5" ) then set OCEAN_NAME="MOM" - set OCEAN_PRELOAD = 'env LD_PRELOAD=$GEOSDIR/lib/libmom@CMAKE_SHARED_LIBRARY_SUFFIX@' + set OCEAN_PRELOAD = 'env @PRELOAD_COMMAND=$GEOSDIR/lib/libmom@CMAKE_SHARED_LIBRARY_SUFFIX@' set MOM5="" set MOM6 = "#DELETE" set DEFAULT_HISTORY_TEMPLATE="HISTORY.AOGCM-MOM5.rc.tmpl" @@ -640,7 +646,7 @@ if( $OGCM == TRUE ) then set MIT = "#DELETE" else if ( "$OCNMODEL" == "MOM6" ) then set OCEAN_NAME="MOM6" - set OCEAN_PRELOAD = 'env LD_PRELOAD=$GEOSDIR/lib/libmom6@CMAKE_SHARED_LIBRARY_SUFFIX@' + set OCEAN_PRELOAD = 'env @PRELOAD_COMMAND=\$GEOSDIR/lib/libmom6@CMAKE_SHARED_LIBRARY_SUFFIX@' set MOM6="" set MOM5 = "#DELETE" set DEFAULT_HISTORY_TEMPLATE="HISTORY.AOGCM.rc.tmpl" @@ -2498,6 +2504,9 @@ s?@BACM_1M_?$BACM_1M_?g s?@GFDL_1M_?$GFDL_1M_?g s?@MGB2_2M_?$MGB2_2M_?g +s/@PRELOAD_COMMAND/$PRELOAD_COMMAND/g +s/@RUN_CMD/$RUN_CMD/g + EOF # Added FV3/GFDL-MP Specific Parameters diff --git a/gmichem_setup b/gmichem_setup index 72c25fa1..0da0b18a 100755 --- a/gmichem_setup +++ b/gmichem_setup @@ -38,8 +38,14 @@ setenv NODE `uname -n` if ($ARCH == Darwin) then set FINDPATH = realpath + set PRELOAD_COMMAND = 'DYLD_INSERT_LIBRARIES' + # On macOS we seem to need to call mpirun directly and not use esma_mpirun + # For some reason SIP does not let the libraries be preloaded + set RUN_CMD = 'mpirun -np' else set FINDPATH = 'readlink -f' + set PRELOAD_COMMAND = 'LD_PRELOAD' + set RUN_CMD = '$GEOSBIN/esma_mpirun -np' endif set GCMSETUP = `$FINDPATH $0` set BINDIR = `dirname $GCMSETUP` @@ -635,7 +641,7 @@ if( $OGCM == TRUE ) then # suffix is different on Linux and macOS. This is set by configure_file() if ( "$OCNMODEL" == "MOM5" ) then set OCEAN_NAME="MOM" - set OCEAN_PRELOAD = 'env LD_PRELOAD=$GEOSDIR/lib/libmom@CMAKE_SHARED_LIBRARY_SUFFIX@' + set OCEAN_PRELOAD = 'env @PRELOAD_COMMAND=$GEOSDIR/lib/libmom@CMAKE_SHARED_LIBRARY_SUFFIX@' set MOM5="" set MOM6 = "#DELETE" set DEFAULT_HISTORY_TEMPLATE="HISTORY.AOGCM-MOM5.rc.tmpl" @@ -645,7 +651,7 @@ if( $OGCM == TRUE ) then set MIT = "#DELETE" else if ( "$OCNMODEL" == "MOM6" ) then set OCEAN_NAME="MOM6" - set OCEAN_PRELOAD = 'env LD_PRELOAD=$GEOSDIR/lib/libmom6@CMAKE_SHARED_LIBRARY_SUFFIX@' + set OCEAN_PRELOAD = 'env @PRELOAD_COMMAND=\$GEOSDIR/lib/libmom6@CMAKE_SHARED_LIBRARY_SUFFIX@' set MOM6="" set MOM5 = "#DELETE" set DEFAULT_HISTORY_TEMPLATE="HISTORY.AOGCM.rc.tmpl" @@ -2664,6 +2670,9 @@ s?@BACM_1M_?$BACM_1M_?g s?@GFDL_1M_?$GFDL_1M_?g s?@MGB2_2M_?$MGB2_2M_?g +s/@PRELOAD_COMMAND/$PRELOAD_COMMAND/g +s/@RUN_CMD/$RUN_CMD/g + EOF # Added FV3/GFDL-MP Specific Parameters diff --git a/stratchem_setup b/stratchem_setup index f1db4df1..a5b369e4 100755 --- a/stratchem_setup +++ b/stratchem_setup @@ -38,8 +38,14 @@ setenv NODE `uname -n` if ($ARCH == Darwin) then set FINDPATH = realpath + set PRELOAD_COMMAND = 'DYLD_INSERT_LIBRARIES' + # On macOS we seem to need to call mpirun directly and not use esma_mpirun + # For some reason SIP does not let the libraries be preloaded + set RUN_CMD = 'mpirun -np' else set FINDPATH = 'readlink -f' + set PRELOAD_COMMAND = 'LD_PRELOAD' + set RUN_CMD = '$GEOSBIN/esma_mpirun -np' endif set GCMSETUP = `$FINDPATH $0` set BINDIR = `dirname $GCMSETUP` @@ -630,7 +636,7 @@ if( $OGCM == TRUE ) then # suffix is different on Linux and macOS. This is set by configure_file() if ( "$OCNMODEL" == "MOM5" ) then set OCEAN_NAME="MOM" - set OCEAN_PRELOAD = 'env LD_PRELOAD=$GEOSDIR/lib/libmom@CMAKE_SHARED_LIBRARY_SUFFIX@' + set OCEAN_PRELOAD = 'env @PRELOAD_COMMAND=$GEOSDIR/lib/libmom@CMAKE_SHARED_LIBRARY_SUFFIX@' set MOM5="" set MOM6 = "#DELETE" set DEFAULT_HISTORY_TEMPLATE="HISTORY.AOGCM-MOM5.rc.tmpl" @@ -640,7 +646,7 @@ if( $OGCM == TRUE ) then set MIT = "#DELETE" else if ( "$OCNMODEL" == "MOM6" ) then set OCEAN_NAME="MOM6" - set OCEAN_PRELOAD = 'env LD_PRELOAD=$GEOSDIR/lib/libmom6@CMAKE_SHARED_LIBRARY_SUFFIX@' + set OCEAN_PRELOAD = 'env @PRELOAD_COMMAND=\$GEOSDIR/lib/libmom6@CMAKE_SHARED_LIBRARY_SUFFIX@' set MOM6="" set MOM5 = "#DELETE" set DEFAULT_HISTORY_TEMPLATE="HISTORY.AOGCM.rc.tmpl" @@ -2482,6 +2488,9 @@ s?@BACM_1M_?$BACM_1M_?g s?@GFDL_1M_?$GFDL_1M_?g s?@MGB2_2M_?$MGB2_2M_?g +s/@PRELOAD_COMMAND/$PRELOAD_COMMAND/g +s/@RUN_CMD/$RUN_CMD/g + EOF # Added FV3/GFDL-MP Specific Parameters From 4f9d57012f73659148f5650e3fb4c2296d5296ff Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 19 Oct 2023 13:56:40 -0400 Subject: [PATCH 2/5] Use DYLD_LIBRARY_PATH --- gcm_archive.j | 4 ++-- gcm_forecast.tmpl | 2 +- gcm_moveplot.j | 2 +- gcm_plot.tmpl | 6 +++--- gcm_post.j | 2 +- gcm_quickstat.j | 4 ++-- gcm_regress.j | 2 +- gcm_run.j | 2 +- gcm_run_benchmark.j | 6 +++--- gcm_setup | 3 +++ 10 files changed, 18 insertions(+), 15 deletions(-) diff --git a/gcm_archive.j b/gcm_archive.j index af37e59c..ae169c34 100644 --- a/gcm_archive.j +++ b/gcm_archive.j @@ -33,9 +33,9 @@ setenv SITE @SITE setenv GEOSBIN @GEOSBIN source $GEOSBIN/g5_modules -setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib +setenv @LD_LIBRARY_PATH_CMD ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib ####################################################################### -# Archive Commands +# Archive Commands ####################################################################### diff --git a/gcm_forecast.tmpl b/gcm_forecast.tmpl index 2c1eb2d6..bedb47d6 100755 --- a/gcm_forecast.tmpl +++ b/gcm_forecast.tmpl @@ -32,7 +32,7 @@ setenv GEOSETC @GEOSETC setenv GEOSUTIL @GEOSSRC @NATIVE_BUILD source $GEOSBIN/g5_modules -@NATIVE_BUILD setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib:${GEOSDIR}/lib +@NATIVE_BUILD setenv @LD_LIBRARY_PATH_CMD ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib:${GEOSDIR}/lib setenv RUN_CMD "@RUN_CMD" diff --git a/gcm_moveplot.j b/gcm_moveplot.j index 6913d64a..271c9132 100755 --- a/gcm_moveplot.j +++ b/gcm_moveplot.j @@ -34,7 +34,7 @@ setenv GEOSBIN @GEOSBIN setenv GEOSUTIL @GEOSSRC source $GEOSBIN/g5_modules -setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib +setenv @LD_LIBRARY_PATH_CMD ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib ####################################################################### # Experiment Specific Environment Variables diff --git a/gcm_plot.tmpl b/gcm_plot.tmpl index 5a21052b..b02b92b4 100755 --- a/gcm_plot.tmpl +++ b/gcm_plot.tmpl @@ -34,7 +34,7 @@ setenv GEOSBIN @GEOSBIN setenv GEOSUTIL @GEOSSRC source $GEOSBIN/g5_modules -setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib +setenv @LD_LIBRARY_PATH_CMD ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib ####################################################################### # Experiment Specific Environment Variables @@ -45,7 +45,7 @@ setenv EXPDIR @EXPDIR setenv HOMDIR @HOMDIR ####################################################################### -# Quickplot Commands +# Quickplot Commands ####################################################################### cd $EXPDIR/plot @@ -57,7 +57,7 @@ else endif ####################################################################### -# Move Plots to Web Server +# Move Plots to Web Server ####################################################################### set MOVE = `grep PLOT_MOVE: $EXPDIR/plot/plot.rc | cut -d'#' -f1 | cut -d':' -f2` diff --git a/gcm_post.j b/gcm_post.j index 1683e7ba..880a3d9d 100755 --- a/gcm_post.j +++ b/gcm_post.j @@ -36,7 +36,7 @@ setenv GEOSUTIL @GEOSSRC setenv BATCHNAME "@POST_N" source $GEOSBIN/g5_modules -setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib +setenv @LD_LIBRARY_PATH_CMD ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib if( $?SLURM_NTASKS ) then setenv RUN_CMD "@RUN_CMD" diff --git a/gcm_quickstat.j b/gcm_quickstat.j index 56218369..5252044f 100755 --- a/gcm_quickstat.j +++ b/gcm_quickstat.j @@ -29,10 +29,10 @@ setenv GEOSBIN @GEOSBIN setenv GEOSUTIL @GEOSSRC source $GEOSBIN/g5_modules -setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib +setenv @LD_LIBRARY_PATH_CMD ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib ####################################################################### -# Quickstat Commands +# Quickstat Commands ####################################################################### cd $GEOSUTIL/plots diff --git a/gcm_regress.j b/gcm_regress.j index 5c0f5f59..89d870c0 100755 --- a/gcm_regress.j +++ b/gcm_regress.j @@ -90,7 +90,7 @@ setenv GEOSDIR @GEOSDIR setenv GEOSBIN @GEOSBIN source $GEOSBIN/g5_modules -setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib:${GEOSDIR}/lib +setenv @LD_LIBRARY_PATH_CMD ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib:${GEOSDIR}/lib setenv RUN_CMD "@RUN_CMD" diff --git a/gcm_run.j b/gcm_run.j index fec054c7..ec772716 100755 --- a/gcm_run.j +++ b/gcm_run.j @@ -33,7 +33,7 @@ setenv GEOSETC @GEOSETC setenv GEOSUTIL @GEOSSRC source $GEOSBIN/g5_modules -setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib:${GEOSDIR}/lib +setenv @LD_LIBRARY_PATH_CMD ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib:${GEOSDIR}/lib setenv RUN_CMD "@RUN_CMD" diff --git a/gcm_run_benchmark.j b/gcm_run_benchmark.j index cac98ebb..a0d19df2 100755 --- a/gcm_run_benchmark.j +++ b/gcm_run_benchmark.j @@ -33,7 +33,7 @@ setenv GEOSETC @GEOSETC setenv GEOSUTIL @GEOSSRC source $GEOSBIN/g5_modules -setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib:${GEOSDIR}/lib +setenv @LD_LIBRARY_PATH_CMD ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib:${GEOSDIR}/lib setenv RUN_CMD "@RUN_CMD" @@ -951,8 +951,8 @@ setenv GEOSBIN $GEOSBIN setenv GEOSETC $GEOSETC setenv GEOSUTIL $GEOSUTIL source $GEOSBIN/g5_modules -setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib:${GEOSDIR}/lib -echo $LD_LIBRARY_PATH +setenv @LD_LIBRARY_PATH_CMD ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib:${GEOSDIR}/lib +echo $@LD_LIBRARY_PATH_CMD cd $statsdir $RUN_CMD 1 $GEOSUTIL/bin/stats.x -fcst $fcst_files -ana $ana_files -cli $clim_files -rc $GEOSUTIL/post/stats.rc \ -levs $levs_clim -tag $EXPID -nfreq 060000 -fhour $fHOURS diff --git a/gcm_setup b/gcm_setup index b75f6c5e..15778853 100755 --- a/gcm_setup +++ b/gcm_setup @@ -39,12 +39,14 @@ setenv NODE `uname -n` if ($ARCH == Darwin) then set FINDPATH = realpath set PRELOAD_COMMAND = 'DYLD_INSERT_LIBRARIES' + set LD_LIBRARY_PATH_CMD = 'DYLD_LIBRARY_PATH' # On macOS we seem to need to call mpirun directly and not use esma_mpirun # For some reason SIP does not let the libraries be preloaded set RUN_CMD = 'mpirun -np' else set FINDPATH = 'readlink -f' set PRELOAD_COMMAND = 'LD_PRELOAD' + set LD_LIBRARY_PATH_CMD = 'LD_LIBRARY_PATH' set RUN_CMD = '$GEOSBIN/esma_mpirun -np' endif set GCMSETUP = `$FINDPATH $0` @@ -2473,6 +2475,7 @@ s?@GFDL_1M_?$GFDL_1M_?g s?@MGB2_2M_?$MGB2_2M_?g s/@PRELOAD_COMMAND/$PRELOAD_COMMAND/g +s/@LD_LIBRARY_PATH_CMD/$LD_LIBRARY_PATH_CMD/g s/@RUN_CMD/$RUN_CMD/g EOF From f16f38dcb97fb87cd317c0489824466a62179183 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 19 Oct 2023 14:00:11 -0400 Subject: [PATCH 3/5] Update other setup scripts --- geoschemchem_setup | 3 +++ gmichem_setup | 3 +++ stratchem_setup | 3 +++ 3 files changed, 9 insertions(+) diff --git a/geoschemchem_setup b/geoschemchem_setup index d74a4919..a886372a 100755 --- a/geoschemchem_setup +++ b/geoschemchem_setup @@ -39,12 +39,14 @@ setenv NODE `uname -n` if ($ARCH == Darwin) then set FINDPATH = realpath set PRELOAD_COMMAND = 'DYLD_INSERT_LIBRARIES' + set LD_LIBRARY_PATH_CMD = 'DYLD_LIBRARY_PATH' # On macOS we seem to need to call mpirun directly and not use esma_mpirun # For some reason SIP does not let the libraries be preloaded set RUN_CMD = 'mpirun -np' else set FINDPATH = 'readlink -f' set PRELOAD_COMMAND = 'LD_PRELOAD' + set LD_LIBRARY_PATH_CMD = 'LD_LIBRARY_PATH' set RUN_CMD = '$GEOSBIN/esma_mpirun -np' endif set GCMSETUP = `$FINDPATH $0` @@ -2505,6 +2507,7 @@ s?@GFDL_1M_?$GFDL_1M_?g s?@MGB2_2M_?$MGB2_2M_?g s/@PRELOAD_COMMAND/$PRELOAD_COMMAND/g +s/@LD_LIBRARY_PATH_CMD/$LD_LIBRARY_PATH_CMD/g s/@RUN_CMD/$RUN_CMD/g EOF diff --git a/gmichem_setup b/gmichem_setup index 0da0b18a..754083e0 100755 --- a/gmichem_setup +++ b/gmichem_setup @@ -39,12 +39,14 @@ setenv NODE `uname -n` if ($ARCH == Darwin) then set FINDPATH = realpath set PRELOAD_COMMAND = 'DYLD_INSERT_LIBRARIES' + set LD_LIBRARY_PATH_CMD = 'DYLD_LIBRARY_PATH' # On macOS we seem to need to call mpirun directly and not use esma_mpirun # For some reason SIP does not let the libraries be preloaded set RUN_CMD = 'mpirun -np' else set FINDPATH = 'readlink -f' set PRELOAD_COMMAND = 'LD_PRELOAD' + set LD_LIBRARY_PATH_CMD = 'LD_LIBRARY_PATH' set RUN_CMD = '$GEOSBIN/esma_mpirun -np' endif set GCMSETUP = `$FINDPATH $0` @@ -2671,6 +2673,7 @@ s?@GFDL_1M_?$GFDL_1M_?g s?@MGB2_2M_?$MGB2_2M_?g s/@PRELOAD_COMMAND/$PRELOAD_COMMAND/g +s/@LD_LIBRARY_PATH_CMD/$LD_LIBRARY_PATH_CMD/g s/@RUN_CMD/$RUN_CMD/g EOF diff --git a/stratchem_setup b/stratchem_setup index a5b369e4..d20d5f5c 100755 --- a/stratchem_setup +++ b/stratchem_setup @@ -39,12 +39,14 @@ setenv NODE `uname -n` if ($ARCH == Darwin) then set FINDPATH = realpath set PRELOAD_COMMAND = 'DYLD_INSERT_LIBRARIES' + set LD_LIBRARY_PATH_CMD = 'DYLD_LIBRARY_PATH' # On macOS we seem to need to call mpirun directly and not use esma_mpirun # For some reason SIP does not let the libraries be preloaded set RUN_CMD = 'mpirun -np' else set FINDPATH = 'readlink -f' set PRELOAD_COMMAND = 'LD_PRELOAD' + set LD_LIBRARY_PATH_CMD = 'LD_LIBRARY_PATH' set RUN_CMD = '$GEOSBIN/esma_mpirun -np' endif set GCMSETUP = `$FINDPATH $0` @@ -2489,6 +2491,7 @@ s?@GFDL_1M_?$GFDL_1M_?g s?@MGB2_2M_?$MGB2_2M_?g s/@PRELOAD_COMMAND/$PRELOAD_COMMAND/g +s/@LD_LIBRARY_PATH_CMD/$LD_LIBRARY_PATH_CMD/g s/@RUN_CMD/$RUN_CMD/g EOF From a1f35767ef6b2e20c1dabc488afd50346f076c30 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 19 Oct 2023 14:30:38 -0400 Subject: [PATCH 4/5] Fix sed --- gcm_setup | 6 +++--- geoschemchem_setup | 6 +++--- gmichem_setup | 6 +++--- stratchem_setup | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gcm_setup b/gcm_setup index 15778853..93f4ead9 100755 --- a/gcm_setup +++ b/gcm_setup @@ -2474,9 +2474,9 @@ s?@BACM_1M_?$BACM_1M_?g s?@GFDL_1M_?$GFDL_1M_?g s?@MGB2_2M_?$MGB2_2M_?g -s/@PRELOAD_COMMAND/$PRELOAD_COMMAND/g -s/@LD_LIBRARY_PATH_CMD/$LD_LIBRARY_PATH_CMD/g -s/@RUN_CMD/$RUN_CMD/g +s?@PRELOAD_COMMAND?$PRELOAD_COMMAND?g +s?@LD_LIBRARY_PATH_CMD?$LD_LIBRARY_PATH_CMD?g +s?@RUN_CMD?$RUN_CMD?g EOF diff --git a/geoschemchem_setup b/geoschemchem_setup index a886372a..d66ab78d 100755 --- a/geoschemchem_setup +++ b/geoschemchem_setup @@ -2506,9 +2506,9 @@ s?@BACM_1M_?$BACM_1M_?g s?@GFDL_1M_?$GFDL_1M_?g s?@MGB2_2M_?$MGB2_2M_?g -s/@PRELOAD_COMMAND/$PRELOAD_COMMAND/g -s/@LD_LIBRARY_PATH_CMD/$LD_LIBRARY_PATH_CMD/g -s/@RUN_CMD/$RUN_CMD/g +s?@PRELOAD_COMMAND?$PRELOAD_COMMAND?g +s?@LD_LIBRARY_PATH_CMD?$LD_LIBRARY_PATH_CMD?g +s?@RUN_CMD?$RUN_CMD?g EOF diff --git a/gmichem_setup b/gmichem_setup index 754083e0..8fa5ed8d 100755 --- a/gmichem_setup +++ b/gmichem_setup @@ -2672,9 +2672,9 @@ s?@BACM_1M_?$BACM_1M_?g s?@GFDL_1M_?$GFDL_1M_?g s?@MGB2_2M_?$MGB2_2M_?g -s/@PRELOAD_COMMAND/$PRELOAD_COMMAND/g -s/@LD_LIBRARY_PATH_CMD/$LD_LIBRARY_PATH_CMD/g -s/@RUN_CMD/$RUN_CMD/g +s?@PRELOAD_COMMAND?$PRELOAD_COMMAND?g +s?@LD_LIBRARY_PATH_CMD?$LD_LIBRARY_PATH_CMD?g +s?@RUN_CMD?$RUN_CMD?g EOF diff --git a/stratchem_setup b/stratchem_setup index d20d5f5c..2497d9d1 100755 --- a/stratchem_setup +++ b/stratchem_setup @@ -2490,9 +2490,9 @@ s?@BACM_1M_?$BACM_1M_?g s?@GFDL_1M_?$GFDL_1M_?g s?@MGB2_2M_?$MGB2_2M_?g -s/@PRELOAD_COMMAND/$PRELOAD_COMMAND/g -s/@LD_LIBRARY_PATH_CMD/$LD_LIBRARY_PATH_CMD/g -s/@RUN_CMD/$RUN_CMD/g +s?@PRELOAD_COMMAND?$PRELOAD_COMMAND?g +s?@LD_LIBRARY_PATH_CMD?$LD_LIBRARY_PATH_CMD?g +s?@RUN_CMD?$RUN_CMD?g EOF From 046c9b23b5d912a307146e6e476276c6433258ed Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 19 Oct 2023 14:32:54 -0400 Subject: [PATCH 5/5] Add spaces --- gcm_setup | 4 ++-- geoschemchem_setup | 4 ++-- gmichem_setup | 4 ++-- stratchem_setup | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gcm_setup b/gcm_setup index 93f4ead9..73829727 100755 --- a/gcm_setup +++ b/gcm_setup @@ -42,12 +42,12 @@ if ($ARCH == Darwin) then set LD_LIBRARY_PATH_CMD = 'DYLD_LIBRARY_PATH' # On macOS we seem to need to call mpirun directly and not use esma_mpirun # For some reason SIP does not let the libraries be preloaded - set RUN_CMD = 'mpirun -np' + set RUN_CMD = 'mpirun -np ' else set FINDPATH = 'readlink -f' set PRELOAD_COMMAND = 'LD_PRELOAD' set LD_LIBRARY_PATH_CMD = 'LD_LIBRARY_PATH' - set RUN_CMD = '$GEOSBIN/esma_mpirun -np' + set RUN_CMD = '$GEOSBIN/esma_mpirun -np ' endif set GCMSETUP = `$FINDPATH $0` set BINDIR = `dirname $GCMSETUP` diff --git a/geoschemchem_setup b/geoschemchem_setup index d66ab78d..261b5003 100755 --- a/geoschemchem_setup +++ b/geoschemchem_setup @@ -42,12 +42,12 @@ if ($ARCH == Darwin) then set LD_LIBRARY_PATH_CMD = 'DYLD_LIBRARY_PATH' # On macOS we seem to need to call mpirun directly and not use esma_mpirun # For some reason SIP does not let the libraries be preloaded - set RUN_CMD = 'mpirun -np' + set RUN_CMD = 'mpirun -np ' else set FINDPATH = 'readlink -f' set PRELOAD_COMMAND = 'LD_PRELOAD' set LD_LIBRARY_PATH_CMD = 'LD_LIBRARY_PATH' - set RUN_CMD = '$GEOSBIN/esma_mpirun -np' + set RUN_CMD = '$GEOSBIN/esma_mpirun -np ' endif set GCMSETUP = `$FINDPATH $0` set BINDIR = `dirname $GCMSETUP` diff --git a/gmichem_setup b/gmichem_setup index 8fa5ed8d..9855e0ed 100755 --- a/gmichem_setup +++ b/gmichem_setup @@ -42,12 +42,12 @@ if ($ARCH == Darwin) then set LD_LIBRARY_PATH_CMD = 'DYLD_LIBRARY_PATH' # On macOS we seem to need to call mpirun directly and not use esma_mpirun # For some reason SIP does not let the libraries be preloaded - set RUN_CMD = 'mpirun -np' + set RUN_CMD = 'mpirun -np ' else set FINDPATH = 'readlink -f' set PRELOAD_COMMAND = 'LD_PRELOAD' set LD_LIBRARY_PATH_CMD = 'LD_LIBRARY_PATH' - set RUN_CMD = '$GEOSBIN/esma_mpirun -np' + set RUN_CMD = '$GEOSBIN/esma_mpirun -np ' endif set GCMSETUP = `$FINDPATH $0` set BINDIR = `dirname $GCMSETUP` diff --git a/stratchem_setup b/stratchem_setup index 2497d9d1..b3ca20c5 100755 --- a/stratchem_setup +++ b/stratchem_setup @@ -42,12 +42,12 @@ if ($ARCH == Darwin) then set LD_LIBRARY_PATH_CMD = 'DYLD_LIBRARY_PATH' # On macOS we seem to need to call mpirun directly and not use esma_mpirun # For some reason SIP does not let the libraries be preloaded - set RUN_CMD = 'mpirun -np' + set RUN_CMD = 'mpirun -np ' else set FINDPATH = 'readlink -f' set PRELOAD_COMMAND = 'LD_PRELOAD' set LD_LIBRARY_PATH_CMD = 'LD_LIBRARY_PATH' - set RUN_CMD = '$GEOSBIN/esma_mpirun -np' + set RUN_CMD = '$GEOSBIN/esma_mpirun -np ' endif set GCMSETUP = `$FINDPATH $0` set BINDIR = `dirname $GCMSETUP`