Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions toolchain/templates/default.mako
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ if engine == 'batch':
else
ok ":) Selected MPI launcher $MAGENTA$binary$COLOR_RESET. Use$MAGENTA --binary$COLOR_RESET to override."
fi

% if engine == 'interactive':
# On Flux systems, srun is a wrapper that submits a batch job outside an allocation.
if [ "$binary" == "srun" ] && command -v flux > /dev/null; then
${helpers.require_flux_allocation()}
fi
% endif
% endif

% for target in targets:
Expand Down
7 changes: 7 additions & 0 deletions toolchain/templates/include/helpers.mako
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ END
% endif
</%def>

<%def name="require_flux_allocation()">
if [ -z "$FLUX_ENCLOSING_ID" ]; then
error ":( Not inside a Flux allocation: each launch would be submitted as its own batch job. Run inside 'flux alloc ...', use '-e batch', or pass --no-mpi.\n"
exit 1
fi
</%def>

<%def name="template_epilogue()">
% if os.name != 'nt':
#>
Expand Down
4 changes: 4 additions & 0 deletions toolchain/templates/tuo.mako
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ echo

export HSA_XNACK=0

% if mpi and engine == 'interactive':
${helpers.require_flux_allocation()}
% endif

% for target in targets:
${helpers.run_prologue(target)}

Expand Down
Loading