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

Add ClimaGPU Backend #87

Merged
merged 1 commit into from
Jun 20, 2024
Merged

Add ClimaGPU Backend #87

merged 1 commit into from
Jun 20, 2024

Conversation

nefrathenrici
Copy link
Member

Purpose

To-do

Content


  • I have read and checked the items on the review checklist.

@nefrathenrici nefrathenrici marked this pull request as ready for review June 20, 2024 21:05
@nefrathenrici nefrathenrici merged commit 3c023b7 into main Jun 20, 2024
6 checks passed
occursin("Red Hat", read("/etc/redhat-release", String))
backend = CaltechHPC
hostname = gethostname()
if occursin(r"^hpc-(\d\d)-(\d\d).cm.cluster$", hostname) ||
Copy link
Member

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

Copy link
Member Author

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?

Copy link
Member

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)

Copy link
Member Author

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!

Copy link
Member

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

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

Successfully merging this pull request may close these issues.

2 participants