playbooks/roles/ood-applications/files/bc_ansys_workbench/submit.yml.erb (42 lines of code) (raw):
---
<%-
require "yaml"
node_arrays = YAML.load_file("/etc/ood/config/apps/bc_desktop/config/node_arrays.yml")
node_ratio = bucket.to_i
if OodAppkit.clusters[cluster].job_config[:adapter] == 'slurm'
scheduler_args = ["-p", target]
# If the user has specified a node ratio greather than 1, set the job ppn
slot_type = node_arrays.find { |slot_type| slot_type["name"] == target }
gpu_count = slot_type["gpuCount"].to_i
if node_ratio > 1
cores = (slot_type["vcpuCount"].to_i / node_ratio)
gpu_count = (gpu_count.to_f / node_ratio.to_f).ceil
scheduler_args += ["--ntasks-per-node=%d" % cores]
else
scheduler_args += ["--exclusive"]
end
if gpu_count > 0
scheduler_args += ["--gpus=%d" % gpu_count]
end
else
scheduler_args = ["-q", "vizq"]
if node_ratio > 1
node_arrays.each do |slot_type|
if slot_type["name"] == target
cores = (slot_type["vcpuCount"].to_i / node_ratio)
scheduler_args += ["-l", "select=1:slot_type=%s:ncpus=%d" % [target, cores]]
break
end
end
else
scheduler_args += ["-l", "select=1:slot_type=%s,place=scatter:excl" % target]
end
end
-%>
batch_connect:
template: "vnc"
script:
native:
<%- scheduler_args.each do |arg| %>
- "<%= arg %>"
<%- end %>