Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Make out_of_memory_recovery test trigger OOM faster. #1190

Merged
merged 1 commit into from
Jun 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions testing/out_of_memory_recovery.cu
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
// Regression test for NVBug 2720132.
//
// Summary of 2720132:
//
// 1. The large allocation fails due to running out of memory.
Copy link
Collaborator

@brycelelbach brycelelbach Jun 10, 2020

Choose a reason for hiding this comment

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

0 index your lists!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You first! :)

http://nvbugs/2720132/2

// 2. A `thrust::system::system_error` exception is thrown.
// 3. Local objects are destroyed as the stack is unwound, leading to the destruction of `x`.
// 4. `x` runs a parallel algorithm in its destructor to call the destructors of all of its elements.
// 5. Launching that parallel algorithm fails because of the prior CUDA out of memory error.
// 6. A `thrust::system::system_error` exception is thrown.
// 7. Because we've already got an active exception, `terminate` is called.

#include <unittest/unittest.h>
#include <thrust/device_vector.h>
Expand All @@ -16,8 +26,7 @@ void test_out_of_memory_recovery()
{
thrust::device_vector<non_trivial> x(1);

for (thrust::detail::uint64_t n = 1 ;; n <<= 1)
thrust::device_vector<thrust::detail::uint32_t> y(n);
thrust::device_vector<thrust::detail::uint32_t> y(0x00ffffffffffffff);
}
catch (...) { }
}
Expand Down