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

set CF_CUDA_ENABLED=True if compiler('cuda') is detected in meta.yaml #1544

Merged
merged 8 commits into from
Nov 16, 2021

Conversation

h-vetinari
Copy link
Member

From the discussion in conda-forge/conda-forge-pinning-feedstock#1708, and particularly, this description of what to do.

I couldn't think of a way to detect compiler('cuda'), because - AFAICT - the ingestion of meta.yaml is done a couple lines above by conda_build.api.render, and after that, the jinja-functions will have already been filled in.

I think it's a feasible workaround though to just use r"^nvcc.*" (as a build requirement) as a stand-in for detecting that.

I haven't yet written a test for it, this is more to check whether I'm on the right path.

CC @isuruf @jakirkham

@isuruf
Copy link
Member

isuruf commented Nov 14, 2021

Rendering and then setting the env variable is too late. You have to set the env variable at the same time that DEFAULT_LINUX_VERSION is set. You can read meta.yaml and do a text search instead.

@h-vetinari h-vetinari changed the title set CF_CUDA_ENABLED=True if nvcc is detected in meta.yaml set CF_CUDA_ENABLED=True if compiler('cuda') is detected in meta.yaml Nov 15, 2021
@h-vetinari
Copy link
Member Author

Ping @isuruf, I added a test and it's green now. :)

Copy link
Member

@isuruf isuruf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test doesn't really test that the CF_CUDA_ENABLED is set during rerendering time. The easiest way to check is to add a skip like skip: True # [os.environ.get("CF_CUDA_ENABLED") == "True"] and see if the build was skipped.

@h-vetinari
Copy link
Member Author

The test doesn't really test that the CF_CUDA_ENABLED is set during rerendering time. The easiest way to check is to add a skip like skip: True # [os.environ.get("CF_CUDA_ENABLED") == "True"] and see if the build was skipped.

I didn't understand the test design here very well (for example it seems most tests brings their own fixture?), so I tried to follow the test for DEFAULT_LINUX_VERSION. Are you saying I should add another test with another fixture (containing the skip you mentioned), and validate that there's no cuda-output?

Or - since you approved the changes - that this is not necessary now?

@h-vetinari
Copy link
Member Author

Thanks for the corrections! I cannot commit them through the GH UI (not enough rights here), but if you want I can recreate them locally?

tests/test_configure_feedstock.py Show resolved Hide resolved
tests/test_configure_feedstock.py Outdated Show resolved Hide resolved
Co-Authored-By: H. Vetinari <h.vetinari@gmx.com>
@isuruf
Copy link
Member

isuruf commented Nov 16, 2021

Can you add a news entry?

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.

None yet

2 participants