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

Tests: improve CUDA support detection #985

Merged

Conversation

akx
Copy link
Contributor

@akx akx commented Jan 24, 2024

Most of the tests require CUDA capabilities; only some of them were previously marked as such and skipped when no CUDA was available, the rest of them were left to fail.

This PR adds a pytest hook that turns the Torch Torch not compiled with CUDA enabled assertion error into pytest.skip, and a Pytest fixture that a test can use to assert that CUDA support is available too.

On a machine where make cpuonly passes (namely in a linux/amd64 Docker box), running tests on main (53f8af8) results in

706 failed, 75 passed, 2339 skipped, 1 warning, 16 errors in 42.86s

With this PR, the result is a more sensible

75 passed, 3061 skipped, 1 warning in 9.08s

(though whether test_nvidia_transform should (partially) succeed on a machine with no CUDA is anybody's guess).

Related to discussion in #984.

* implicitly skip any test that implicitly uses CUDA on a non-CUDA box
* add a `requires_cuda` fixture
@akx akx mentioned this pull request Jan 24, 2024
@Titus-von-Koeller Titus-von-Koeller merged commit f1c7574 into bitsandbytes-foundation:main Jan 24, 2024
1 check passed
@Titus-von-Koeller
Copy link
Collaborator

Looks good to me! Thanks for another useful contribution.

Just out of curiosity, of course you don't have to answer, what led you to work with BNB, if you're not running Linux with a GPU? Are you involved with the Apple Silicon cross platform work?

@Titus-von-Koeller
Copy link
Collaborator

Ah, you said you're on Linux :D

@akx
Copy link
Contributor Author

akx commented Jan 25, 2024

@Titus-von-Koeller Let's just say I have my contributing fingers here and there in the GenAI ecosystem 😁

@akx akx deleted the pytest-cuda-hook branch January 25, 2024 06:04
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