Skip to content

Update setup.py to check if WITH_CUDA is set #360

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

Merged
merged 1 commit into from
Feb 14, 2025

Conversation

szaman19
Copy link
Contributor

os.environ.get("WITH_CUDA", "0") == "0" return True even if the environment variable is not set. Thus currently, the default behavior is to automatically fall back to CPU-only build if WITH_CUDA is not set.

This introduces a small change to the first check if the WITH_CUDA is set. If not set, it falls back to the build defined by torch.cuda._is_compiled().

Check if environment variable is set before retrieving variable at setup time.
@stefdoerr
Copy link
Collaborator

stefdoerr commented Feb 14, 2025

Ah right, of course. I was so focused on making conda-forge work correctly. Thanks for the contribution!

@stefdoerr stefdoerr merged commit 718e401 into torchmd:main Feb 14, 2025
@stefdoerr
Copy link
Collaborator

stefdoerr commented Feb 14, 2025

I should really not review code before my first morning coffee. There were two logic errors in this PR (the first if was supposed to be not None) and there should not be defaults in the nested getenvs. Fixed here:
a302aab

@szaman19
Copy link
Contributor Author

Haha looks like I shouldn't submit a PR before I've had my first coffee either! Thanks for the fix and quick turn around. Cheers!

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