Skip to content

Brown Oscar Python module and mako file update#1352

Draft
mrodrig6 wants to merge 75 commits intoMFlowCode:masterfrom
ComputationalFlowGroup:merger
Draft

Brown Oscar Python module and mako file update#1352
mrodrig6 wants to merge 75 commits intoMFlowCode:masterfrom
ComputationalFlowGroup:merger

Conversation

@mrodrig6
Copy link
Copy Markdown
Member

@mrodrig6 mrodrig6 commented Apr 3, 2026

Description

Summarize your changes and the motivation behind them.

Fixes #(issue)

Type of change

  • [x ] Bug fix
  • [x ] Other: Updated the python module for Brown's Oscar cluster and updated the mako file to handle batch scripts

Testing

How did you test your changes?
Checked that MFC compiles on Oscar and ran both interactive and batch runs on the system up to 1 node (max limit)

Checklist

N/A

AI code reviews

Reviews are not triggered automatically. To request a review, comment on the PR:

@qodo-code-review
Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Add Purdue Anvil support and update Oscar configuration

✨ Enhancement 📦 Other

Grey Divider

Walkthroughs

Description
• Added Purdue Anvil supercomputer support with mako template
• Updated Oscar module configuration and batch script handling
• Modified Oscar mako to use srun instead of mpirun
• Added memory allocation and Python version updates for Oscar
Diagram
flowchart LR
  A["Bootstrap System Selection"] -->|Add Anvil| B["modules.sh"]
  C["Oscar Configuration"] -->|Update Modules| D["toolchain/modules"]
  C -->|Update Batch Script| E["oscar.mako"]
  F["New Anvil Support"] -->|Create Template| G["anvil.mako"]
  D --> H["Enhanced HPC Setup"]
  E --> H
  G --> H
Loading

Grey Divider

File Changes

1. toolchain/bootstrap/modules.sh ✨ Enhancement +2/-1

Add Purdue Anvil to system selection menu

• Fixed spacing in Brown Oscar system selection message
• Added Purdue Anvil (pa) to the list of available systems
• Updated user prompt to include new Anvil option

toolchain/bootstrap/modules.sh


2. toolchain/templates/anvil.mako ✨ Enhancement +50/-0

New Purdue Anvil batch script template

• Created new mako template for Purdue Anvil supercomputer
• Configured SBATCH directives for batch job submission
• Integrated module loading with GPU/CPU selection
• Implemented MPI execution using mpirun for parallel jobs

toolchain/templates/anvil.mako


3. toolchain/templates/oscar.mako ✨ Enhancement +2/-1

Update Oscar to use srun and add memory allocation

• Added memory allocation directive (#SBATCH --mem-per-cpu=4g)
• Replaced mpirun with srun for job execution
• Updated batch script to use SLURM's srun command

toolchain/templates/oscar.mako


View more (1)
4. toolchain/modules ⚙️ Configuration changes +9/-1

Add Anvil modules and update Oscar Python version

• Updated Oscar Python version from 3.13.10s to 3.13.5
• Added complete Purdue Anvil module configuration (pa)
• Configured Anvil with gcc, openmpi, python, fftw, and cmake
• Set PYTHONPATH environment variable for Anvil

toolchain/modules


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown
Contributor

qodo-code-review bot commented Apr 3, 2026

Code Review by Qodo

🐞 Bugs (4) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX Issues (0)

Grey Divider


Action required

1. MPI task count dropped 🐞 Bug ≡ Correctness
Description
In toolchain/templates/oscar.mako the MPI path now invokes plain "srun" without using
nodes*tasks_per_node, so the configured task count no longer influences how many ranks are launched.
This can under-launch MPI ranks and make MPI runs behave differently than intended for the same
nodes/tasks_per_node settings.
Code

toolchain/templates/oscar.mako[R44-47]

    % else:
        (set -x; ${profiler}                              \
-            mpirun -np ${nodes*tasks_per_node}            \
+            srun                                          \
                   "${target.get_install_binpath(case)}")
Evidence
The Oscar template’s MPI branch no longer references tasks_per_node/nodes when launching the binary,
calling only srun (oscar.mako). Other Slurm-oriented templates in this repo explicitly pass the
intended task count to srun via --ntasks ${nodes*tasks_per_node} (delta.mako, default.mako), which
preserves the meaning of nodes/tasks_per_node at execution time.

toolchain/templates/oscar.mako[30-55]
toolchain/templates/delta.mako[40-59]
toolchain/templates/default.mako[25-66]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Oscar’s batch template switched from `mpirun -np ${nodes*tasks_per_node}` to `srun` but no longer passes any task-count arguments derived from `nodes`/`tasks_per_node`. As a result, the configured MPI size is not enforced by the launcher.

## Issue Context
Other Slurm templates in this repo that use `srun` explicitly pass `--ntasks ${nodes*tasks_per_node}`.

## Fix Focus Areas
- toolchain/templates/oscar.mako[42-48]

## Suggested fix
Update the MPI branch to something like:
- `srun --ntasks ${nodes*tasks_per_node} "${target.get_install_binpath(case)}"`

(Optionally also align the SBATCH header to consistently use `--ntasks-per-node=${tasks_per_node}` if that’s the intended directive for this cluster.)

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Partition SBATCH is commented 🐞 Bug ≡ Correctness
Description
In toolchain/templates/anvil.mako the partition directive is written as "##SBATCH", so it is treated
as a comment even when partition is provided. This makes user-specified partitions ineffective and
can lead to jobs scheduling on the wrong/default partition or not scheduling as expected.
Code

toolchain/templates/anvil.mako[R11-13]

+% if partition:
+##SBATCH --partition=${partition}
+% endif
Evidence
The Anvil template conditionally emits ##SBATCH --partition=${partition}, which will not be
interpreted as an SBATCH directive. Other templates in this repo emit the partition directive with a
single leading #SBATCH under the same condition (delta.mako).

toolchain/templates/anvil.mako[5-16]
toolchain/templates/delta.mako[5-16]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The Anvil batch template uses `##SBATCH --partition=...`, which comments out the partition directive even when the user provides a partition.

## Issue Context
This causes the `partition` CLI/template variable to have no effect.

## Fix Focus Areas
- toolchain/templates/anvil.mako[11-13]

## Suggested fix
Change `##SBATCH --partition=${partition}` to `#SBATCH --partition=${partition}`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

3. Anvil GPU mode misconfigured 🐞 Bug ☼ Reliability
Description
toolchain/templates/anvil.mako selects module mode "-m g" when gpu_enabled is true, but
toolchain/modules defines no pa-gpu stanza, and the batch header requests no GPU resources. This
makes GPU-enabled runs on Anvil inconsistent (GPU toolchain/modules not loaded and no GPUs
requested).
Code

toolchain/templates/anvil.mako[R28-31]

+ok ":) Loading modules:\n"
+cd "${MFC_ROOT_DIR}"
+. ./mfc.sh load -c pa -m ${'g' if gpu_enabled else 'c'}
+cd - > /dev/null
Evidence
The Anvil template’s module load line switches between -m g and -m c based on gpu_enabled
(anvil.mako). The module loader translates -m g into selecting the *-gpu stanza (modules.sh sets
cg='gpu' and loads $u_c-$cg), but toolchain/modules only defines pa-cpu/pa-all and no
pa-gpu, so there is no GPU-specific environment for Anvil to load. Additionally, unlike other
GPU-capable templates, anvil.mako contains no gpu_enabled SBATCH directives (e.g.,
--gres/--gpus-per-node) to actually allocate GPUs.

toolchain/templates/anvil.mako[5-33]
toolchain/bootstrap/modules.sh[69-114]
toolchain/modules[66-79]
toolchain/templates/delta.mako[17-21]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The Anvil template toggles `mfc.sh load` between GPU/CPU modes based on `gpu_enabled`, but there is no `pa-gpu` module stanza, and the template does not request GPUs from Slurm. This makes `--gpu ...` runs on Anvil internally inconsistent.

## Issue Context
`modules.sh` derives the stanza name from `-m` (cpu/gpu) and reads `toolchain/modules` entries accordingly.

## Fix Focus Areas
- toolchain/templates/anvil.mako[5-33]
- toolchain/modules[72-79]

## Suggested fix options (pick one)
1) **Disable GPU in Anvil template**: if `gpu_enabled` is true, raise a clear template error (or force `-m c` and warn) to prevent misconfigured runs.
2) **Implement GPU support**: add `pa-gpu` entries in `toolchain/modules` and add appropriate `#SBATCH` GPU allocation directives in anvil.mako under `% if gpu_enabled:` (similar to other GPU templates).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Advisory comments

4. Anvil not shown in prompt 🐞 Bug ⚙ Maintainability
Description
toolchain/bootstrap/modules.sh adds an Anvil (pa) menu line but does not include "pa" in the input
prompt list or in the --help computer options. This makes the new option harder to discover and
increases the chance of user error when selecting a system interactively.
Code

toolchain/bootstrap/modules.sh[R46-50]

+    log   "$BR""Brown$W: Oscar (o)"
+    log   "$BR""Purdue$W: Anvil (pa)"
    log   "$B""DoD$W:     Carpenter Cray (cc) | Carpenter GNU (c) |  Nautilus (n)"
    log   "$OR""Florida$W: HiPerGator (h)"
    log_n "($G""a$W/$G""f$W/$G""s$W/$G""w$W/$B""tuo$W/$C""b$W/$C""e$CR/$C""d/$C""dai$CR/$Y""p$CR/$R""r$CR/$B""cc$CR/$B""c$CR/$B""n$CR/$BR""o"$CR"/$OR""h"$CR"): "
Evidence
The interactive menu prints "Anvil (pa)" (modules.sh), but the prompt string shown to the user omits
"pa" from the list of accepted tokens, and the help text’s COMPUTER options list also omits Anvil.

toolchain/bootstrap/modules.sh[3-16]
toolchain/bootstrap/modules.sh[38-51]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The modules loader’s interactive UI/help does not reflect the newly added `pa` system option.

## Issue Context
Users selecting systems interactively rely on the prompt token list and `--help` output.

## Fix Focus Areas
- toolchain/bootstrap/modules.sh[10-15]
- toolchain/bootstrap/modules.sh[46-51]

## Suggested fix
- Add `Anvil (pa)` to the `show_help` COMPUTER options text.
- Add `/pa` into the `log_n "(...)"` prompt token list so it matches the menu items.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Comment on lines 44 to 47
% else:
(set -x; ${profiler} \
mpirun -np ${nodes*tasks_per_node} \
srun \
"${target.get_install_binpath(case)}")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Mpi task count dropped 🐞 Bug ≡ Correctness

In toolchain/templates/oscar.mako the MPI path now invokes plain "srun" without using
nodes*tasks_per_node, so the configured task count no longer influences how many ranks are launched.
This can under-launch MPI ranks and make MPI runs behave differently than intended for the same
nodes/tasks_per_node settings.
Agent Prompt
## Issue description
Oscar’s batch template switched from `mpirun -np ${nodes*tasks_per_node}` to `srun` but no longer passes any task-count arguments derived from `nodes`/`tasks_per_node`. As a result, the configured MPI size is not enforced by the launcher.

## Issue Context
Other Slurm templates in this repo that use `srun` explicitly pass `--ntasks ${nodes*tasks_per_node}`.

## Fix Focus Areas
- toolchain/templates/oscar.mako[42-48]

## Suggested fix
Update the MPI branch to something like:
- `srun --ntasks ${nodes*tasks_per_node} "${target.get_install_binpath(case)}"`

(Optionally also align the SBATCH header to consistently use `--ntasks-per-node=${tasks_per_node}` if that’s the intended directive for this cluster.)

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +11 to +13
% if partition:
##SBATCH --partition=${partition}
% endif
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. Partition sbatch is commented 🐞 Bug ≡ Correctness

In toolchain/templates/anvil.mako the partition directive is written as "##SBATCH", so it is treated
as a comment even when partition is provided. This makes user-specified partitions ineffective and
can lead to jobs scheduling on the wrong/default partition or not scheduling as expected.
Agent Prompt
## Issue description
The Anvil batch template uses `##SBATCH --partition=...`, which comments out the partition directive even when the user provides a partition.

## Issue Context
This causes the `partition` CLI/template variable to have no effect.

## Fix Focus Areas
- toolchain/templates/anvil.mako[11-13]

## Suggested fix
Change `##SBATCH --partition=${partition}` to `#SBATCH --partition=${partition}`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 3, 2026

📝 Walkthrough

Walkthrough

The changes add support for a new Purdue Anvil cluster and update configurations for Brown Oscar. The interactive system selection prompt in the bootstrap module now includes Purdue Anvil as an option with slug code pa. New module definitions specify CPU toolchain versions for Anvil, including GCC, OpenMPI, Python, FFTW, and CMake. A new Mako template for Anvil batch execution was added, with Slurm directives and runtime logic for managing environment setup, target execution, and optional profiling with MPI support. The Oscar template was updated to include a fixed memory-per-CPU allocation and to use srun for MPI execution. The Oscar Python module version was also updated.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete and does not follow the template structure. Critical sections lack proper detail or closure. Complete the description by: (1) providing a clear summary of changes; (2) properly closing all sections and removing stray '---'; (3) filling in the Issue number if applicable; (4) completing the Testing section with specific details; (5) properly checking the Checklist section.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Brown Oscar Python module and mako file update' directly describes the main changes made to the Brown Oscar cluster configuration files, specifically the Python module update and the mako template file addition.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4281db83-0194-4fb6-bcc2-faa69a9153d1

📥 Commits

Reviewing files that changed from the base of the PR and between 2d15ba9 and 66cb389.

📒 Files selected for processing (4)
  • toolchain/bootstrap/modules.sh
  • toolchain/modules
  • toolchain/templates/anvil.mako
  • toolchain/templates/oscar.mako

Comment on lines +11 to +13
% if partition:
##SBATCH --partition=${partition}
% endif
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Double hash comments out the partition directive.

Line 12 uses ##SBATCH instead of #SBATCH, which effectively comments out the partition directive. This means the partition will never be applied even when specified by the user.

Proposed fix
 % if partition:
-##SBATCH --partition=${partition}
+#SBATCH --partition=${partition}
 % endif
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
% if partition:
##SBATCH --partition=${partition}
% endif
% if partition:
`#SBATCH` --partition=${partition}
% endif

Comment on lines +29 to +31
cd "${MFC_ROOT_DIR}"
. ./mfc.sh load -c pa -m ${'g' if gpu_enabled else 'c'}
cd - > /dev/null
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

GPU mode loads modules that don't exist.

When gpu_enabled is true, this loads with -m g (GPU mode), but toolchain/modules only defines pa-cpu entries—no pa-gpu modules exist. This will result in no GPU-specific modules being loaded.

If GPU support is intentionally deferred (CPU-only for now), consider adding a guard or comment. Otherwise, add pa-gpu definitions to toolchain/modules.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.67%. Comparing base (2d15ba9) to head (66cb389).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1352   +/-   ##
=======================================
  Coverage   64.67%   64.67%           
=======================================
  Files          70       70           
  Lines       18251    18251           
  Branches     1504     1504           
=======================================
  Hits        11804    11804           
  Misses       5492     5492           
  Partials      955      955           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

#SBATCH --job-name="${name}"
#SBATCH --time=${walltime}
% if partition:
##SBATCH --partition=${partition}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug

@sbryngelson sbryngelson marked this pull request as draft April 3, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants