Skip to content
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
10 changes: 9 additions & 1 deletion opal/mca/accelerator/cuda/accelerator_cuda_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,15 @@ static opal_accelerator_base_module_t* accelerator_cuda_init(void)
if (!opal_cuda_support) {
return NULL;
}

int count = 0;
Copy link
Member

Choose a reason for hiding this comment

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

Might as well move this line down below the cuInit() block (i.e., to where you know for sure that count will be used).

/* If cuInit fails or there are no cuda capable devices, return NULL. */
if (cuInit(0)) {
return NULL;
}
CUresult ret = cuDeviceGetCount(&count);
if (ret || count == 0) {
return NULL;
}
opal_accelerator_cuda_delayed_init();
return &opal_accelerator_cuda_module;
}
Expand Down