imate
C++/CUDA Reference
Loading...
Searching...
No Matches
cudart_symbols.cpp File Reference
#include "./cudart_symbols.h"
#include <cuda_runtime_api.h>
#include <cstdlib>
#include <sstream>
#include "./dynamic_loading.h"
Include dependency graph for cudart_symbols.cpp:

Go to the source code of this file.

Functions

cudaError_t cudaEventCreate (cudaEvent_t *event)
 Definition of CUDA's cudaEventCreate function using dynamically loaded cudart library.
 
cudaError_t cudaEventDestroy (cudaEvent_t event)
 Definition of CUDA's cudaEventDestroy function using dynamically loaded cudart library.
 
cudaError_t cudaEventElapsedTime (float *ms, cudaEvent_t start, cudaEvent_t end)
 Definition of CUDA's cudaEventElapsedTime function using dynamically loaded cudart library.
 
cudaError_t cudaEventRecord (cudaEvent_t event, cudaStream_t stream)
 Definition of CUDA's cudaEventRecord function using dynamically loaded cudart library.
 
cudaError_t cudaEventSynchronize (cudaEvent_t event)
 Definition of CUDA's cudaEventSynchronize function using dynamically loaded cudart library.
 
cudaError_t cudaGetDevice (int *device)
 Definition of CUDA's cudaGetDevice function using dynamically loaded cudart library.
 
cudaError_t cudaGetDeviceCount (int *count)
 Definition of CUDA's cudaGetDeviceCount function using dynamically loaded cudart library.
 
cudaError_t cudaGetDeviceProperties (cudaDeviceProp *prop, int device)
 Definition of CUDA's cudaGetDeviceProperties function using dynamically loaded cudart library.
 
cudaError_t cudaFree (void *devPtr)
 Definition of CUDA's cudaFree function using dynamically loaded cudart library.
 
cudaError_t cudaMalloc (void **devPtr, size_t size)
 Definition of CUDA's cudaMalloc function using dynamically loaded cudart library.
 
cudaError_t cudaMemcpy (void *dst, const void *src, size_t count, cudaMemcpyKind kind)
 Definition of CUDA's cudaMemcpy function using dynamically loaded cudart library.
 
cudaError_t cudaSetDevice (int device)
 Definition of CUDA's cudaSetDevice function using dynamically loaded cudart library.
 
void ** __cudaRegisterFatBinary (void *fatCubin)
 Definition of CUDA's __cudaRegisterFatBinary function using dynamically loaded cudart library.
 
void __cudaRegisterFatBinaryEnd (void **fatCubinHandle)
 Definition of CUDA's __cudaRegisterFatBinaryEnd function using dynamically loaded cudart library.
 
void __cudaUnregisterFatBinary (void **fatCubinHandle)
 Definition of CUDA's __cudaUnregisterFatBinary function using dynamically loaded cudart library.
 

Function Documentation

◆ __cudaRegisterFatBinary()

void ** __cudaRegisterFatBinary ( void *  fatCubin)

Definition of CUDA's __cudaRegisterFatBinary function using dynamically loaded cudart library.

Definition at line 407 of file cudart_symbols.cpp.

408{
410 {
411 std::string lib_name = cudartSymbols::get_lib_name();
412 const char* symbol_name = "__cudaRegisterFatBinary";
413
415 dynamic_loading::load_symbol<__cudaRegisterFatBinary_type>(
416 lib_name.c_str(),
417 symbol_name);
418 }
419
421}
static __cudaRegisterFatBinary_type __cudaRegisterFatBinary
static std::string get_lib_name()
Returns the name of cudart shared library.

References cudartSymbols::__cudaRegisterFatBinary, and cudartSymbols::get_lib_name().

Here is the call graph for this function:

◆ __cudaRegisterFatBinaryEnd()

void __cudaRegisterFatBinaryEnd ( void **  fatCubinHandle)

Definition of CUDA's __cudaRegisterFatBinaryEnd function using dynamically loaded cudart library.

Definition at line 431 of file cudart_symbols.cpp.

432{
434 {
435 std::string lib_name = cudartSymbols::get_lib_name();
436 const char* symbol_name = "__cudaRegisterFatBinaryEnd";
437
439 dynamic_loading::load_symbol<__cudaRegisterFatBinaryEnd_type>(
440 lib_name.c_str(),
441 symbol_name);
442 }
443
444 return cudartSymbols::__cudaRegisterFatBinaryEnd(fatCubinHandle);
445}
static __cudaRegisterFatBinaryEnd_type __cudaRegisterFatBinaryEnd

References cudartSymbols::__cudaRegisterFatBinaryEnd, and cudartSymbols::get_lib_name().

Here is the call graph for this function:

◆ __cudaUnregisterFatBinary()

void __cudaUnregisterFatBinary ( void **  fatCubinHandle)

Definition of CUDA's __cudaUnregisterFatBinary function using dynamically loaded cudart library.

Definition at line 455 of file cudart_symbols.cpp.

456{
458 {
459 std::string lib_name = cudartSymbols::get_lib_name();
460 const char* symbol_name = "__cudaUnregisterFatBinary";
461
463 dynamic_loading::load_symbol<__cudaUnregisterFatBinary_type>(
464 lib_name.c_str(),
465 symbol_name);
466 }
467
468 return cudartSymbols::__cudaUnregisterFatBinary(fatCubinHandle);
469}
static __cudaUnregisterFatBinary_type __cudaUnregisterFatBinary

References cudartSymbols::__cudaUnregisterFatBinary, and cudartSymbols::get_lib_name().

Here is the call graph for this function:

◆ cudaEventCreate()

cudaError_t cudaEventCreate ( cudaEvent_t *  event)

Definition of CUDA's cudaEventCreate function using dynamically loaded cudart library.

Definition at line 111 of file cudart_symbols.cpp.

112{
114 {
115 std::string lib_name = cudartSymbols::get_lib_name();
116 const char* symbol_name = "cudaEventCreate";
117
119 dynamic_loading::load_symbol<cudaEventCreate_type>(
120 lib_name.c_str(),
121 symbol_name);
122 }
123
124 return cudartSymbols::cudaEventCreate(event);
125}
static cudaEventCreate_type cudaEventCreate

References cudartSymbols::cudaEventCreate, and cudartSymbols::get_lib_name().

Referenced by CudaTimer::CudaTimer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cudaEventDestroy()

cudaError_t cudaEventDestroy ( cudaEvent_t  event)

Definition of CUDA's cudaEventDestroy function using dynamically loaded cudart library.

Definition at line 135 of file cudart_symbols.cpp.

136{
138 {
139 std::string lib_name = cudartSymbols::get_lib_name();
140 const char* symbol_name = "cudaEventDestroy";
141
143 dynamic_loading::load_symbol<cudaEventDestroy_type>(
144 lib_name.c_str(),
145 symbol_name);
146 }
147
149}
static cudaEventDestroy_type cudaEventDestroy

References cudartSymbols::cudaEventDestroy, and cudartSymbols::get_lib_name().

Referenced by CudaTimer::~CudaTimer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cudaEventElapsedTime()

cudaError_t cudaEventElapsedTime ( float *  ms,
cudaEvent_t  start,
cudaEvent_t  end 
)

Definition of CUDA's cudaEventElapsedTime function using dynamically loaded cudart library.

Definition at line 159 of file cudart_symbols.cpp.

163{
165 {
166 std::string lib_name = cudartSymbols::get_lib_name();
167 const char* symbol_name = "cudaEventElapsedTime";
168
170 dynamic_loading::load_symbol<cudaEventElapsedTime_type>(
171 lib_name.c_str(),
172 symbol_name);
173 }
174
175 return cudartSymbols::cudaEventElapsedTime(ms, start, end);
176}
static cudaEventElapsedTime_type cudaEventElapsedTime

References cudartSymbols::cudaEventElapsedTime, and cudartSymbols::get_lib_name().

Referenced by CudaTimer::elapsed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cudaEventRecord()

cudaError_t cudaEventRecord ( cudaEvent_t  event,
cudaStream_t  stream 
)

Definition of CUDA's cudaEventRecord function using dynamically loaded cudart library.

Definition at line 186 of file cudart_symbols.cpp.

187{
189 {
190 std::string lib_name = cudartSymbols::get_lib_name();
191 const char* symbol_name = "cudaEventRecord";
192
194 dynamic_loading::load_symbol<cudaEventRecord_type>(
195 lib_name.c_str(),
196 symbol_name);
197 }
198
199 return cudartSymbols::cudaEventRecord(event, stream);
200}
static cudaEventRecord_type cudaEventRecord

References cudartSymbols::cudaEventRecord, and cudartSymbols::get_lib_name().

Referenced by CudaTimer::start(), and CudaTimer::stop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cudaEventSynchronize()

cudaError_t cudaEventSynchronize ( cudaEvent_t  event)

Definition of CUDA's cudaEventSynchronize function using dynamically loaded cudart library.

Definition at line 210 of file cudart_symbols.cpp.

211{
213 {
214 std::string lib_name = cudartSymbols::get_lib_name();
215 const char* symbol_name = "cudaEventSynchronize";
216
218 dynamic_loading::load_symbol<cudaEventSynchronize_type>(
219 lib_name.c_str(),
220 symbol_name);
221 }
222
224}
static cudaEventSynchronize_type cudaEventSynchronize

References cudartSymbols::cudaEventSynchronize, and cudartSymbols::get_lib_name().

Referenced by CudaTimer::elapsed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cudaFree()

cudaError_t cudaFree ( void *  devPtr)

Definition of CUDA's cudaFree function using dynamically loaded cudart library.

Definition at line 308 of file cudart_symbols.cpp.

309{
310 if (cudartSymbols::cudaFree == NULL)
311 {
312 std::string lib_name = cudartSymbols::get_lib_name();
313 const char* symbol_name = "cudaFree";
314
315 cudartSymbols::cudaFree = dynamic_loading::load_symbol<cudaFree_type>(
316 lib_name.c_str(),
317 symbol_name);
318 }
319
320 return cudartSymbols::cudaFree(devPtr);
321}
static cudaFree_type cudaFree

References cudartSymbols::cudaFree, and cudartSymbols::get_lib_name().

Referenced by cublas_impl::cublasTdot(), cublas_impl::cublasTnrm2(), and CudaAPI< ArrayType >::del().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cudaGetDevice()

cudaError_t cudaGetDevice ( int *  device)

Definition of CUDA's cudaGetDevice function using dynamically loaded cudart library.

Definition at line 234 of file cudart_symbols.cpp.

235{
237 {
238 std::string lib_name = cudartSymbols::get_lib_name();
239 const char* symbol_name = "cudaGetDevice";
240
242 dynamic_loading::load_symbol<cudaGetDevice_type>(
243 lib_name.c_str(),
244 symbol_name);
245 }
246
247 return cudartSymbols::cudaGetDevice(device);
248}
static cudaGetDevice_type cudaGetDevice

References cudartSymbols::cudaGetDevice, and cudartSymbols::get_lib_name().

Referenced by CudaAPI< ArrayType >::get_device().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cudaGetDeviceCount()

cudaError_t cudaGetDeviceCount ( int *  count)

Definition of CUDA's cudaGetDeviceCount function using dynamically loaded cudart library.

Definition at line 258 of file cudart_symbols.cpp.

259{
261 {
262 std::string lib_name = cudartSymbols::get_lib_name();
263 const char* symbol_name = "cudaGetDeviceCount";
264
266 dynamic_loading::load_symbol<cudaGetDeviceCount_type>(
267 lib_name.c_str(),
268 symbol_name);
269 }
270
272}
static cudaGetDeviceCount_type cudaGetDeviceCount

References cudartSymbols::cudaGetDeviceCount, and cudartSymbols::get_lib_name().

Referenced by query_device(), and cuLinearOperator< DataType >::query_gpu_devices().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cudaGetDeviceProperties()

cudaError_t cudaGetDeviceProperties ( cudaDeviceProp *  prop,
int  device 
)

Definition of CUDA's cudaGetDeviceProperties function using dynamically loaded cudart library.

Definition at line 282 of file cudart_symbols.cpp.

285{
287 {
288 std::string lib_name = cudartSymbols::get_lib_name();
289 const char* symbol_name = "cudaGetDeviceProperties";
290
292 dynamic_loading::load_symbol<cudaGetDeviceProperties_type>(
293 lib_name.c_str(),
294 symbol_name);
295 }
296
297 return cudartSymbols::cudaGetDeviceProperties(prop, device);
298}
static cudaGetDeviceProperties_type cudaGetDeviceProperties

References cudartSymbols::cudaGetDeviceProperties, and cudartSymbols::get_lib_name().

Referenced by query_device().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cudaMalloc()

cudaError_t cudaMalloc ( void **  devPtr,
size_t  size 
)

Definition of CUDA's cudaMalloc function using dynamically loaded cudart library.

Definition at line 331 of file cudart_symbols.cpp.

332{
333 if (cudartSymbols::cudaMalloc == NULL)
334 {
335 std::string lib_name = cudartSymbols::get_lib_name();
336 const char* symbol_name = "cudaMalloc";
337
339 dynamic_loading::load_symbol<cudaMalloc_type>(
340 lib_name.c_str(),
341 symbol_name);
342 }
343
344 return cudartSymbols::cudaMalloc(devPtr, size);
345}
static cudaMalloc_type cudaMalloc

References cudartSymbols::cudaMalloc, and cudartSymbols::get_lib_name().

Referenced by CudaAPI< ArrayType >::alloc(), CudaAPI< ArrayType >::alloc(), CudaAPI< ArrayType >::alloc_bytes(), cublas_impl::cublasTdot(), and cublas_impl::cublasTnrm2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cudaMemcpy()

cudaError_t cudaMemcpy ( void *  dst,
const void *  src,
size_t  count,
cudaMemcpyKind  kind 
)

Definition of CUDA's cudaMemcpy function using dynamically loaded cudart library.

Definition at line 355 of file cudart_symbols.cpp.

360{
361 if (cudartSymbols::cudaMemcpy == NULL)
362 {
363 std::string lib_name = cudartSymbols::get_lib_name();
364 const char* symbol_name = "cudaMemcpy";
365
367 dynamic_loading::load_symbol<cudaMemcpy_type>(
368 lib_name.c_str(),
369 symbol_name);
370 }
371
372 return cudartSymbols::cudaMemcpy(dst, src, count, kind);
373}
static cudaMemcpy_type cudaMemcpy

References cudartSymbols::cudaMemcpy, and cudartSymbols::get_lib_name().

Referenced by CudaAPI< ArrayType >::copy_to_device(), cublas_impl::cublasTdot(), and cublas_impl::cublasTnrm2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cudaSetDevice()

cudaError_t cudaSetDevice ( int  device)

Definition of CUDA's cudaSetDevice function using dynamically loaded cudart library.

Definition at line 383 of file cudart_symbols.cpp.

384{
386 {
387 std::string lib_name = cudartSymbols::get_lib_name();
388 const char* symbol_name = "cudaSetDevice";
389
391 dynamic_loading::load_symbol<cudaSetDevice_type>(
392 lib_name.c_str(),
393 symbol_name);
394 }
395
396 return cudartSymbols::cudaSetDevice(device);
397}
static cudaSetDevice_type cudaSetDevice

References cudartSymbols::cudaSetDevice, and cudartSymbols::get_lib_name().

Referenced by CudaAPI< ArrayType >::set_device().

Here is the call graph for this function:
Here is the caller graph for this function: