Repository navigation
Split cism_parallel and glissade_velo_higher_pcg into modules by theme - #113
Open
whlipscomb wants to merge 10 commits into
Open
whlipscomb wants to merge 10 commits into
whlipscomb wants to merge 10 commits into
Conversation
distributed_get_var_real4_1d, distributed_get_var_real8_1d, distributed_put_var_real4_1d and distributed_put_var_real8_1d look up the ids of x0, y0, x1 and y1 to choose the bounds of the variable being read or written. When a variable is missing from the file (x0 and y0 often are), nf90_inq_varid does not set its id, which was left uninitialized. If the stale value happened to equal the id of the variable being read, the wrong branch was taken. The Greenland 4 km run then failed when reading x1 from the geothermal-flux file (NetCDF: Start+count exceeds dimension bound) after the cism_parallel split changed the stack contents. The ids are now set to -1 (never a valid id) before the lookups. No answer changes for runs that worked before (the same branches are taken). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
First step in splitting cism_parallel.F90 (11969 lines) into modules by theme. cism_parallel_core holds what every other part needs: - the parallel_type and the shared variables (communicator, ranks, halo widths); - MPI setup and shutdown (parallel_initialise, parallel_set_info, parallel_finalise), parallel_barrier, parallel_stop, not_parallel; - the index utilities (parallel_globalID, parallel_globalindex, distributed_owner, ...), parallel_boundary(_value) and parallel_convert_haloed_to_nonhaloed. cism_parallel uses cism_parallel_core, and everything in it is public, so callers still get these names through cism_parallel; no other file changes. The procedures, interfaces and declarations are moved unchanged (checked with a script: each appears verbatim exactly once). No answer changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cism_parallel_broadcast holds the broadcast interface and its eleven specific procedures. It uses cism_parallel_core. The procedures and interfaces are moved unchanged (checked with a script: each appears verbatim exactly once). cism_parallel uses the new module, so callers still get these names through cism_parallel; no other file changes. No answer changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cism_parallel_reduce holds the global sums (parallel_global_sum, parallel_global_sum_patch, parallel_global_sum_stagger), the reductions (parallel_reduce_sum, _max, _min, _maxloc, _minloc, including the reproducible sum), parallel_is_zero and parallel_show_minmax. It uses cism_parallel_core and cism_reprosum_mod. The procedures and interfaces are moved unchanged (checked with a script: each appears verbatim exactly once). cism_parallel uses the new module, so callers still get these names through cism_parallel; no other file changes. No answer changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cism_parallel_halo holds parallel_halo, parallel_halo_extrapolate, parallel_halo_tracers, parallel_halo_verify (with DEBUG_LEVEL), staggered_parallel_halo and staggered_parallel_halo_extrapolate, and the utilities that call them: parallel_convert_nonhaloed_to_haloed, parallel_global_edge_mask and staggered_no_penetration_mask. It uses cism_parallel_core. The procedures and interfaces are moved unchanged (checked with a script: each appears verbatim exactly once). cism_parallel uses the new module, so callers still get these names through cism_parallel; no other file changes. No answer changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…her_scatter cism_parallel_gather_scatter holds gather_var (and the row, column and gather_all variants), scatter_var (and row and column variants), the distributed reads and writes (distributed_get_var, distributed_put_var), distributed_print and parallel_print, the fc_gather routines, get_bounds_info with the private bounds_info_type, and the work arrays d_gs_mybounds, d_gs_bounds and max_gather_block_size. It uses cism_parallel_core and cism_parallel_broadcast. The procedures and interfaces are moved unchanged (checked with a script: each appears verbatim exactly once). cism_parallel uses the new module, so callers still get these names through cism_parallel; no other file changes. No answer changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cism_parallel_netcdf holds the netCDF wrappers in which the main task does the I/O and broadcasts the result: parallel_create, _open, _close, _sync, _redef, _enddef, _def_dim, _def_var, _inq_*, _inquire*, _get_att, _put_att, _get_var and _put_var. It uses cism_parallel_core and cism_parallel_broadcast. The procedures and interfaces are moved unchanged (checked with a script: each appears verbatim exactly once). cism_parallel uses the new module, so callers still get these names through cism_parallel; no other file changes. No answer changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…_decomp cism_parallel_decomp holds distributed_grid, distributed_grid_active_blocks, distributed_print_grid, parallel_localindex, parallel_create_comm_row, parallel_create_comm_col and parallel_test_comm_row_col. These call the broadcast, reduction and gather/scatter modules, so this module comes last. The procedures are moved unchanged. cism_parallel.F90 now holds only the use statements for the seven modules, with a comment listing what each contains. The module-level use statements it no longer needs (netcdf, glimmer_global, glimmer_paramets, cism_reprosum_mod) and the empty contains section are removed; no caller imports those names through cism_parallel. No answer changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
glissade_velo_higher_pcg.F90 (5900 lines) is split in two: - glissade_velo_higher_pcg_2d: the 2D solvers (standard and Chronopoulos-Gear), their diagonal and tridiagonal preconditioners, the 2D tridiagonal solvers and the 2D matrix-vector multiply - glissade_velo_higher_pcg_3d: the 3D solvers, their preconditioners (diagonal, SIA, local and global tridiagonal), the 3D tridiagonal solvers, the 3D matrix-vector multiply, easy_sia_solver and tridiag_solver The subroutines are moved unchanged. The 3D tridiagonal preconditioner setups and solvers call their 2D counterparts, so those four routines are public in the 2D module. glissade_velo_higher uses both modules. No answer changes (dome on 4 tasks with DIVA and Blatter-Pattyn, pcg and pcg_chrongear, and every preconditioner: BFB with the previous executable). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 27, 2026
…es from the review of #99 The fixes for the issues found in Kate's review of #99, first made in #114, were added at the end of the #99 branch (lipscomb/lateral_melt). This merge carries them forward to this branch; it brings in no other changes. Answers change only for lateral melt (lateral_melt_method = ismip), as in #114. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
whlipscomb
added a commit
that referenced
this pull request
Dec 2, 2026
…ow in #99 The lateral melt fixes from the review of #99, first made in this PR, are now at the end of the #99 branch (lipscomb/lateral_melt) and are carried forward through #100-#113 by a merge commit in each. This merge brings that version of #113 into this branch. Its tree is identical to the previous tip of this branch, so this PR no longer changes anything relative to #113. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Branch:
lipscomb/split_modules(9 commits, 1d98aad..7a9308a, plus the merge commit ffce0d9)Base:
lipscomb/rename_dirs_modules(#112). Stacked; the base will be changed tomainafter the earlier PRs are merged.CISM-wrapper: no change needed (the wrapper's code does not use
cism_parallel, andbuildlibruns CISM's CMake, which finds the new files).Update (December 2026): one merge commit at the end of this branch (ffce0d9) brings in the lateral melt fixes from the review of #99, which are now at the end of the #99 branch (they were first made in #114, which no longer changes anything). It changes nothing else in this PR.
Summary
Two long modules are split into shorter ones by theme. The code is moved, not changed; there are no answer changes. One pre-existing bug, found while testing, is fixed first.
distributed_get_var/distributed_put_varroutines used uninitialized netCDF ids.cism_parallel(11969 lines) becomes seven modules (972397e..2774976).cism_parallelitself only uses them, so no caller changes.glissade_velo_higher_pcg(5900 lines) becomes a 2D and a 3D module (7a9308a).Fix: uninitialized ids in the 1D distributed reads and writes
distributed_get_var_real4_1d,distributed_get_var_real8_1d,distributed_put_var_real4_1danddistributed_put_var_real8_1dlook up the ids ofx0,y0,x1andy1to choose the bounds of the variable being read or written. When one of these is missing from the file (x0andy0often are),nf90_inq_variddoes not set its id, which was left uninitialized. If the stale value happened to equal the id of the variable being read, the wrong branch was taken. After the split moved code around, the Greenland 4 km run stopped when readingx1from the geothermal-flux file ("NetCDF: Start+count exceeds dimension bound"). The ids are now set to -1, never a valid id, before the lookups. Runs that worked before take the same branches, so their answers do not change.The fix is committed before the split, so it can be reviewed on its own.
cism_parallel
cism_parallel_coreparallel_typeand the shared variables (communicator, ranks, halo widths); MPI setup and shutdown;parallel_barrier,parallel_stop; global and local index utilities;parallel_boundary(_value);parallel_convert_haloed_to_nonhaloedcism_parallel_broadcastbroadcastcism_parallel_reduceparallel_global_sum(_patch, _stagger),parallel_reduce_*(incl. the reproducible sum),parallel_is_zero,parallel_show_minmaxcism_parallel_haloparallel_halo(_extrapolate, _tracers, _verify),staggered_parallel_halo(_extrapolate), and the utilities that call them (parallel_convert_nonhaloed_to_haloed,parallel_global_edge_mask,staggered_no_penetration_mask)cism_parallel_gather_scattergather_varandscatter_var(and row/column variants),distributed_get_var,distributed_put_var,distributed_print,parallel_print, thefc_gatherroutinescism_parallel_netcdfcism_parallel_decompdistributed_grid,distributed_grid_active_blocks,distributed_print_grid,parallel_localindex) and the row and column communicatorscism_paralleluseof the seven modules, with a comment listing their contentsThe grouping follows the calls between procedures: each module calls only modules above it in the table. Everything in these modules is public, as it was in
cism_parallel, souse cism_parallel, only: ...works as before. All 58 files that usecism_parallelimport only names defined in it, so the module-levelusestatements thatcism_parallelno longer needs (netcdf,glimmer_global, ...) are removed.There is one commit per new module. Each moves procedures, generic interfaces and module-level declarations unchanged; a script checked that all 185 procedures and 36 interfaces appear exactly once, verbatim, in the new files.
git log -p --color-movedshows the moves.glissade_velo_higher_pcg
glissade_velo_higher_pcg_2d(git mvof the old file, so history follows): the 2D solvers (standard and Chronopoulos-Gear), their diagonal and tridiagonal preconditioners, the 2D tridiagonal solvers and the 2D matrix-vector multiply.glissade_velo_higher_pcg_3d: the 3D solvers, their preconditioners (diagonal, SIA, local and global tridiagonal), the 3D tridiagonal solvers, the 3D matrix-vector multiply,easy_sia_solverandtridiag_solver.The 3D tridiagonal preconditioner setups and solvers call their 2D counterparts, so those four routines are public in the 2D module and the 3D module uses it.
glissade_velo_higheruses both. The 19 subroutines are moved unchanged (checked with a script).Testing
cism_parallelcommits were first tested before the fix was added below them; after it was added, the fix commit, the tip of thecism_parallelsplit and the tip were tested again.)reproducible_sums = .true., after thecism_parallelsplit: BFB with Rename libglimmer, libglimmer-solve and two basal modules; merge the isostasy modules #112's tip (the standalone suite uses the default,.false.; CESM uses.true.).pcgandpcg_chrongear, and every preconditioner: 18 runs, all BFB with the commit before the PCG split.cism_parallelsplit and at the tip: BFB with the R1 originals; logs identical to Rename libglimmer, libglimmer-solve and two basal modules; merge the isostasy modules #112's.--compare alpha11e_stage1) at the tip of thecism_parallelsplit and at the tip: all PASS (namelist comparison excepted, as for R4).Commits
🤖 Generated with Claude Code