@@ -317,8 +317,43 @@ else if ( $SITE == 'NAS' ) then
317317 set NCPUS_PER_NODE = 128
318318 endif
319319
320+ else if( $SITE == ' AWS' | $SITE == ' Azure' ) then
321+
322+ # Because we do not know the name of the model or the number of CPUs
323+ # per node. We ask the user to set these variables in the script
324+
325+ # AWS and Azure users must set the MODEL and NCPUS_PER_NODE
326+ set MODEL = USER_MUST_SET
327+ set NCPUS_PER_NODE = USER_MUST_SET
328+
329+ # Above we need a user to set the MODEL and NCPUS_PER_NODE
330+ # variables. Here we check that they have been set. If not,
331+ # we ask the user to set them
332+ # --------------------------------------------------------
333+
334+ if ( $MODEL == USER_MUST_SET | $NCPUS_PER_NODE == USER_MUST_SET ) then
335+ echo " ERROR: We have detected you are on $SITE . As we do not have"
336+ echo " official fixed node info yet, we ask you to edit $0 "
337+ echo " and set the MODEL and NCPUS_PER_NODE variables."
338+ echo " Look for the section that says:"
339+ echo " "
340+ echo " # AWS and Azure users must set the MODEL and NCPUS_PER_NODE"
341+ exit 1
342+ endif
343+
320344else
321345 set MODEL = ' UNKNOWN'
346+ # As we do not know how many CPUs per node, we detect the number
347+ # of CPUs per node by looking at the number of CPUs. This is different
348+ # on Linux and macOS
349+ if ( $ARCH == ' Linux' ) then
350+ set NCPUS_PER_NODE = ` grep -c ^processor /proc/cpuinfo`
351+ else if ( $ARCH == ' Darwin' ) then
352+ set NCPUS_PER_NODE = ` sysctl -n hw.ncpu`
353+ else
354+ echo " ERROR: Unknown architecture $ARCH "
355+ exit 1
356+ endif
322357endif
323358
324359# Set DEFAULT SHMEM Parameter
394429 set DEF_IOS_NDS = 5
395430endif
396431
397- # On desktop, we need default to 6 processes
432+ # On desktop, we default to 6 processes
398433# Must be set here due to MODEL_NPES calc below
399- if( $SITE ! = ' NAS' && $SITE ! = ' NCCS' && $SITE ! = ' AWS' ) then
434+ if( $SITE ! = ' NAS' && $SITE ! = ' NCCS' && $SITE ! = ' AWS' && $SITE ! = ' Azure ' ) then
400435 set FV_NX = 1
401436endif
402437
418453 set IOS_NDS = 0
419454endif
420455
421- setenv RUN_N $EXPID # RUN Job Name
456+ setenv RUN_N $EXPID # RUN Job Name
422457
423458if( $SITE == ' NAS' ) then
424459 setenv RUN_N ` echo $EXPID | cut -b1-200` _RUN # RUN Job Name
@@ -455,7 +490,7 @@ else if( $SITE == 'NCCS' ) then
455490
456491 setenv WRKDIR /discover/nobackup/$LOGNAME # user work directory
457492
458- else if( $SITE == ' AWS' ) then
493+ else if( $SITE == ' AWS' | $SITE == " Azure " ) then
459494 setenv BATCH_CMD " sbatch" # SLURM Batch command
460495 setenv BATCH_GROUP " DELETE" # SLURM Syntax for account name
461496 setenv BATCH_TIME " SBATCH --time=" # SLURM Syntax for walltime
@@ -464,15 +499,13 @@ else if( $SITE == 'AWS' ) then
464499 setenv BATCH_JOINOUTERR " DELETE" # SLURM joins out and err by default
465500 setenv RUN_T " 01:00:00" # Wallclock Time for fv3.j
466501
467- setenv RUN_Q " DELETE"
468- setenv RUN_P " SBATCH --ntasks=${MODEL_NPES} " # PE Configuration for fv3.j
502+ @ NODES = ` echo " ( ($MODEL_NPES + $NCPUS_PER_NODE ) + ($IOS_NDS * $NCPUS_PER_NODE ) - 1)/$NCPUS_PER_NODE " | bc`
469503
470- # By default on AWS, just ignore IOSERVER for now until testing
471- set USE_IOSERVER = 0
472- set IOS_NDS = 0
473- set NCPUS_PER_NODE = 0
504+ setenv RUN_Q " SBATCH --constraint=${MODEL} " # batch queue name for fv3.j
505+ setenv RUN_P " SBATCH --nodes=${NODES} --ntasks-per-node=${NCPUS_PER_NODE} " # PE Configuration for fv3.j
474506
475507 setenv WRKDIR /home/$LOGNAME # user work directory
508+
476509else
477510# These are defaults for others (assume slurm)
478511 setenv BATCH_CMD " sbatch" # SLURM Batch command
489522 # By default on desktop, just ignore IOSERVER for now until testing
490523 set USE_IOSERVER = 0
491524 set IOS_NDS = 0
492- set NCPUS_PER_NODE = 0
493525
494526 setenv WRKDIR /home/$LOGNAME # user work directory
495527endif
@@ -751,7 +783,6 @@ foreach FILE ($FILES)
751783 exit 2
752784 endif
753785
754-
755786 sed -f $EXPDIR /sedfile $EXPDIR /tmpfile > $EXPDIR /$FILE
756787
757788 echo " Creating ${C1}${FILE}${CN} for Experiment: $EXPID "
@@ -791,6 +822,9 @@ chmod +x $EXPDIR/fv3.j
791822echo " Done!"
792823echo " -----"
793824echo " "
825+ echo " You can find your experiment in the directory:"
826+ echo " ${C2}${EXPDIR}${CN} "
827+ echo " "
794828echo " NOTE: fv3.j by default will run StandAlone_FV3_Dycore.x from the installation directory:"
795829echo " $GEOSBIN "
796830echo " "
0 commit comments