-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add ClimaGPU Backend #87
Conversation
017c13b
to
e270284
Compare
e270284
to
3dc9114
Compare
occursin("Red Hat", read("/etc/redhat-release", String)) | ||
backend = CaltechHPC | ||
hostname = gethostname() | ||
if occursin(r"^hpc-(\d\d)-(\d\d).cm.cluster$", hostname) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think match
is more appropriate function to use here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is !isnothing(match(regex, hostname))
then preferable to occursin(regex, hostname)
, or is there a better way to use match
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One might wonder why you used occursin
. What you want to check is that the hostname matches your regular expression, non that it contains it.
But what you could do is (schematically):
HOSTNAMES = Dict("^clima.gps.caltech.edu$" => ClimaGPU, "aaaa" => CaltechHPC, "bbb" => CaltechHPC)
backend = get(HOSTNAMES, first(filter(x -> !isnothing(match(x, gethostname(), keys(HOSTNAMES))))
(There's certainly more elegant ways)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe occursin(regex,str)
checks that the string matches the regex, but your way is already cleaner. I will incorporate it soon, thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it does, but when it is less clear to readers (I think). Your intent is to match the regular expression and you can make it more explicit by using the function match
Purpose
To-do
Content