imate
C++/CUDA Reference
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. More...
 
cudaError_t cudaEventDestroy (cudaEvent_t event)
 Definition of CUDA's cudaEventDestroy function using dynamically loaded cudart library. More...
 
cudaError_t cudaEventElapsedTime (float *ms, cudaEvent_t start, cudaEvent_t end)
 Definition of CUDA's cudaEventElapsedTime function using dynamically loaded cudart library. More...
 
cudaError_t cudaEventRecord (cudaEvent_t event, cudaStream_t stream)
 Definition of CUDA's cudaEventRecord function using dynamically loaded cudart library. More...
 
cudaError_t cudaEventSynchronize (cudaEvent_t event)
 Definition of CUDA's cudaEventSynchronize function using dynamically loaded cudart library. More...
 
cudaError_t cudaGetDevice (int *device)
 Definition of CUDA's cudaGetDevice function using dynamically loaded cudart library. More...
 
cudaError_t cudaGetDeviceCount (int *count)
 Definition of CUDA's cudaGetDeviceCount function using dynamically loaded cudart library. More...
 
cudaError_t cudaGetDeviceProperties (cudaDeviceProp *prop, int device)
 Definition of CUDA's cudaGetDeviceProperties function using dynamically loaded cudart library. More...
 
cudaError_t cudaFree (void *devPtr)
 Definition of CUDA's cudaFree function using dynamically loaded cudart library. More...
 
cudaError_t cudaMalloc (void **devPtr, size_t size)
 Definition of CUDA's cudaMalloc function using dynamically loaded cudart library. More...
 
cudaError_t cudaMemcpy (void *dst, const void *src, size_t count, cudaMemcpyKind kind)
 Definition of CUDA's cudaMemcpy function using dynamically loaded cudart library. More...
 
cudaError_t cudaSetDevice (int device)
 Definition of CUDA's cudaSetDevice function using dynamically loaded cudart library. More...
 
void ** __cudaRegisterFatBinary (void *fatCubin)
 Definition of CUDA's __cudaRegisterFatBinary function using dynamically loaded cudart library. More...
 
void __cudaRegisterFatBinaryEnd (void **fatCubinHandle)
 Definition of CUDA's __cudaRegisterFatBinaryEnd function using dynamically loaded cudart library. More...
 
void __cudaUnregisterFatBinary (void **fatCubinHandle)
 Definition of CUDA's __cudaUnregisterFatBinary function using dynamically loaded cudart library. More...
 

Function Documentation

◆ __cudaRegisterFatBinary()

void** __cudaRegisterFatBinary ( void *  fatCubin)

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

Definition at line 402 of file cudart_symbols.cpp.

403 {
405  {
406  std::string lib_name = cudartSymbols::get_lib_name();
407  const char* symbol_name = "__cudaRegisterFatBinary";
408 
410  dynamic_loading::load_symbol<__cudaRegisterFatBinary_type>(
411  lib_name.c_str(),
412  symbol_name);
413  }
414 
416 }
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 426 of file cudart_symbols.cpp.

427 {
429  {
430  std::string lib_name = cudartSymbols::get_lib_name();
431  const char* symbol_name = "__cudaRegisterFatBinaryEnd";
432 
434  dynamic_loading::load_symbol<__cudaRegisterFatBinaryEnd_type>(
435  lib_name.c_str(),
436  symbol_name);
437  }
438 
439  return cudartSymbols::__cudaRegisterFatBinaryEnd(fatCubinHandle);
440 }
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 450 of file cudart_symbols.cpp.

451 {
453  {
454  std::string lib_name = cudartSymbols::get_lib_name();
455  const char* symbol_name = "__cudaUnregisterFatBinary";
456 
458  dynamic_loading::load_symbol<__cudaUnregisterFatBinary_type>(
459  lib_name.c_str(),
460  symbol_name);
461  }
462 
463  return cudartSymbols::__cudaUnregisterFatBinary(fatCubinHandle);
464 }
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 106 of file cudart_symbols.cpp.

107 {
108  if (cudartSymbols::cudaEventCreate == NULL)
109  {
110  std::string lib_name = cudartSymbols::get_lib_name();
111  const char* symbol_name = "cudaEventCreate";
112 
114  dynamic_loading::load_symbol<cudaEventCreate_type>(
115  lib_name.c_str(),
116  symbol_name);
117  }
118 
119  return cudartSymbols::cudaEventCreate(event);
120 }
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 130 of file cudart_symbols.cpp.

131 {
133  {
134  std::string lib_name = cudartSymbols::get_lib_name();
135  const char* symbol_name = "cudaEventDestroy";
136 
138  dynamic_loading::load_symbol<cudaEventDestroy_type>(
139  lib_name.c_str(),
140  symbol_name);
141  }
142 
143  return cudartSymbols::cudaEventDestroy(event);
144 }
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 154 of file cudart_symbols.cpp.

158 {
160  {
161  std::string lib_name = cudartSymbols::get_lib_name();
162  const char* symbol_name = "cudaEventElapsedTime";
163 
165  dynamic_loading::load_symbol<cudaEventElapsedTime_type>(
166  lib_name.c_str(),
167  symbol_name);
168  }
169 
170  return cudartSymbols::cudaEventElapsedTime(ms, start, end);
171 }
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 181 of file cudart_symbols.cpp.

182 {
183  if (cudartSymbols::cudaEventRecord == NULL)
184  {
185  std::string lib_name = cudartSymbols::get_lib_name();
186  const char* symbol_name = "cudaEventRecord";
187 
189  dynamic_loading::load_symbol<cudaEventRecord_type>(
190  lib_name.c_str(),
191  symbol_name);
192  }
193 
194  return cudartSymbols::cudaEventRecord(event, stream);
195 }
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 205 of file cudart_symbols.cpp.

206 {
208  {
209  std::string lib_name = cudartSymbols::get_lib_name();
210  const char* symbol_name = "cudaEventSynchronize";
211 
213  dynamic_loading::load_symbol<cudaEventSynchronize_type>(
214  lib_name.c_str(),
215  symbol_name);
216  }
217 
219 }
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 303 of file cudart_symbols.cpp.

304 {
305  if (cudartSymbols::cudaFree == NULL)
306  {
307  std::string lib_name = cudartSymbols::get_lib_name();
308  const char* symbol_name = "cudaFree";
309 
310  cudartSymbols::cudaFree = dynamic_loading::load_symbol<cudaFree_type>(
311  lib_name.c_str(),
312  symbol_name);
313  }
314 
315  return cudartSymbols::cudaFree(devPtr);
316 }
static cudaFree_type cudaFree

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

Referenced by CudaInterface< 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 229 of file cudart_symbols.cpp.

230 {
231  if (cudartSymbols::cudaGetDevice == NULL)
232  {
233  std::string lib_name = cudartSymbols::get_lib_name();
234  const char* symbol_name = "cudaGetDevice";
235 
237  dynamic_loading::load_symbol<cudaGetDevice_type>(
238  lib_name.c_str(),
239  symbol_name);
240  }
241 
242  return cudartSymbols::cudaGetDevice(device);
243 }
static cudaGetDevice_type cudaGetDevice

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

Referenced by CudaInterface< 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 253 of file cudart_symbols.cpp.

254 {
256  {
257  std::string lib_name = cudartSymbols::get_lib_name();
258  const char* symbol_name = "cudaGetDeviceCount";
259 
261  dynamic_loading::load_symbol<cudaGetDeviceCount_type>(
262  lib_name.c_str(),
263  symbol_name);
264  }
265 
266  return cudartSymbols::cudaGetDeviceCount(count);
267 }
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 277 of file cudart_symbols.cpp.

280 {
282  {
283  std::string lib_name = cudartSymbols::get_lib_name();
284  const char* symbol_name = "cudaGetDeviceProperties";
285 
287  dynamic_loading::load_symbol<cudaGetDeviceProperties_type>(
288  lib_name.c_str(),
289  symbol_name);
290  }
291 
292  return cudartSymbols::cudaGetDeviceProperties(prop, device);
293 }
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 326 of file cudart_symbols.cpp.

327 {
328  if (cudartSymbols::cudaMalloc == NULL)
329  {
330  std::string lib_name = cudartSymbols::get_lib_name();
331  const char* symbol_name = "cudaMalloc";
332 
334  dynamic_loading::load_symbol<cudaMalloc_type>(
335  lib_name.c_str(),
336  symbol_name);
337  }
338 
339  return cudartSymbols::cudaMalloc(devPtr, size);
340 }
static cudaMalloc_type cudaMalloc

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

Referenced by CudaInterface< ArrayType >::alloc(), and CudaInterface< ArrayType >::alloc_bytes().

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 350 of file cudart_symbols.cpp.

355 {
356  if (cudartSymbols::cudaMemcpy == NULL)
357  {
358  std::string lib_name = cudartSymbols::get_lib_name();
359  const char* symbol_name = "cudaMemcpy";
360 
362  dynamic_loading::load_symbol<cudaMemcpy_type>(
363  lib_name.c_str(),
364  symbol_name);
365  }
366 
367  return cudartSymbols::cudaMemcpy(dst, src, count, kind);
368 }
static cudaMemcpy_type cudaMemcpy

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

Referenced by CudaInterface< ArrayType >::copy_to_device().

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 378 of file cudart_symbols.cpp.

379 {
380  if (cudartSymbols::cudaSetDevice == NULL)
381  {
382  std::string lib_name = cudartSymbols::get_lib_name();
383  const char* symbol_name = "cudaSetDevice";
384 
386  dynamic_loading::load_symbol<cudaSetDevice_type>(
387  lib_name.c_str(),
388  symbol_name);
389  }
390 
391  return cudartSymbols::cudaSetDevice(device);
392 }
static cudaSetDevice_type cudaSetDevice

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

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

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