Advertisement
Guest User

Untitled

a guest
Jan 8th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.69 KB | None | 0 0
  1. diff --git a/scripts/create_newcase b/scripts/create_newcase
  2. index 3d42145..601b083 100755
  3. --- a/scripts/create_newcase
  4. +++ b/scripts/create_newcase
  5. @@ -14,6 +14,7 @@ use English;
  6. use Getopt::Long;
  7. use IO::File;
  8. use IO::Handle;
  9. +use Data::Dumper;
  10.  
  11. # Check for the existence of XML::LibXML in whatever perl distribution happens to be in use.
  12. # If not found, print a warning message then exit.
  13. @@ -74,64 +75,68 @@ my $machdir="$cfgdir/ccsm_utils/Machines";
  14.  
  15. sub usage {
  16. die <<EOF;
  17. - SYNOPSIS
  18. - create_newcase [options]
  19. - OPTIONS
  20. - User supplied values are denoted in angle brackets (<>). Any value that contains
  21. - white-space must be quoted. Long option names may be supplied with either single
  22. - or double leading dashes. A consequence of this is that single letter options may
  23. - NOT be bundled.
  24. -
  25. - -case <name> Specifies the case name (required).
  26. - -compset <name> Specify a CESM compset (required).
  27. - -res <name> Specify a CESM grid resolution (required).
  28. - -mach <name> Specify a CESM machine (required).
  29. - -compiler <name> Specify a compiler for the target machine (optional)
  30. - default: default compiler for the target machine
  31. - -mpilib <name> Specify a mpi library for the target machine (optional)
  32. - default: default mpi library for the target machine
  33. - allowed: openmpi, mpich, ibm, mpi-serial, etc
  34. - redundant with _M confopts setting
  35. - -mach_dir <path> Specify the locations of the Machines directory (optional).
  36. - default: $machdir
  37. - -user_mods_dir <path>Path to directory with user_nl_* files and xmlchange_cmnds to use (optional).
  38. - -confopts <value> Specify some addition configuration options (optional)
  39. - _AOA = aoflux on atm grid
  40. - _AOE = aoflux on exch grid
  41. - _CG = gregorian calendar
  42. - _D = debug
  43. - _E = esmf interfaces
  44. - _IOP*= PnetCDF IO test where * is
  45. - A(atm), C(cpl), G(glc) , I(ice), L(clm), O(ocn),
  46. - W(wav) or blank (all components)
  47. - _L* = set run length y, m, d, h, s, n(nsteps) plus integer (ie _Lm6 for 6 months)
  48. - _M* = set the mpilib where * is default, mpi-serial, mpich, etc
  49. - _N* = set NINST_ env value to * where * is an integer
  50. - _P* = set pecount to specific values include T,S,M,L,X,1,1x1,16,16x1,4x4, etc
  51. - -pecount <name> Value of S,M,L,X1,X2 (optional).
  52. - default: M, partially redundant with confopts _P
  53. - -pes_file <name> Full pathname of pes file to use (will overwrite default settings) (optional).
  54. - See sample_pes_file.xml for an example.
  55. - -user_compset Long name for new user compset to use (optional)
  56. - This assumes that all of the compset settings in the long name have been defined
  57. - in ccsm_utils/Case.template/config_compsets.xml
  58. - -user_grid_file <name> Full pathname of grid file to use (optional)
  59. - This should be a "copy" of ccsm_utils/Case.template/config_grid.xml with the
  60. - new user grid changes added to it
  61. - -help [or -h] Print usage to STDOUT (optional).
  62. - -list <type> Only list valid values, type can be [compsets, grids, machines] (optional).
  63. - -testlist List valid values for tests [normally only invoked by create_test] (optional).
  64. - -silent [or -s] Turns on silent mode - only fatal messages issued (optional).
  65. - -verbose [or -v] Turn on verbose echoing of settings made by create_newcase (optional).
  66. - -xmlmode <name> Sets format of xml files; normal or expert (optional). (default is normal)
  67. - -nowarning Turns off checking of the known_problems repository. (default is on)
  68. - -sharedlibroot Used for re-using build components when building multiple CESM cases, default is \$EXEROOT
  69. -
  70. - The following two arguments turn on single point mode. If one is given -- both MUST be given.
  71. -
  72. - EXAMPLES
  73. -
  74. - ./create_newcase -case mycase1 -res f19_g16 -compset B1850CN -mach yellowstone
  75. +
  76. +SYNOPSIS
  77. + create_newcase [options]
  78. +
  79. +OPTIONS
  80. + User supplied values are denoted in angle brackets (<>). Any value that contains
  81. + white-space must be quoted. Long option names may be supplied with either single
  82. + or double leading dashes. A consequence of this is that single letter options may
  83. + NOT be bundled.
  84. +
  85. + -case <name> Specifies the case name (required).
  86. + -compset <name> Specify a CESM compset (required).
  87. + -res <name> Specify a CESM grid resolution (required).
  88. + -mach <name> Specify a CESM machine (required).
  89. + -project <name> Specify a project id for the case (optional)
  90. + default: user-specified environment variable PROJECT or ACCOUNT
  91. + or read from ~/.cesm_proj or ~/.ccsm_proj
  92. + -compiler <name> Specify a compiler for the target machine (optional)
  93. + default: default compiler for the target machine
  94. + -mpilib <name> Specify a mpi library for the target machine (optional)
  95. + default: default mpi library for the target machine
  96. + allowed: openmpi, mpich, ibm, mpi-serial, etc
  97. + redundant with _M confopts setting
  98. + -mach_dir <path> Specify the locations of the Machines directory (optional).
  99. + default: $machdir
  100. + -user_mods_dir <path> Path to directory with user_nl_* files and xmlchange_cmnds to use (optional).
  101. + -confopts <value> Specify some addition configuration options (optional)
  102. + _AOA = aoflux on atm grid
  103. + _AOE = aoflux on exch grid
  104. + _CG = gregorian calendar
  105. + _D = debug
  106. + _E = esmf interfaces
  107. + _IOP*= PnetCDF IO test where * is
  108. + A(atm), C(cpl), G(glc) , I(ice), L(clm), O(ocn),
  109. + W(wav) or blank (all components)
  110. + _L* = set run length y, m, d, h, s, n(nsteps) plus integer (ie _Lm6 for 6 months)
  111. + _M* = set the mpilib where * is default, mpi-serial, mpich, etc
  112. + _N* = set NINST_ env value to * where * is an integer
  113. + _P* = set pecount to specific values include T,S,M,L,X,1,1x1,16,16x1,4x4,16x1D, etc
  114. + -pecount <name> Value of S,M,L,X1,X2 (optional).
  115. + default: M, partially redundant with confopts _P
  116. + -pes_file <name> Full pathname of pes file to use (will overwrite default settings) (optional).
  117. + See sample_pes_file.xml for an example.
  118. + -user_compset Long name for new user compset to use (optional)
  119. + This assumes that all of the compset settings in the long name have been defined
  120. + in ccsm_utils/Case.template/config_compsets.xml
  121. + -user_grid_file <name> Full pathname of grid file to use (optional)
  122. + This should be a "copy" of ccsm_utils/Case.template/config_grid.xml with the
  123. + new user grid changes added to it
  124. + -nosavetiming Change the default for SAVE_TIMING in env_run.xml to .FALSE. (optional).
  125. + -help [or -h] Print usage to STDOUT (optional).
  126. + -list <type> Only list valid values, type can be [compsets, grids, machines] (optional).
  127. + -testlist List valid values for tests [normally only invoked by create_test] (optional).
  128. + -silent [or -s] Turns on silent mode - only fatal messages issued (optional).
  129. + -verbose [or -v] Turn on verbose echoing of settings made by create_newcase (optional).
  130. + -xmlmode <name> Sets format of xml files; normal or expert (optional). (default is normal)
  131. + -nowarning Turns off checking of the known_problems repository. (default is on)
  132. + -sharedlibroot Used for re-using build components when building multiple CESM cases, default is \$EXEROOT
  133. +
  134. +EXAMPLES
  135. +
  136. + ./create_newcase -case mycase1 -res f19_g16 -compset B1850CN -mach yellowstone
  137. ./create_newcase -case mycase2 -res f19_g16 -compset B1850CN -mach yellowstone -confopts _D_P16
  138. ./create_newcase -case mycase4 -res f19_g16 -compset MYCOMP -compset_file mycompset_file -mach yellowstone
  139. ./create_newcase -case mycase5 -res f19_g16 -compset B1850CN -mach yellowstone -confopts _CG_E -pes_file mypes_file
  140. @@ -153,6 +158,7 @@ GetOptions(
  141. "case=s" => \$opts{'case'},
  142. "compset=s" => \$opts{'compset'},
  143. "confopts=s" => \$opts{'confopts'},
  144. + "project=s" => \$opts{'project'},
  145. "compiler=s" => \$opts{'compiler'},
  146. "mpilib=s" => \$opts{'mpilib'},
  147. "res=s" => \$opts{'res'},
  148. @@ -165,14 +171,15 @@ GetOptions(
  149. "pes_file=s" => \$opts{'pes_file'},
  150. "compset_file=s" => \$opts{'compset_file'},
  151. "user_grid_file=s" => \$opts{'user_grid_file'},
  152. + "nosavetiming" => \$opts{'nosavetiming'},
  153. "s|silent" => \$opts{'silent'},
  154. "testname=s" => \$opts{'testname'},
  155. "testlist" => \$opts{'testlist'},
  156. "v|verbose" => \$opts{'verbose'},
  157. "xmlmode=s" => \$opts{'xmlmode'},
  158. - "nowarning" => \$opts{'nowarning'},
  159. + "nowarning" => \$opts{'nowarning'},
  160. "user_compset=s" => \$opts{'user_compset'},
  161. - "sharedlibroot=s" => \$opts{'sharedlibroot'},
  162. + "sharedlibroot=s" => \$opts{'sharedlibroot'},
  163. ) or usage();
  164.  
  165. # Give usage message.
  166. @@ -196,6 +203,7 @@ my $mach;
  167. my $testname;
  168. my $pecount;
  169. my $xmlmode;
  170. +my $project;
  171. my $compiler;
  172. my $mpilib;
  173. if (!$opts{'list'} && !$opts{'testlist'}) {
  174. @@ -229,6 +237,7 @@ if (!$opts{'list'} && !$opts{'testlist'}) {
  175. die "ERROR: create_newcase must include the input argument, -res\n";
  176. }
  177.  
  178. +
  179. # Check for manditory machine input
  180. if ($opts{'mach'}) {
  181. $mach = $opts{'mach'};
  182. @@ -372,6 +381,10 @@ my @dirs = ($cfgdir, "$cfgdir/ccsm_utils/Case.template", "$cfgdir/ccsm_utils/Too
  183. unshift @INC, @dirs;
  184. require XML::Lite;
  185. require ConfigCase;
  186. +require ProjectTools;
  187. +require Testing::CESMTest;
  188. +require Testing::TestLists;
  189. +
  190.  
  191. #-----------------------------------------------------------------------------------------------
  192. # If just listing valid values then exit after completion of lists
  193. @@ -381,12 +394,15 @@ if ($opts{'testlist'}) {
  194. if ($opts{'list'}) {
  195. if ($opts{'list'} eq "compsets") {
  196. list_compsets($compset_file);
  197. - }
  198. - if ($opts{'list'} eq "grids") {
  199. + } elsif ($opts{'list'} eq "grids") {
  200. list_grids($grid_file);
  201. - }
  202. - if ($opts{'list'} eq "machines") {
  203. + } elsif ($opts{'list'} eq "machines") {
  204. ConfigCase::print_machines("$machdir/$machine_file");
  205. + } else {
  206. + die <<"EOF";
  207. +** Bad argument to the list option: $opts{'list'}
  208. + Valid options: compsets, grids or machines **
  209. +EOF
  210. }
  211. &check_known_problems();
  212. if ($print>=2) { print "finished listing valid values, now exiting $eol"; }
  213. @@ -418,14 +434,14 @@ my $fh = IO::File->new($file, '>' ) or die "can't open file: $file\n";
  214. print $fh "$commandline\n\n\n";
  215. $fh->close;
  216.  
  217. -my ($compset_longname, $compset_shortname, $grid_longname, $grid_shortname);
  218. +my ($compset_longname, $compset_shortname, $grid_longname, $grid_shortname, $support_level);
  219. if ($opts{'user_compset'}) {
  220. my $user_compset = $opts{'user_compset'};
  221. - ($compset_longname, $compset_shortname, $grid_longname, $grid_shortname) =
  222. + ($compset_longname, $compset_shortname, $grid_longname, $grid_shortname, $support_level) =
  223. set_compset($compset_file, $user_compset, $grid_file, $grid, $cfg_ref, $caseroot,
  224. $user_compset);
  225. } else {
  226. - ($compset_longname, $compset_shortname, $grid_longname, $grid_shortname) =
  227. + ($compset_longname, $compset_shortname, $grid_longname, $grid_shortname, $support_level) =
  228. set_compset($compset_file, $compset, $grid_file, $grid, $cfg_ref, $caseroot);
  229. }
  230. if ($print>=2) { print "Compset specifier: $compset.$eol"; }
  231. @@ -441,6 +457,29 @@ check_grid("$cfgdir/ccsm_utils/Case.template/config_compsets.xml", $grid, $comps
  232. if ($print>=2) { print "Grid is valid for input compset. $eol"; }
  233.  
  234. #-----------------------------------------------------------------------------------------------
  235. +# Inform the user of the current support level for the compset they are attempting to run.
  236. +#-----------------------------------------------------------------------------------------------
  237. +my $testsforcase;
  238. +if ( $opts{'compset'} ) {
  239. + my %case;
  240. + $case{'compset'} = $opts{'compset'};
  241. + $case{'grid'} = $opts{'res'};
  242. + my $testlistobj = Testing::TestLists->new(scriptsdir => $cfgdir);
  243. + $testsforcase = $testlistobj->findTestsForCase(\%case);
  244. +} else {
  245. + $testsforcase = "WARNING!:: User compset names are NOT tested by the standard CESM process.\n" .
  246. + " Thus you may likely find that this configuration will NOT work.\n" .
  247. + " And you are completely on your own to figure out how to get it working.";
  248. +}
  249. +my $banner = '-' x 80;
  250. +print "$banner\n";
  251. +if ( defined($support_level) ) {
  252. + print "Compset and grid support levels for this case are:\n";
  253. + print "$support_level\n";
  254. +}
  255. +print "$testsforcase\n";
  256. +print "$banner";
  257. +#-----------------------------------------------------------------------------------------------
  258. # (4) Machine parameters
  259.  
  260. if ($mach =~ /(.*)_(.*)/){
  261. @@ -501,6 +540,21 @@ if (defined $opts{'confopts'}) {
  262. }
  263.  
  264. #-----------------------------------------------------------------------------------------------
  265. +# (7) Set project id
  266. +#-----------------------------------------------------------------------------------------------
  267. +
  268. +# Check for optional project; if not given, see if we can find a project to use
  269. +if ($opts{'project'}) {
  270. + $project = $opts{'project'};
  271. +}
  272. +else {
  273. + $project = ProjectTools::find_project();
  274. +}
  275. +
  276. +ProjectTools::check_project_required_but_unset($project, $cfg_ref);
  277. +ProjectTools::set_project($project, $cfg_ref);
  278. +
  279. +#-----------------------------------------------------------------------------------------------
  280. # (8) Determine pes for machine
  281. #-----------------------------------------------------------------------------------------------
  282.  
  283. @@ -532,9 +586,10 @@ if (defined $opts{'pes_file'}) {
  284. $cfg_ref->reset_setup("$pes_file");
  285. } else {
  286.  
  287. - if ($pecount =~ m!^([0-9]+)$!) {
  288. + if ($pecount =~ m!^([0-9]+)D?$!) {
  289. my $ntasks = $1;
  290. my $nthrds = 1;
  291. + my $root = 0;
  292. $decomp{NTASKS_ATM} = $ntasks; $decomp{NTHRDS_ATM} = $nthrds;
  293. $decomp{NTASKS_LND} = $ntasks; $decomp{NTHRDS_LND} = $nthrds;
  294. $decomp{NTASKS_OCN} = $ntasks; $decomp{NTHRDS_OCN} = $nthrds;
  295. @@ -543,9 +598,20 @@ if (defined $opts{'pes_file'}) {
  296. $decomp{NTASKS_ROF} = $ntasks; $decomp{NTHRDS_ROF} = $nthrds;
  297. $decomp{NTASKS_WAV} = $ntasks; $decomp{NTHRDS_WAV} = $nthrds;
  298. $decomp{NTASKS_CPL} = $ntasks; $decomp{NTHRDS_CPL} = $nthrds;
  299. - } elsif ($pecount =~ m!^([0-9]+)x([0-9]+)$!) {
  300. + if ($pecount =~ m!^([0-9]+)D$!) {
  301. + $root = 0 ; $decomp{ROOTPE_ATM} = $root;
  302. + $root = 1 * $ntasks; $decomp{ROOTPE_LND} = $root;
  303. + $root = 2 * $ntasks; $decomp{ROOTPE_OCN} = $root;
  304. + $root = 3 * $ntasks; $decomp{ROOTPE_ICE} = $root;
  305. + $root = 4 * $ntasks; $decomp{ROOTPE_GLC} = $root;
  306. + $root = 5 * $ntasks; $decomp{ROOTPE_WAV} = $root;
  307. + $root = 6 * $ntasks; $decomp{ROOTPE_ROF} = $root;
  308. + $root = 7 * $ntasks; $decomp{ROOTPE_CPL} = $root;
  309. + }
  310. + } elsif ($pecount =~ m!^([0-9]+)x([0-9]+)D?$!) {
  311. my $ntasks = $1;
  312. my $nthrds = $2;
  313. + my $root = 0;
  314. $decomp{NTASKS_ATM} = $ntasks; $decomp{NTHRDS_ATM} = $nthrds;
  315. $decomp{NTASKS_LND} = $ntasks; $decomp{NTHRDS_LND} = $nthrds;
  316. $decomp{NTASKS_OCN} = $ntasks; $decomp{NTHRDS_OCN} = $nthrds;
  317. @@ -554,6 +620,16 @@ if (defined $opts{'pes_file'}) {
  318. $decomp{NTASKS_WAV} = $ntasks; $decomp{NTHRDS_WAV} = $nthrds;
  319. $decomp{NTASKS_ROF} = $ntasks; $decomp{NTHRDS_ROF} = $nthrds;
  320. $decomp{NTASKS_CPL} = $ntasks; $decomp{NTHRDS_CPL} = $nthrds;
  321. + if ($pecount =~ m!^([0-9]+)x([0-9]+)D$!) {
  322. + $root = 0 ; $decomp{ROOTPE_ATM} = $root;
  323. + $root = 1 * $ntasks; $decomp{ROOTPE_LND} = $root;
  324. + $root = 2 * $ntasks; $decomp{ROOTPE_OCN} = $root;
  325. + $root = 3 * $ntasks; $decomp{ROOTPE_ICE} = $root;
  326. + $root = 4 * $ntasks; $decomp{ROOTPE_GLC} = $root;
  327. + $root = 5 * $ntasks; $decomp{ROOTPE_WAV} = $root;
  328. + $root = 6 * $ntasks; $decomp{ROOTPE_ROF} = $root;
  329. + $root = 7 * $ntasks; $decomp{ROOTPE_CPL} = $root;
  330. + }
  331. } else {
  332. # Need the test name with the options passed to ConfigCase->set_pes
  333. # so that if we want to exclude or include a PE layout for a test, we
  334. @@ -742,6 +818,7 @@ foreach my $xvar ( @xvars ) {
  335.  
  336. my $ccsmuser = "$ENV{'LOGNAME'}";
  337. $cfg_ref->set('CCSMUSER', "$ccsmuser");
  338. +
  339. $cfg_ref->set('CASEROOT', "$caseroot");
  340. $cfg_ref->set('CASE' , "$case");
  341. $cfg_ref->set('CCSMROOT', "$ccsmroot");
  342. @@ -776,7 +853,7 @@ my $scriptsroot = "$ccsmroot/scripts";
  343. print "Creating $caseroot $eol";
  344.  
  345. # Create relevant directories in $caseroot
  346. -my @mkdirs = qw(. SourceMods LockedFiles Buildconf Tools/XML/Lite);
  347. +my @mkdirs = qw(. SourceMods LockedFiles Buildconf Tools/XML/Lite Tools/pythonlib);
  348. foreach my $mkdir ( @mkdirs ) {
  349. $sysmod = "mkdir -p $caseroot/$mkdir";
  350. system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
  351. @@ -792,6 +869,9 @@ my @files = (
  352. "$scriptsroot/ccsm_utils/Tools/xmlchange",
  353. "$scriptsroot/ccsm_utils/Tools/xmlquery",
  354. "$scriptsroot/ccsm_utils/Tools/st_archive",
  355. + "$scriptsroot/ccsm_utils/Tools/tseries_generate.submit",
  356. + "$scriptsroot/ccsm_utils/Tools/tseries_generate.run",
  357. + "$scriptsroot/ccsm_utils/Tools/README.post_process",
  358. );
  359. foreach my $file (@files) {
  360. $sysmod = "cp -p $file $caseroot";
  361. @@ -814,6 +894,8 @@ system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
  362. "$scriptsroot/ccsm_utils/Tools/st_archive",
  363. "$scriptsroot/ccsm_utils/Tools/user_nlcreate",
  364. "$scriptsroot/ccsm_utils/Tools/user_nl_add",
  365. + "$scriptsroot/ccsm_utils/Tools/mdiag_reduce.csh",
  366. + "$scriptsroot/ccsm_utils/Tools/mdiag_reduce.pl",
  367. "$scriptsroot/ccsm_utils/Tools/timing/getTiming.csh",
  368. "$scriptsroot/ccsm_utils/Tools/timing/getTiming2.pl",
  369. "$scriptsroot/ccsm_utils/Case.template/config_definition.xml",
  370. @@ -823,7 +905,12 @@ system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
  371. "$scriptsroot/ccsm_utils/Case.template/config_archive.xsd",
  372. "$scriptsroot/ccsm_utils/Case.template/ConfigCase.pm",
  373. "$scriptsroot/ccsm_utils/Tools/SetupTools.pm",
  374. - "$scriptsroot/ccsm_utils/Tools/compare_namelists.pl",
  375. + "$scriptsroot/acme/acme_util.py",
  376. + "$scriptsroot/acme/compare_namelists",
  377. + "$scriptsroot/acme/compare_namelists.py",
  378. + "$scriptsroot/acme/simple_compare",
  379. + "$scriptsroot/acme/simple_compare.py",
  380. + "$scriptsroot/ccsm_utils/Tools/cesm_tseries_generator.py",
  381. "$machdir/taskmaker.pl",
  382. "$machdir/Makefile",
  383. "$machdir/mkSrcfiles",
  384. @@ -834,6 +921,13 @@ foreach my $file (@files) {
  385. system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
  386. }
  387.  
  388. +# Copy relevant files into $caseroot/Tools/pythonlib
  389. +@files = ("$scriptsroot/ccsm_utils/Tools/pythonlib/cesmEnvLib.py");
  390. +foreach my $file (@files) {
  391. + $sysmod = "cp -p $file $caseroot/Tools/pythonlib/.";
  392. + system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
  393. +}
  394. +
  395. # Create $case.build
  396. my $file = "${caseroot}/${case}.build";
  397. $sysmod = "cp ${caseroot}/Tools/cesm_buildstart $file";
  398. @@ -856,7 +950,7 @@ $sysmod = "cp $scriptsroot/ccsm_utils/Tools/cesm_submit $caseroot/$case.submit"
  399. system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
  400.  
  401. # Create $case.l_archive
  402. -my $sysmod = "env CCSMUSER=$ccsmuser CASE=$case CASEROOT=$caseroot env PHASE=set_larch ${machdir}/mkbatch.$mach";
  403. +my $sysmod = "env CCSMUSER=$ccsmuser CASE=$case CASEROOT=$caseroot PROJECT=$project env PHASE=set_larch ${machdir}/mkbatch.$mach";
  404. system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
  405.  
  406. # Create preview_namelist file
  407. @@ -970,6 +1064,10 @@ if(-e "$machdir/env_mach_specific.$mach" ) {
  408. system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
  409.  
  410. # Copy Depends files if they exist
  411. +if( -e "$machdir/Depends.$mach.$compiler" ) {
  412. + $sysmod = "cp $machdir/Depends.$mach.$compiler $caseroot/";
  413. + system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
  414. +}else{
  415. if( -e "$machdir/Depends.$mach" ) {
  416. $sysmod = "cp $machdir/Depends.$mach $caseroot/";
  417. system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
  418. @@ -978,6 +1076,16 @@ if( -e "$machdir/Depends.$compiler" ) {
  419. $sysmod = "cp $machdir/Depends.$compiler $caseroot/";
  420. system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
  421. }
  422. +}
  423. +
  424. +# The following creates mach_syslog
  425. +if( -e "$machdir/syslog.$mach" ) {
  426. + $sysmod = "cp $machdir/syslog.$mach $caseroot/Tools/mach_syslog";
  427. + system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
  428. +}else{
  429. + $sysmod = "cp $machdir/syslog.generic $caseroot/Tools/mach_syslog";
  430. + system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
  431. +}
  432.  
  433. # Write the xml files
  434. $cfg_ref->write_file("$caseroot/env_case.xml" , "xml");
  435. @@ -991,6 +1099,15 @@ print "Created $caseroot/env_run.xml \n";
  436. $cfg_ref->write_file("$caseroot/env_archive.xml" , "xml", "$scriptsroot/ccsm_utils/Case.template");
  437. print "Created $caseroot/env_archive.xml \n";
  438.  
  439. +# set the default to not archive performance data and associated provenance
  440. +if ($opts{'nosavetiming'}) {
  441. + my $cwd = getcwd(); # current working directory
  442. + chdir "$caseroot";
  443. + $sysmod = './xmlchange -file env_run.xml -id SAVE_TIMING -val "FALSE"';
  444. + system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
  445. + chdir "$cwd";
  446. +}
  447. +
  448. # Copy env_case.xml in to locked files
  449. $sysmod = "cp $caseroot/env_case.xml $caseroot/LockedFiles/env_case.xml.locked";
  450. system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
  451. @@ -1061,7 +1178,20 @@ if ( defined($user_mods_dir) ) {
  452. }
  453.  
  454. #-----------------------------------------------------------------------------------------------
  455. -# (11) Create $caseroot run setup scripts (other than batch)
  456. +# (11) check that the pyreshaper tool is installed in the inputdata location on the machine
  457. +#-----------------------------------------------------------------------------------------------
  458. +
  459. +#my $cmd = "module load python";
  460. +#system($cmd) == 0 or warn "WARNING: unable to execute '$cmd'";
  461. +#$cmd = "module load all-python-libs";
  462. +#system($cmd) == 0 or warn "WARNING: unable to execute '$cmd'";
  463. +#$cmd = "pushd $ccsmroot/tools/pyReshaper";
  464. +#system($cmd) == 0 or warn "WARNING: unable to execute '$cmd'";
  465. +#$cmd = "python setup.py install --
  466. +
  467. +
  468. +#-----------------------------------------------------------------------------------------------
  469. +# (12) Create $caseroot run setup scripts (other than batch)
  470. #-----------------------------------------------------------------------------------------------
  471.  
  472. print "Successfully created the case for $mach \n";
  473. @@ -1237,6 +1367,7 @@ sub set_compset
  474. my $compset_shortname= $compset;
  475. my $compset_aliasname= $compset;
  476.  
  477. + my $support_level = undef;
  478. my $desc_comp = "";
  479. my $desc_grid = "";
  480. my $temp;
  481. @@ -1257,12 +1388,13 @@ sub set_compset
  482. NAME:
  483. while ( my $e = shift @e ) {
  484. $found = 0;
  485. - my $sname, my $alias; my $lname;
  486. + my $sname, my $alias; my $lname; my $support;
  487. $lname = clean($e->get_text());
  488. %attr = $e->get_attributes();
  489. if ($attr{'sname'}) {
  490. $sname = clean($attr{'sname'});
  491. if ($attr{'alias'}) {$alias = clean($attr{'alias'})};
  492. + if ($attr{'support_level'}) {$support = clean($attr{'support_level'})};
  493. } else {
  494. die "set_compset: config_compsets.xml must have COMPSET element and SNAME attribute \n";
  495. }
  496. @@ -1270,6 +1402,9 @@ NAME:
  497. $compset_longname = $lname;
  498. $compset_shortname = $sname;
  499. $compset_aliasname = $alias;
  500. + if ( $support ) {
  501. + $support_level .= "Compset ($sname): $support\n";
  502. + }
  503. $temp = $lname . $sname;
  504. $cfg_ref->set('CCSM_COMPSET' , "$lname");
  505. $cfg_ref->set('CCSM_LCOMPSET', "$lname");
  506. @@ -1292,7 +1427,7 @@ NAME:
  507.  
  508. my $atm_grid, my $lnd_grid, my $ice_grid, my $ocn_grid;
  509. my $rof_grid, my $glc_grid, my $wav_grid;
  510. - my $cism_grid, my $mask_grid;
  511. + my $mask_grid;
  512.  
  513. # first determine if there is any compset attribute for this grid
  514. $found = 0;
  515. @@ -1300,14 +1435,18 @@ NAME:
  516. NAME:
  517. @e = $xml_grid->elements_by_name( "GRID" );
  518. while ( my $e = shift @e ) {
  519. - my $sname, my $alias;
  520. + my $sname, my $alias; my $support;
  521. my $lname = clean($e->get_text());
  522. my %attr = $e->get_attributes();
  523. $sname = clean($attr{'sname'});
  524. $alias = clean($attr{'alias'});
  525. + $support = clean($attr{'support_level'});
  526. if ($grid =~ /$lname/ || $grid eq $sname || $grid eq $alias) {
  527. if ($attr{'compset'}) {
  528. if ($compset_longname =~ /$attr{'compset'}/) {
  529. + if ( $support ) {
  530. + $support_level .= "Grid ($sname): $support\n";
  531. + }
  532. $grid_longname = $lname;
  533. $grid_shortname = $sname;
  534. $grid_aliasname = $alias;
  535. @@ -1322,16 +1461,20 @@ NAME:
  536. if ($found == 0) {
  537. @e = $xml_grid->elements_by_name( "GRID" );
  538. while ( my $e = shift @e ) {
  539. - my $sname, my $alias;
  540. + my $sname, my $alias; my $support;
  541. my $lname = clean($e->get_text());
  542. my %attr = $e->get_attributes();
  543. $sname = clean($attr{'sname'});
  544. $alias = clean($attr{'alias'});
  545. + $support = clean($attr{'support_level'});
  546. if ($grid =~ /$lname/ || $grid eq $sname || $grid eq $alias) {
  547. if ($attr{'compset'}) {
  548. # do nothing
  549. } else {
  550. print " grid longname is $grid_longname \n";
  551. + if ( $support ) {
  552. + $support_level .= "Grid ($sname): $support\n";
  553. + }
  554. $grid_longname = $lname;
  555. $grid_shortname = $sname;
  556. $grid_aliasname = $alias;
  557. @@ -1351,15 +1494,12 @@ NAME:
  558. }
  559.  
  560. $grid_longname =~ /(a%)(.+)(_l%)/ ; $atm_grid = $2;
  561. - $grid_longname =~ /(l%)(.+)(_oi%)/; $lnd_grid = $2; $glc_grid = $2;
  562. + $grid_longname =~ /(l%)(.+)(_oi%)/; $lnd_grid = $2;
  563. $grid_longname =~ /(oi%)(.+)(_r%)/; $ocn_grid = $2; $ice_grid = $2;
  564. $grid_longname =~ /(r%)(.+)(_m%)/ ; $rof_grid = $2;
  565. $grid_longname =~ /(m%)(.+)(_g%)/ ; $mask_grid = $2;
  566. - $grid_longname =~ /(g%)(.+)(_w%)/ ; $cism_grid = $2;
  567. + $grid_longname =~ /(g%)(.+)(_w%)/ ; $glc_grid = $2;
  568. $grid_longname =~ /(w%)(.+)$/ ; $wav_grid = $2;
  569. - if ($cism_grid ne 'null') {
  570. - $cfg_ref->set('CISM_GRID',$cism_grid);
  571. - }
  572.  
  573. # ========================================================
  574. # check that compset is supported for target grid
  575. @@ -1391,7 +1531,7 @@ NAME:
  576.  
  577. @e = $xml_grid->elements_by_name( "gridhorz" );
  578. while ( my $e = shift @e ) {
  579. - my $nx, my $ny;
  580. + my $nx, my $ny; my $support;
  581. my %attr = $e->get_attributes();
  582. my $hgrid = clean($attr{'name'});
  583. my $alias = clean($attr{'alias'});
  584. @@ -1401,8 +1541,14 @@ NAME:
  585. my $name = clean($child->get_name());
  586. if ($name eq 'nx') {$nx = $val;}
  587. if ($name eq 'ny') {$ny = $val;}
  588. + if ($name eq 'support_level') {$support = $val;}
  589. + # WARNING!!!:: THE LOGIC HERE IS DEPENDENT ON THE ORDER OF THE FIELDS WITHIN
  590. + # EACH gridhorz FIELD desc MUST BE LAST!
  591. if ($name eq 'desc') {
  592. if ($grid_longname =~ /$hgrid/) {
  593. + if ( $support ) {
  594. + $support_level .= "Grid ($hgrid): $support\n";
  595. + }
  596. if ($desc_grid =~ m/$val/) {
  597. # do nothing
  598. } else {
  599. @@ -1448,11 +1594,9 @@ NAME:
  600. if ($mask_grid eq $hgrid) {
  601. $cfg_ref->set('MASK_GRID',$gridname);
  602. }
  603. - if ($cism_grid eq $hgrid) {
  604. - $cfg_ref->set('CISM_GRID',$gridname);
  605. - }
  606. }
  607.  
  608. +
  609. my $atm_grid = $cfg_ref->get('ATM_GRID');
  610. my $lnd_grid = $cfg_ref->get('LND_GRID');
  611. my $ocn_grid = $cfg_ref->get('OCN_GRID');
  612. @@ -1614,7 +1758,7 @@ NAME:
  613. my $newval = $val;
  614.  
  615. # For OCN_TRACER_MODULES want to merge, not replace, options.
  616. - if ($name =~ m/OCN_TRACER_MODULES/) {
  617. + if ($name eq "OCN_TRACER_MODULES") {
  618. my $curval = $cfg_ref->get($id);
  619. if ($val =~ /$curval/) {
  620. #do nothing
  621. @@ -1759,11 +1903,6 @@ NAME:
  622. $nxw = $cfg_ref->get('WAV_NX'); $nyw= $cfg_ref->get('WAV_NY');
  623. $grw = $cfg_ref->get('WAV_GRID');
  624.  
  625. - if ($compset_longname =~ /CISM/) {
  626. - $grid = $cfg_ref->get('CISM_GRID');
  627. - print " CISM_GRID = $grid \n";
  628. - }
  629. -
  630. # output to standard out
  631. print "Component set: longname (shortname) (alias) \n";
  632. if ($compset_aliasname) {
  633. @@ -1819,7 +1958,7 @@ NAME:
  634. print $fh " $id: $newout{$id} \n";
  635. }
  636.  
  637. - return ($compset_longname, $compset_shortname, $grid_longname, $grid_shortname);
  638. + return ($compset_longname, $compset_shortname, $grid_longname, $grid_shortname, $support_level);
  639. }
  640.  
  641. #-------------------------------------------------------------------------------
  642. @@ -2033,61 +2172,61 @@ sub list_grids
  643. $name eq "config_compset" or die
  644. "file $grid_file is not a horizontal grid parameters file\n";
  645.  
  646. - # Naming convention
  647. - my @e = $xml->elements_by_name( "help" );
  648. - while ( my $e = shift @e ) {
  649. - my $text = clean($e->get_text());
  650. - print "$text \n\n";
  651. + # Naming convention
  652. + my @e = $xml->elements_by_name( "help" );
  653. + while ( my $e = shift @e ) {
  654. + my $text = clean($e->get_text());
  655. + print "$text \n\n";
  656. + }
  657. + print "\n";
  658. + # Component grids
  659. + print "======================================================\n";
  660. + print ("Component Grids: name\t(alias)\t(desc)\t(nx)\t(ny) \n");
  661. + print "======================================================\n";
  662. + my @e = $xml->elements_by_name( "gridhorz" );
  663. + my %a = ();
  664. + while ( my $e = shift @e ) {
  665. + my %attr = $e->get_attributes();
  666. + my $hgrid = clean($attr{'name'});
  667. + my $alias = clean($attr{'alias'});
  668. + my $gridname;
  669. + printf " %-20s ", $hgrid;
  670. + foreach my $item ( "alias" ) {
  671. + if ($attr{$item}) {
  672. + print " ($item: $attr{$item})";
  673. + }
  674. }
  675. - print "\n";
  676. - # Component grids
  677. - print "======================================================\n";
  678. - print ("Component Grids: name\t(alias)\t(desc)\t(nx)\t(ny) \n");
  679. - print "======================================================\n";
  680. - my @e = $xml->elements_by_name( "gridhorz" );
  681. - my %a = ();
  682. - while ( my $e = shift @e ) {
  683. - my %attr = $e->get_attributes();
  684. - my $hgrid = clean($attr{'name'});
  685. - my $alias = clean($attr{'alias'});
  686. - my $gridname;
  687. - printf " %-20s ", $hgrid;
  688. - foreach my $item ( "alias" ) {
  689. - if ($attr{$item}) {
  690. - print " ($item: $attr{$item})";
  691. - }
  692. - }
  693. - my @children = $e->get_children();
  694. - my %elements = undef;
  695. - foreach my $child (@children) {
  696. - my $name = clean($child->get_name());
  697. - $elements{$name} = clean($child->get_text());
  698. - }
  699. - foreach my $item ( "desc", "nx", "ny" ) {
  700. - if ($elements{$item}) {
  701. - print " ($item: $elements{$item})";
  702. - }
  703. - }
  704. - print " \n";
  705. + my @children = $e->get_children();
  706. + my %elements = undef;
  707. + foreach my $child (@children) {
  708. + my $name = clean($child->get_name());
  709. + $elements{$name} = clean($child->get_text());
  710. + }
  711. + foreach my $item ( "desc", "nx", "ny", "support_level" ) {
  712. + if ($elements{$item}) {
  713. + print " ($item: $elements{$item})";
  714. + }
  715. }
  716. - print (" \n");
  717. - # Model grids
  718. - print "======================================================\n";
  719. - print ("Model Grids: name\t(alias)\t(compset) \n");
  720. - print "======================================================\n";
  721. - my @e = $xml->elements_by_name( "GRID" );
  722. - while ( my $e = shift @e ) {
  723. - my %attr = $e->get_attributes();
  724. - my $text = clean($e->get_text());
  725. - printf "%s %-87s ", "model grid: ", $text;
  726. - foreach my $item ( "alias", "compset" ) {
  727. - if ($attr{$item}) {
  728. - print " ($item: $attr{$item})";
  729. - }
  730. - }
  731. - print "\n";
  732. - }
  733. print " \n";
  734. + }
  735. + print (" \n");
  736. + # Model grids
  737. + print "======================================================\n";
  738. + print ("Model Grids: name\t(alias)\t(compset) \n");
  739. + print "======================================================\n";
  740. + my @e = $xml->elements_by_name( "GRID" );
  741. + while ( my $e = shift @e ) {
  742. + my %attr = $e->get_attributes();
  743. + my $text = clean($e->get_text());
  744. + printf "%s %-87s ", "model grid: ", $text;
  745. + foreach my $item ( "alias", "compset", "support_level" ) {
  746. + if ($attr{$item}) {
  747. + print " ($item: $attr{$item})";
  748. + }
  749. + }
  750. + print "\n";
  751. + }
  752. + print " \n";
  753.  
  754.  
  755. }
  756. @@ -2120,8 +2259,10 @@ sub list_compsets
  757. my $text = clean($e->get_text());
  758. printf("alias: %-25s shortname: %-50s \n",
  759. clean($attr{'alias'}),clean($attr{'sname'}));
  760. - printf(" longname: %-96s \n",
  761. - clean($text));
  762. + printf(" longname: %-96s \n", clean($text) );
  763. + if ( $attr{'support_level'} ) {
  764. + printf(" support_level: %-96s \n", clean($attr{'support_level'}) );
  765. + }
  766. }
  767. print " \n";
  768. my @e = $xml_comp->elements_by_name( "help" );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement