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

Slurm gpus_from_gres not quite right #755

Closed
johrstrom opened this issue Apr 7, 2022 · 3 comments
Closed

Slurm gpus_from_gres not quite right #755

johrstrom opened this issue Apr 7, 2022 · 3 comments

Comments

@johrstrom
Copy link
Contributor

johrstrom commented Apr 7, 2022

If that is kept, I think that regex is wrong. Where it might cause issues:

gres/gpu:v100-32g=2

That's a GRES definition on Pitzer, numbers are in the subtype. Depending on where you query the GRES, ie which command, you could also split on = and get last element.

Originally posted by treydock in #752 (comment)

┆Issue is synchronized with this Asana task by Unito

@johrstrom
Copy link
Contributor Author

This is the method that this ticket is about:

def gpus_from_gres(gres)
gres.to_s.scan(/gpu:[^,]*(\d+)/).flatten.map(&:to_i).sum
end

Looks like /gpu:[^,]*(\d+),{,1}/ could work. @treydock seems like we're only interested in the very last digit(s) whatever that maybe.

We could split(',') and capture from the end of the line $ (positive lookbehind isn't implemented Ruby) but I don't know if I like chaining a splits together.

@lukew3
Copy link
Contributor

lukew3 commented Apr 7, 2022

I'm pretty sure that the regex still works. Check out the tests I added in #754. The regex is grabbing the last set of digits after gpu: and before , or the end of the string.

@johrstrom
Copy link
Contributor Author

Yep, I added similar test cases, but didn't check to see if they worked. In any case, yes with new tests there's nothing to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants