@@ -97,7 +97,7 @@ static int accelerator_cuda_check_addr(const void *addr, int *dev_id, uint64_t *
97
97
CU_POINTER_ATTRIBUTE_IS_MANAGED };
98
98
void * attrdata [] = {(void * ) & mem_type , (void * ) & mem_ctx , (void * ) & is_managed };
99
99
100
- result = opal_accelerator_cuda_func . cuPointerGetAttributes (3 , attributes , attrdata , dbuf );
100
+ result = cuPointerGetAttributes (3 , attributes , attrdata , dbuf );
101
101
OPAL_OUTPUT_VERBOSE ((101 , opal_accelerator_base_framework .framework_output ,
102
102
"dbuf=%p, mem_type=%d, mem_ctx=%p, is_managed=%d, result=%d" , (void * ) dbuf ,
103
103
(int ) mem_type , (void * ) mem_ctx , is_managed , result ));
@@ -121,7 +121,7 @@ static int accelerator_cuda_check_addr(const void *addr, int *dev_id, uint64_t *
121
121
/* Must be a device pointer */
122
122
assert (CU_MEMORYTYPE_DEVICE == mem_type );
123
123
#else /* OPAL_CUDA_GET_ATTRIBUTES */
124
- result = opal_accelerator_cuda_func . cuPointerGetAttribute (& mem_type , CU_POINTER_ATTRIBUTE_MEMORY_TYPE , dbuf );
124
+ result = cuPointerGetAttribute (& mem_type , CU_POINTER_ATTRIBUTE_MEMORY_TYPE , dbuf );
125
125
if (CUDA_SUCCESS != result ) {
126
126
/* If we cannot determine it is device pointer,
127
127
* just assume it is not. */
@@ -142,11 +142,11 @@ static int accelerator_cuda_check_addr(const void *addr, int *dev_id, uint64_t *
142
142
* GPU memory, but no context, get the context from the GPU memory
143
143
* and set the current context to that. It is rare that we will not
144
144
* have a context. */
145
- result = opal_accelerator_cuda_func . cuCtxGetCurrent (& ctx );
145
+ result = cuCtxGetCurrent (& ctx );
146
146
if (OPAL_UNLIKELY (NULL == ctx )) {
147
147
if (CUDA_SUCCESS == result ) {
148
148
#if !OPAL_CUDA_GET_ATTRIBUTES
149
- result = opal_accelerator_cuda_func . cuPointerGetAttribute (& mem_ctx , CU_POINTER_ATTRIBUTE_CONTEXT , dbuf );
149
+ result = cuPointerGetAttribute (& mem_ctx , CU_POINTER_ATTRIBUTE_CONTEXT , dbuf );
150
150
if (OPAL_UNLIKELY (CUDA_SUCCESS != result )) {
151
151
opal_output (0 ,
152
152
"CUDA: error calling cuPointerGetAttribute: "
@@ -155,7 +155,7 @@ static int accelerator_cuda_check_addr(const void *addr, int *dev_id, uint64_t *
155
155
return OPAL_ERROR ;
156
156
}
157
157
#endif /* OPAL_CUDA_GET_ATTRIBUTES */
158
- result = opal_accelerator_cuda_func . cuCtxSetCurrent (mem_ctx );
158
+ result = cuCtxSetCurrent (mem_ctx );
159
159
if (OPAL_UNLIKELY (CUDA_SUCCESS != result )) {
160
160
opal_output (0 ,
161
161
"CUDA: error calling cuCtxSetCurrent: "
@@ -185,7 +185,7 @@ static int accelerator_cuda_check_addr(const void *addr, int *dev_id, uint64_t *
185
185
if (OPAL_LIKELY (((CUDA_VERSION > 7000 ) ? 0 : 1 ))) {
186
186
CUdeviceptr pbase ;
187
187
size_t psize ;
188
- result = opal_accelerator_cuda_func . cuMemGetAddressRange (& pbase , & psize , dbuf );
188
+ result = cuMemGetAddressRange (& pbase , & psize , dbuf );
189
189
if (CUDA_SUCCESS != result ) {
190
190
opal_output_verbose (5 , opal_accelerator_base_framework .framework_output ,
191
191
"CUDA: cuMemGetAddressRange failed on this pointer: result=%d, buf=%p "
@@ -214,7 +214,7 @@ static int accelerator_cuda_create_stream(int dev_id, opal_accelerator_stream_t
214
214
return OPAL_ERR_OUT_OF_RESOURCE ;
215
215
}
216
216
217
- result = opal_accelerator_cuda_func . cuStreamCreate ((* stream )-> stream , 0 );
217
+ result = cuStreamCreate ((* stream )-> stream , 0 );
218
218
if (OPAL_UNLIKELY (result != CUDA_SUCCESS )) {
219
219
opal_show_help ("help-accelerator-cuda.txt" , "cuStreamCreate failed" , true,
220
220
OPAL_PROC_MY_HOSTNAME , result );
@@ -230,7 +230,7 @@ static void opal_accelerator_cuda_stream_destruct(opal_accelerator_cuda_stream_t
230
230
CUresult result ;
231
231
232
232
if (NULL != stream -> base .stream ) {
233
- result = opal_accelerator_cuda_func . cuStreamDestroy (* (CUstream * )stream -> base .stream );
233
+ result = cuStreamDestroy (* (CUstream * )stream -> base .stream );
234
234
if (OPAL_UNLIKELY (CUDA_SUCCESS != result )) {
235
235
opal_show_help ("help-accelerator-cuda.txt" , "cuStreamDestroy failed" , true,
236
236
result );
@@ -259,7 +259,7 @@ static int accelerator_cuda_create_event(int dev_id, opal_accelerator_event_t **
259
259
OBJ_RELEASE (* event );
260
260
return OPAL_ERR_OUT_OF_RESOURCE ;
261
261
}
262
- result = opal_accelerator_cuda_func . cuEventCreate ((* event )-> event , CU_EVENT_DISABLE_TIMING );
262
+ result = cuEventCreate ((* event )-> event , CU_EVENT_DISABLE_TIMING );
263
263
if (OPAL_UNLIKELY (CUDA_SUCCESS != result )) {
264
264
opal_show_help ("help-accelerator-cuda.txt" , "cuEventCreate failed" , true,
265
265
OPAL_PROC_MY_HOSTNAME , result );
@@ -274,7 +274,7 @@ static void opal_accelerator_cuda_event_destruct(opal_accelerator_cuda_event_t *
274
274
{
275
275
CUresult result ;
276
276
if (NULL != event -> base .event ) {
277
- result = opal_accelerator_cuda_func . cuEventDestroy (* (CUevent * )event -> base .event );
277
+ result = cuEventDestroy (* (CUevent * )event -> base .event );
278
278
if (OPAL_UNLIKELY (CUDA_SUCCESS != result )) {
279
279
opal_show_help ("help-accelerator-cuda.txt" , "cuEventDestroy failed" , true,
280
280
result );
@@ -297,7 +297,7 @@ static int accelerator_cuda_record_event(int dev_id, opal_accelerator_event_t *e
297
297
return OPAL_ERR_BAD_PARAM ;
298
298
}
299
299
300
- result = opal_accelerator_cuda_func . cuEventRecord (* (CUevent * )event -> event , * (CUstream * )stream -> stream );
300
+ result = cuEventRecord (* (CUevent * )event -> event , * (CUstream * )stream -> stream );
301
301
if (OPAL_UNLIKELY (CUDA_SUCCESS != result )) {
302
302
opal_show_help ("help-accelerator-cuda.txt" , "cuEventRecord failed" , true,
303
303
OPAL_PROC_MY_HOSTNAME , result );
@@ -314,7 +314,7 @@ static int accelerator_cuda_query_event(int dev_id, opal_accelerator_event_t *ev
314
314
return OPAL_ERR_BAD_PARAM ;
315
315
}
316
316
317
- result = opal_accelerator_cuda_func . cuEventQuery (* (CUevent * )event -> event );
317
+ result = cuEventQuery (* (CUevent * )event -> event );
318
318
switch (result ) {
319
319
case CUDA_SUCCESS :
320
320
{
@@ -344,7 +344,7 @@ static int accelerator_cuda_memcpy_async(int dest_dev_id, int src_dev_id, void *
344
344
return OPAL_ERR_BAD_PARAM ;
345
345
}
346
346
347
- result = opal_accelerator_cuda_func . cuMemcpyAsync ((CUdeviceptr ) dest , (CUdeviceptr ) src , size , * (CUstream * )stream -> stream );
347
+ result = cuMemcpyAsync ((CUdeviceptr ) dest , (CUdeviceptr ) src , size , * (CUstream * )stream -> stream );
348
348
if (OPAL_UNLIKELY (CUDA_SUCCESS != result )) {
349
349
opal_show_help ("help-accelerator-cuda.txt" , "cuMemcpyAsync failed" , true, dest , src ,
350
350
size , result );
@@ -370,13 +370,13 @@ static int accelerator_cuda_memcpy(int dest_dev_id, int src_dev_id, void *dest,
370
370
* Additionally, cuMemcpy is not necessarily always synchronous. See:
371
371
* https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html
372
372
* TODO: Add optimizations for type field */
373
- result = opal_accelerator_cuda_func . cuMemcpyAsync ((CUdeviceptr ) dest , (CUdeviceptr ) src , size , opal_accelerator_cuda_memcpy_stream );
373
+ result = cuMemcpyAsync ((CUdeviceptr ) dest , (CUdeviceptr ) src , size , opal_accelerator_cuda_memcpy_stream );
374
374
if (OPAL_UNLIKELY (CUDA_SUCCESS != result )) {
375
375
opal_show_help ("help-accelerator-cuda.txt" , "cuMemcpyAsync failed" , true, dest , src ,
376
376
size , result );
377
377
return OPAL_ERROR ;
378
378
}
379
- result = opal_accelerator_cuda_func . cuStreamSynchronize (opal_accelerator_cuda_memcpy_stream );
379
+ result = cuStreamSynchronize (opal_accelerator_cuda_memcpy_stream );
380
380
if (OPAL_UNLIKELY (CUDA_SUCCESS != result )) {
381
381
opal_show_help ("help-accelerator-cuda.txt" , "cuStreamSynchronize failed" , true,
382
382
OPAL_PROC_MY_HOSTNAME , result );
@@ -395,29 +395,29 @@ static int accelerator_cuda_memmove(int dest_dev_id, int src_dev_id, void *dest,
395
395
return OPAL_ERR_BAD_PARAM ;
396
396
}
397
397
398
- result = opal_accelerator_cuda_func . cuMemAlloc (& tmp , size );
398
+ result = cuMemAlloc (& tmp , size );
399
399
if (OPAL_UNLIKELY (CUDA_SUCCESS != result )) {
400
400
return OPAL_ERROR ;
401
401
}
402
- result = opal_accelerator_cuda_func . cuMemcpyAsync (tmp , (CUdeviceptr ) src , size , opal_accelerator_cuda_memcpy_stream );
402
+ result = cuMemcpyAsync (tmp , (CUdeviceptr ) src , size , opal_accelerator_cuda_memcpy_stream );
403
403
if (OPAL_UNLIKELY (CUDA_SUCCESS != result )) {
404
404
opal_show_help ("help-accelerator-cuda.txt" , "cuMemcpyAsync failed" , true, tmp , src , size ,
405
405
result );
406
406
return OPAL_ERROR ;
407
407
}
408
- result = opal_accelerator_cuda_func . cuMemcpyAsync ((CUdeviceptr ) dest , tmp , size , opal_accelerator_cuda_memcpy_stream );
408
+ result = cuMemcpyAsync ((CUdeviceptr ) dest , tmp , size , opal_accelerator_cuda_memcpy_stream );
409
409
if (OPAL_UNLIKELY (CUDA_SUCCESS != result )) {
410
410
opal_show_help ("help-accelerator-cuda.txt" , "cuMemcpyAsync failed" , true, dest , tmp ,
411
411
size , result );
412
412
return OPAL_ERROR ;
413
413
}
414
- result = opal_accelerator_cuda_func . cuStreamSynchronize (opal_accelerator_cuda_memcpy_stream );
414
+ result = cuStreamSynchronize (opal_accelerator_cuda_memcpy_stream );
415
415
if (OPAL_UNLIKELY (CUDA_SUCCESS != result )) {
416
416
opal_show_help ("help-accelerator-cuda.txt" , "cuStreamSynchronize failed" , true,
417
417
OPAL_PROC_MY_HOSTNAME , result );
418
418
return OPAL_ERROR ;
419
419
}
420
- opal_accelerator_cuda_func . cuMemFree (tmp );
420
+ cuMemFree (tmp );
421
421
return OPAL_SUCCESS ;
422
422
}
423
423
@@ -430,7 +430,7 @@ static int accelerator_cuda_mem_alloc(int dev_id, void **ptr, size_t size)
430
430
}
431
431
432
432
if (size > 0 ) {
433
- result = opal_accelerator_cuda_func . cuMemAlloc ((CUdeviceptr * ) ptr , size );
433
+ result = cuMemAlloc ((CUdeviceptr * ) ptr , size );
434
434
if (OPAL_UNLIKELY (CUDA_SUCCESS != result )) {
435
435
opal_show_help ("help-accelerator-cuda.txt" , "cuMemAlloc failed" , true,
436
436
OPAL_PROC_MY_HOSTNAME , result );
@@ -444,7 +444,7 @@ static int accelerator_cuda_mem_release(int dev_id, void *ptr)
444
444
{
445
445
CUresult result ;
446
446
if (NULL != ptr ) {
447
- result = opal_accelerator_cuda_func . cuMemFree ((CUdeviceptr ) ptr );
447
+ result = cuMemFree ((CUdeviceptr ) ptr );
448
448
if (OPAL_UNLIKELY (CUDA_SUCCESS != result )) {
449
449
opal_show_help ("help-accelerator-cuda.txt" , "cuMemFree failed" , true,
450
450
OPAL_PROC_MY_HOSTNAME , result );
@@ -463,7 +463,7 @@ static int accelerator_cuda_get_address_range(int dev_id, const void *ptr, void
463
463
return OPAL_ERR_BAD_PARAM ;
464
464
}
465
465
466
- result = opal_accelerator_cuda_func . cuMemGetAddressRange ((CUdeviceptr * ) base , size , (CUdeviceptr ) ptr );
466
+ result = cuMemGetAddressRange ((CUdeviceptr * ) base , size , (CUdeviceptr ) ptr );
467
467
if (OPAL_UNLIKELY (CUDA_SUCCESS != result )) {
468
468
opal_show_help ("help-accelerator-cuda.txt" , "cuMemGetAddressRange failed 2" , true,
469
469
OPAL_PROC_MY_HOSTNAME , result , ptr );
@@ -483,7 +483,7 @@ static int accelerator_cuda_host_register(int dev_id, void *ptr, size_t size)
483
483
return OPAL_ERR_BAD_PARAM ;
484
484
}
485
485
486
- result = opal_accelerator_cuda_func . cuMemHostRegister (ptr , size , 0 );
486
+ result = cuMemHostRegister (ptr , size , 0 );
487
487
if (OPAL_UNLIKELY (CUDA_SUCCESS != result )) {
488
488
opal_show_help ("help-accelerator-cuda.txt" , "cuMemHostRegister failed" , true,
489
489
ptr , size , OPAL_PROC_MY_HOSTNAME , result );
@@ -497,7 +497,7 @@ static int accelerator_cuda_host_unregister(int dev_id, void *ptr)
497
497
{
498
498
CUresult result ;
499
499
if (NULL != ptr ) {
500
- result = opal_accelerator_cuda_func . cuMemHostUnregister (ptr );
500
+ result = cuMemHostUnregister (ptr );
501
501
if (OPAL_UNLIKELY (CUDA_SUCCESS != result )) {
502
502
opal_show_help ("help-accelerator-cuda.txt" , "cuMemHostUnregister failed" , true,
503
503
ptr , OPAL_PROC_MY_HOSTNAME , result );
@@ -516,7 +516,7 @@ static int accelerator_cuda_get_device(int *dev_id)
516
516
return OPAL_ERR_BAD_PARAM ;
517
517
}
518
518
519
- result = opal_accelerator_cuda_func . cuCtxGetDevice (& cuDev );
519
+ result = cuCtxGetDevice (& cuDev );
520
520
if (OPAL_UNLIKELY (CUDA_SUCCESS != result )) {
521
521
opal_show_help ("help-accelerator-cuda.txt" , "cuCtxGetDevice failed" , true,
522
522
result );
@@ -534,7 +534,7 @@ static int accelerator_cuda_device_can_access_peer(int *access, int dev1, int de
534
534
return OPAL_ERR_BAD_PARAM ;
535
535
}
536
536
537
- result = opal_accelerator_cuda_func . cuDeviceCanAccessPeer (access , (CUdevice ) dev1 , (CUdevice ) dev2 );
537
+ result = cuDeviceCanAccessPeer (access , (CUdevice ) dev1 , (CUdevice ) dev2 );
538
538
if (OPAL_UNLIKELY (CUDA_SUCCESS != result )) {
539
539
opal_show_help ("help-accelerator-cuda.txt" , "cuDeviceCanAccessPeer failed" , true,
540
540
OPAL_PROC_MY_HOSTNAME , result );
@@ -554,13 +554,13 @@ static int accelerator_cuda_get_buffer_id(int dev_id, const void *addr, opal_acc
554
554
{
555
555
CUresult result ;
556
556
int enable = 1 ;
557
- result = opal_accelerator_cuda_func . cuPointerGetAttribute ((unsigned long long * )buf_id , CU_POINTER_ATTRIBUTE_BUFFER_ID , (CUdeviceptr ) addr );
557
+ result = cuPointerGetAttribute ((unsigned long long * )buf_id , CU_POINTER_ATTRIBUTE_BUFFER_ID , (CUdeviceptr ) addr );
558
558
if (OPAL_UNLIKELY (result != CUDA_SUCCESS )) {
559
559
opal_show_help ("help-accelerator-cuda.txt" , "bufferID failed" , true, OPAL_PROC_MY_HOSTNAME ,
560
560
result );
561
561
return result ;
562
562
}
563
- result = opal_accelerator_cuda_func . cuPointerSetAttribute (& enable , CU_POINTER_ATTRIBUTE_SYNC_MEMOPS ,
563
+ result = cuPointerSetAttribute (& enable , CU_POINTER_ATTRIBUTE_SYNC_MEMOPS ,
564
564
(CUdeviceptr ) addr );
565
565
if (OPAL_UNLIKELY (CUDA_SUCCESS != result )) {
566
566
opal_show_help ("help-accelerator-cuda.txt" , "cuPointerSetAttribute failed" , true,
0 commit comments