Skip to content

Commit

Permalink
MC/CUDA: reduce verbosity for cu ctx doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergei-Lebedev committed Sep 24, 2024
1 parent 8eccd57 commit e111225
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/mc/cuda/mc_cuda.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ ucc_status_t ucc_mc_cuda_get_resources(ucc_mc_cuda_resources_t **resources)
CUcontext cu_ctx;
unsigned long long int cu_ctx_id;
ucc_status_t status;
CUresult cu_status;

status = CUDADRV_FUNC(cuCtxGetCurrent(&cu_ctx));
if (ucc_unlikely(status != UCC_OK)) {
Expand All @@ -366,11 +367,13 @@ ucc_status_t ucc_mc_cuda_get_resources(ucc_mc_cuda_resources_t **resources)
#if CUDA_VERSION < 12000
cu_ctx_id = 1;
#else
status = CUDADRV_FUNC(cuCtxGetId(cu_ctx, &cu_ctx_id));
if (ucc_unlikely(status != UCC_OK)) {
cu_status = cuCtxGetId(cu_ctx, &cu_ctx_id);
if (ucc_unlikely(cu_status != CUDA_SUCCESS)) {
/* worakround for pytorch, progress thread doesn't have cuda context for GPU 0*/
/* cuda context might be not initialized, try to proceed with default device*/
cu_ctx_id = 0x12345;
mc_debug(&ucc_mc_cuda.super, "failed to get currect CUDA context ID");
mc_debug(&ucc_mc_cuda.super,
"failed to get current CUDA context ID (%d)", cu_status);
}
#endif

Expand Down

0 comments on commit e111225

Please sign in to comment.