Skip to content

Commit 9943017

Browse files
TEST: use cuCtxCreate_v4 by default for newer CUDA versions
1 parent 9d89106 commit 9943017

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

test/gtest/uct/cuda/test_switch_cuda_device.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,12 @@ void test_p2p_create_destroy_ctx::test_xfer(send_func_t send, size_t length,
199199
ASSERT_EQ(cuDeviceGet(&device, 0), CUDA_SUCCESS);
200200

201201
CUcontext ctx;
202+
#if CUDA_VERSION >= 12050
203+
CUctxCreateParams ctx_create_params = {};
204+
ASSERT_EQ(cuCtxCreate_v4(&ctx, &ctx_create_params, 0, device), CUDA_SUCCESS);
205+
#else
202206
ASSERT_EQ(cuCtxCreate(&ctx, 0, device), CUDA_SUCCESS);
207+
#endif
203208
uct_p2p_rma_test::test_xfer(send, length, flags, mem_type);
204209
EXPECT_EQ(cuCtxDestroy(ctx), CUDA_SUCCESS);
205210
}

test/mpi/test_mpi_cuda.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,13 +468,20 @@ static int test_alloc_prim_send_user(const test_params_t *params)
468468
alloc_mem_t alloc_mem_send, alloc_mem_recv;
469469
CUcontext primary_ctx, user_ctx;
470470
int res;
471+
#if CUDA_VERSION >= 12050
472+
CUctxCreateParams ctx_create_params = {};
473+
#endif
471474

472475
retain_and_push_primary_context(params->cu_dev);
473476

474477
alloc_mem(params, &alloc_mem_send, &alloc_mem_recv);
475478

476479
CUDA_CHECK(cuCtxPopCurrent(&primary_ctx));
480+
#if CUDA_VERSION >= 12050
481+
CUDA_CHECK(cuCtxCreate_v4(&user_ctx, &ctx_create_params, 0, params->cu_dev));
482+
#else
477483
CUDA_CHECK(cuCtxCreate(&user_ctx, 0, params->cu_dev));
484+
#endif
478485

479486
mpi_pingpong(params->rank, alloc_mem_send.ptr, alloc_mem_recv.ptr,
480487
params->size);
@@ -495,7 +502,12 @@ static int test_alloc_user_send_prim(const test_params_t *params)
495502
alloc_mem_t alloc_mem_send, alloc_mem_recv;
496503
int res;
497504

505+
#if CUDA_VERSION >= 12050
506+
CUctxCreateParams ctx_create_params = {};
507+
CUDA_CHECK(cuCtxCreate_v4(&user_ctx, &ctx_create_params, 0, params->cu_dev));
508+
#else
498509
CUDA_CHECK(cuCtxCreate(&user_ctx, 0, params->cu_dev));
510+
#endif
499511

500512
alloc_mem(params, &alloc_mem_send, &alloc_mem_recv);
501513

0 commit comments

Comments
 (0)