Skip to content

Commit

Permalink
Fix gtests/ERROR_TEST errors when run in Debug (#15317)
Browse files Browse the repository at this point in the history
Fixes errors reported by `gtests/ERROR_TEST` when run with a Debug build. Both errors occur due to invalid stream usage.
```
[ RUN      ] DebugAssert.cudf_assert_true
libcudf was not built with stacktrace support.
unknown file: Failure
C++ exception with description "cudf_identify_stream_usage found unexpected stream!" thrown in the test body.

[ RUN      ] DebugAssertDeathTest.cudf_assert_false
libcudf was not built with stacktrace support.
/cudf/cpp/tests/error/error_handling_test.cu:112: Failure
Death test: call_kernel()
    Result: threw an exception.
 Error msg:
[  DEATH   ] 
[  DEATH   ] /cudf/cpp/tests/error/error_handling_test.cu:112:: Caught std::exception-derived exception escaping the death test statement. Exception message: cudf_identify_stream_usage found unexpected stream!

```
Fixes the test logic to use the correct stream. These tests are only built/run with a Debug build.

Authors:
  - David Wendt (https://github.com/davidwendt)

Approvers:
  - Bradley Dice (https://github.com/bdice)
  - Muhammad Haseeb (https://github.com/mhaseeb123)

URL: #15317
  • Loading branch information
davidwendt committed Mar 15, 2024
1 parent f305a55 commit 1b163cc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cpp/tests/error/error_handling_test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ TEST(DebugAssertDeathTest, cudf_assert_false)
testing::FLAGS_gtest_death_test_style = "threadsafe";

auto call_kernel = []() {
assert_false_kernel<<<1, 1>>>();
auto const stream = cudf::get_default_stream().value();
assert_false_kernel<<<1, 1, 0, stream>>>();

// Kernel should fail with `cudaErrorAssert`
// This error invalidates the current device context, so we need to kill
Expand All @@ -114,7 +115,8 @@ TEST(DebugAssertDeathTest, cudf_assert_false)

TEST(DebugAssert, cudf_assert_true)
{
assert_true_kernel<<<1, 1>>>();
auto const stream = cudf::get_default_stream().value();
assert_true_kernel<<<1, 1, 0, stream>>>();
ASSERT_EQ(cudaSuccess, cudaDeviceSynchronize());
}

Expand All @@ -136,6 +138,7 @@ int main(int argc, char** argv)
auto adaptor = make_stream_checking_resource_adaptor(
resource, error_on_invalid_stream, check_default_stream);
rmm::mr::set_current_device_resource(&adaptor);
return RUN_ALL_TESTS();
}
return RUN_ALL_TESTS();
}

0 comments on commit 1b163cc

Please sign in to comment.