Repository navigation
Skip large-memory tests unless enabled on a large enough GPU #25035
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
Changes from all commits
f0234e9
d3931f3
5a94c12
090325b
26c0dd9
25939ec
66d2171
35e4b84
673ccd3
54d8d0f
8adab91
dc0c08e
e9f3c8c
f0d517d
8e6f77f
e20e98b
57a65e8
f315f41
40aa38c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: Copyright (c) 2021-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <cstdint> | ||
|
|
||
| namespace cudf::test::literals { | ||
|
|
||
| constexpr auto kilo{long{1} << 10}; | ||
| constexpr auto mega{long{1} << 20}; | ||
| constexpr auto giga{long{1} << 30}; | ||
| constexpr auto tera{long{1} << 40}; | ||
| constexpr auto peta{long{1} << 50}; | ||
|
|
||
| // user-defined Byte literals | ||
| constexpr unsigned long long operator""_B(unsigned long long val) { return val; } | ||
| constexpr unsigned long long operator""_KiB(unsigned long long const val) { return kilo * val; } | ||
| constexpr unsigned long long operator""_MiB(unsigned long long const val) { return mega * val; } | ||
| constexpr unsigned long long operator""_GiB(unsigned long long const val) { return giga * val; } | ||
| constexpr unsigned long long operator""_TiB(unsigned long long const val) { return tera * val; } | ||
| constexpr unsigned long long operator""_PiB(unsigned long long const val) { return peta * val; } | ||
|
Comment on lines
+23
to
+24
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Feels like we probably don't need a petabyte suffix ?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's keep it for alignment with RMM (from where this is copied). There, we use |
||
|
|
||
| } // namespace cudf::test::literals | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <cudf/utilities/error.hpp> | ||
|
|
||
| #include <cuda_runtime_api.h> | ||
|
|
||
| #include <gtest/gtest.h> | ||
|
|
||
| #include <cstddef> | ||
| #include <cstdlib> | ||
| #include <string> | ||
|
|
||
| namespace cudf::test { | ||
|
|
||
| /** | ||
| * @brief Returns why a test needing `bytes` of device memory should be skipped, or an empty string | ||
| * if it can run. | ||
| * | ||
| * Large-memory tests are skipped unless `GTEST_CUDF_LARGE_MEMORY_TESTS=1`, and then only run if | ||
| * the current CUDA device has at least `bytes` of total memory. | ||
| */ | ||
| inline std::string large_memory_skip_reason(std::size_t bytes) | ||
| { | ||
| auto const* env = std::getenv("GTEST_CUDF_LARGE_MEMORY_TESTS"); | ||
| if (env == nullptr or std::string{env} != "1") { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think this should allow an option like "FORCE" so that we try to run the tests even on small memory GPUs? |
||
| return "Large-memory tests are disabled, set GTEST_CUDF_LARGE_MEMORY_TESTS=1 to enable"; | ||
| } | ||
| std::size_t free{}; | ||
| std::size_t total{}; | ||
| CUDF_CUDA_TRY(cudaMemGetInfo(&free, &total)); | ||
| if (total < bytes) { | ||
| return "Requires " + std::to_string(bytes >> 20) + | ||
| " MiB of device memory, but the device has " + std::to_string(total >> 20) + " MiB"; | ||
| } | ||
| return {}; | ||
| } | ||
|
|
||
| } // namespace cudf::test | ||
|
|
||
| /// Skips the current test unless large-memory tests are enabled and the device has `bytes` memory. | ||
| #define CUDF_TEST_REQUIRE_DEVICE_MEMORY_OR_SKIP(bytes) \ | ||
| do { \ | ||
| if (auto const skip_reason_ = cudf::test::large_memory_skip_reason(bytes); \ | ||
| not skip_reason_.empty()) { \ | ||
| GTEST_SKIP() << skip_reason_; \ | ||
| } \ | ||
| } while (0) | ||
Uh oh!
There was an error while loading. Please reload this page.