Skip to content

Commit

Permalink
sort sets before writing to files to ease comparison between runs
Browse files Browse the repository at this point in the history
  • Loading branch information
Courtney Peverley committed Nov 7, 2023
1 parent 99cae9f commit a722da8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions scripts/ccpp_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ def write_var_set_loop(ofile, varlist_name, var_list, indent,
ofile.write("allocate({}({}))".format(varlist_name, len(var_list)),
indent)
# end if
for ind, var in enumerate(var_list):
for ind, var in enumerate(sorted(var_list)):
if start_var:
ind_str = "{} + {}".format(start_var, ind + start_index)
else:
Expand Down Expand Up @@ -1136,7 +1136,7 @@ def write_req_vars_sub(self, ofile, errmsg_name, errcode_name):
ofile.write("\nsubroutine {}({})".format(API.__vars_fname, inargs), 1)
# Declare use statements for suite varlist routines
mlen = max([len(x.module) for x in self.suites])
for suite in self.suites:
for suite in sorted(self.suites):
mod = f"{suite.module}{' '*(mlen - len(suite.module))}"
ofile.write(f"use {mod}, only: {suite.req_vars_subname()}", 2)
# end for
Expand Down
4 changes: 2 additions & 2 deletions scripts/host_cap.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ def write_host_cap(host_model, api, module_name, output_dir, run_env):
mlen = max([len(x.module) for x in api.suites])
maxmod = max(maxmod, mlen)
maxmod = max(maxmod, len(CONST_DDT_MOD))
for mod in modules:
for mod in sorted(modules):
mspc = (maxmod - len(mod[0]))*' '
cap.write("use {}, {}only: {}".format(mod[0], mspc, mod[1]), 1)
# End for
Expand Down Expand Up @@ -530,7 +530,7 @@ def write_host_cap(host_model, api, module_name, output_dir, run_env):
for suite in api.suites:
mspc = (max_suite_len - len(suite.module))*' '
spart_list = suite_part_list(suite, stage)
for spart in spart_list:
for spart in sorted(spart_list):
stmt = "use {}, {}only: {}"
cap.write(stmt.format(suite.module, mspc, spart.name), 2)
# End for
Expand Down
6 changes: 3 additions & 3 deletions scripts/suite_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -1787,7 +1787,7 @@ def write(self, outfile, host_arglist, indent, const_mod,
# end if
# Write out the scheme use statements
scheme_use = 'use {},{} only: {}'
for scheme in self._local_schemes:
for scheme in sorted(self._local_schemes):
smod = scheme[0]
sname = scheme[1]
slen = ' '*(modmax - len(smod))
Expand Down Expand Up @@ -1853,7 +1853,7 @@ def write(self, outfile, host_arglist, indent, const_mod,
'funcname' : self.name})
# Allocate local arrays
alloc_stmt = "allocate({}({}))"
for lname in allocatable_var_set:
for lname in sorted(allocatable_var_set):
var = subpart_vars[lname][0]
dims = var.get_dimensions()
alloc_str = self.allocate_dim_str(dims, var.context)
Expand Down Expand Up @@ -1886,7 +1886,7 @@ def write(self, outfile, host_arglist, indent, const_mod,
item.write(outfile, errcode, indent + 1)
# end for
# Deallocate local arrays
for lname in allocatable_var_set:
for lname in sorted(allocatable_var_set):
outfile.write('deallocate({})'.format(lname), indent+1)
# end for
# Deallocate suite vars
Expand Down

0 comments on commit a722da8

Please sign in to comment.