Skip to content

Commit

Permalink
Add singularity_options to the native structure. This allows containe…
Browse files Browse the repository at this point in the history
…rs to specify additional options for Singularity such as --nv for nVIDIA GPU and --rocm for AMD GPU or --bind /etc/OpenCL for OpenCL (in combination with one of the prior).
  • Loading branch information
guruevi committed Aug 26, 2024
1 parent d8ecfb0 commit 5f3c3bb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion lib/ood_core/job/adapters/linux_host/launcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ def wrapped_script(script, session_name)
'script_timeout' => script_timeout(script),
'session_name' => session_name,
'singularity_bin' => singularity_bin,
'singularity_options' => singularity_options(script.native),
'singularity_image' => singularity_image(script.native),
'ssh_hosts' => ssh_hosts,
'tmux_bin' => tmux_bin,
Expand Down Expand Up @@ -205,6 +206,12 @@ def singularity_bindpath(native)
native[:singularity_bindpath]
end

def singularity_options(native)
return '' unless native && native[:singularity_options]

native[:singularity_options]
end

def script_timeout(script)
wall_time = script.wall_time.to_i
return site_timeout if wall_time == 0
Expand Down Expand Up @@ -294,4 +301,4 @@ def parse_hostname(output)
end.compact.last.to_s
end

end
end
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ trap exit_script SIGINT SIGTERM
OUTPUT_PATH=<%= output_path %>
ERROR_PATH=<%= error_path %>
({
timeout <%= script_timeout %>s <%= singularity_bin %> exec <%= contain %> --pid <%= singularity_image %> /bin/bash --login $singularity_tmp_file <%= arguments %>
timeout <%= script_timeout %>s <%= singularity_bin %> exec <%= singularity_options %> <%= contain %> --pid <%= singularity_image %> /bin/bash --login $singularity_tmp_file <%= arguments %>
} | tee "$OUTPUT_PATH") 3>&1 1>&2 2>&3 | tee "$ERROR_PATH"
<%= email_on_terminated %>
Expand Down

0 comments on commit 5f3c3bb

Please sign in to comment.