imate
C++/CUDA Reference
|
Dynamic loading of shared libraries using dlopen
tool.
More...
Functions | |
template<typename Signature > | |
Signature | load_symbol (const char *lib_name, const char *symbol_name) |
Loads a symbol within a library and returns a pointer to the symbol (function pointer). More... | |
Dynamic loading of shared libraries using dlopen
tool.
The dynamic loading is compiled with CUDA_DYNAMIC_LOADING
set to 1
. When enabeld, the CUDA libraries are loaded at the run- time. This method has an advantage and a disadvatage:
auditwheel
tool in manylinux platform, the cuda libraries will not be bundled to the wheel, so the size of the wheel does not increase. In contrast, if this package is not compiled with dynamic loading, the cuda *
.so (or *
.dll) shared library files will be bundled with the wheel and increase the size of the wheel upto 400MB. Such a large wheel file cannot be uploaded to PyPI due to the 100MB size limit. But with dynamic loading, the package requires these libraries only at the run-time, not at the compile time.The run time with/without dynamic loading is the same. That is, using the dynamic loading doesn't affect the performance at all.
The functions in this namespace load any generic libraries. We use them to load libcudart
, libcublas
, and libcusparse
.
module load cuda
Signature dynamic_loading::load_symbol | ( | const char * | lib_name, |
const char * | symbol_name | ||
) |
Loads a symbol within a library and returns a pointer to the symbol (function pointer).
Signature | The template parameter. The returned symbol pointer is cast from void* to the template parameter Signature , which is essentially a typedef for the output function. |
[in] | lib_name | Name of the library. |
[in] | symbol_name | Name of the symbol within the library. |
Definition at line 164 of file dynamic_loading.h.