E3SM-Project / E3SM

Energy Exascale Earth System Model source code. NOTE: use "maint" branches for your work. Head of master is not validated.
https://docs.e3sm.org/E3SM
Other
355 stars 368 forks source link

configure not called correctly in CAM #2325

Open worleyph opened 6 years ago

worleyph commented 6 years ago

This does not appear to cause any errors, and has been this way for a long time, but ...

A) in components/cam/cime_config/buildnml:

my $spmd = '-spmd';
if ($MPILIB eq 'mpi-serial') {$spmd = "-nospmd";}
my $smp = '-smp';
if (($NTHRDS_ATM == 1) && ($BUILD_THREADED eq 'FALSE')) {$smp = "-nosmp";}

and

$sysmod = "$SRCROOT/components/cam/bld/configure -s -ccsm_seq -ice none \
 -ocn $ocn -comp_intf $comp $scm -spmd $spmd -smp $smp -dyn $CAM_DYCORE \
 -dyn_target $CAM_TARGET -res $ATM_GRID $nlev $CAM_LIB_DIRS $CAM_CONFIG_OPTS $os_opt";

Note that the parameters to configure are '-spmd $spmd' and '-smp $smp', and $spmd is either -spmd or -nospmd and $smp is either -smp or -nosmp (so the arguments also start with a dash).

In components/cam/bld/configure, the arguments are

 CAM parallelization:
    -[no]smp           Switch on [off] SMP parallelism.
    -[no]spmd          Switch on [off] SPMD parallelism.

so -smp and -nosmp do not take arguments. I believe that the call to configure defined in buildnml should just be

 configure -s ... $scm $spmd $smp ...

B) There is actually a second issue here, having to do with scam. More of the code block in buildnml is

# Some settings for single column mode.                                                    
my $scm = "";
if ($PTS_MODE eq 'TRUE') {$scm = "-scam -nosmp";}
my $spmd = '-spmd';
if ($MPILIB eq 'mpi-serial') {$spmd = "-nospmd";}
my $smp = '-smp';
if (($NTHRDS_ATM == 1) && ($BUILD_THREADED eq 'FALSE')) {$smp = "-nosmp";}

So, if $PTS_MODE eq 'TRUE', then the current configure call will look like

-scam -nosmp -spmd -nospmd -smp -nosmp

or

-scam -nosmp -spmd -nospmd -smp -smp

or

-scam -nosmp -spmd -spmd -smp -nosmp

or

-scam -nosmp -spmd -spmd -smp -smp

Even with the proposed fix to (A), these become

-scam -nosmp -nospmd -nosmp

or

-scam -nosmp -nospmd -smp

or

-scam -nosmp -spmd -nosmp

or

-scam -nosmp -spmd -smp

So, either the -nosmp in the definition of $scm is never needed, or, if it is needed, then we could have $smp overriding -nosmp. Someone in the CAM developers group will need to determine which this is.

worleyph commented 6 years ago

Pinging @singhbalwinder (and @jgfouca ). (A) still seems to be an issue. The call is now

 run_cmd_no_fail("{} -s -ccsm_seq -ice none -ocn {} -comp_intf {} {} -spmd {} -smp {} -dyn {} -dyn_target {} -res {} {} {} {} {}".format(os.path.join(srcroot, "components/cam/bld/configure"), ocn, comp, scm, spmd, smp, cam_dycore, cam_target, atm_grid, nlev, cam_lib_dirs, cam_config_opts, os_opt), from_dir=camconf_dir)

but the same issue exists here as well, as -smp and -spmd do not take arguments in configure.

I have not reexamined (B), but assume that nothing has changed there.