Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GPU Regex #837

Merged
merged 1 commit into from
May 21, 2024
Merged
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
2 changes: 1 addition & 1 deletion lib/ood_core/job/adapters/slurm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Slurm < Adapter
# calculated from gres string
# @return [Integer] the number of gpus in gres
def self.gpus_from_gres(gres)
gres.to_s.scan(/gpu:[^,]*(\d+)/).flatten.map(&:to_i).sum
gres.to_s.scan(/gpu[^(,]*[:=](\d+)/).flatten.map(&:to_i).sum
end

# Object used for simplified communication with a Slurm batch server
Expand Down
6 changes: 5 additions & 1 deletion spec/job/adapters/slurm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,11 @@ def job_info(opts = {})
["gres/gpu:v100-32g=2", 2],
["gres/gpu:v100-32g=2,gres/gpu:v100-32g=4", 6],
["gres/gpu:v100-32g=2,gres:gpu:1,gres/gpu:v100-32g=4", 7],
["gres/gpu:v100-32g=2,gres:pfsdir:1", 2]
["gres/gpu:v100-32g=2,gres:pfsdir:1", 2],
["gpu:p100:1,nsight:no_consume:1", 1],
["gpu:p100:1(IDX:0),mps:0", 1],
["gpu:a100:4(S:0-15)", 4],
["gpu:a100:3(IDX:0,2-3),mps:0", 3],
]
gres_cases.each do |gc|
it "does not return the correct number of gpus when gres=\"#{gc[0]}\"" do
Expand Down
Loading