Skip to content

Commit 2daf64e

Browse files
committed
Return test check
1 parent 4c5ea76 commit 2daf64e

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

onnxruntime/core/providers/cuda/cuda_mempool_arena.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace cuda {
2323
* a single process is hosting more than one cuda session. This arena hosts cuda memory pool
2424
* which has some tunable parameters to control its memory usage and de-allocates memory back to
2525
* the device according to the specified params. This is opposite to the BFCArena which only
26-
* attempts to free memory on Shrink() at the end of the run.
26+
* attempts to free memory on Shrink() if configured at the end of the run.
2727
*
2828
* ### Behavior
2929
* - Creates a **process-local** CUDA mempool for a specific device (from `OrtMemoryInfo`).

onnxruntime/test/providers/cuda/cuda_mempool_arena_test.cc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,23 @@ static bool IsCudaMemPoolSupported() {
5252
return false;
5353
}
5454

55+
// Creating a cuda mempool in some pipelines fails with
56+
// CUDA failure 801: operation not supported ; GPU=0 ; hostname=af14bbb1c000000 ;
57+
// Even though CUDA version may be 12.8 possibly due to the driver.
58+
cudaMemPoolProps props{};
59+
// Pinned is not the same as pinned allocator, cudaMemLocationTypeDevice actually does not exist
60+
// even though is present in some internet docs.
61+
props.allocType = cudaMemAllocationTypePinned;
62+
props.handleTypes = cudaMemHandleTypeNone; // local to process
63+
props.location.type = cudaMemLocationTypeDevice; // Device memory
64+
props.location.id = 0; // test device 0
65+
cudaMemPool_t pool;
66+
auto cuda_error = cudaMemPoolCreate(&pool, &props);
67+
if (cuda_error != cudaSuccess) {
68+
return false;
69+
}
70+
cuda_error = cudaMemPoolDestroy(pool);
71+
5572
return true;
5673
}
5774

0 commit comments

Comments
 (0)