17 #include <cublas_api.h>
53 std::string lib_extension;
55 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) || \
57 lib_extension =
"lib";
59 lib_extension =
"dylib";
63 #error "Unknown compiler"
67 #ifndef CUBLAS_VER_MAJOR
68 #error "CUBLAS_VER_MAJOR is not defined."
72 std::string lib_base_name =
"libcublas";
75 std::ostringstream oss;
77 oss << lib_base_name <<
"." << lib_extension <<
"." \
80 std::string lib_name = oss.str();
102 const char* symbol_name =
"cublasCreate_v2";
105 dynamic_loading::load_symbol<cublasCreate_type>(
127 const char* symbol_name =
"cublasDestroy_v2";
130 dynamic_loading::load_symbol<cublasDestroy_type>(
146 cublasHandle_t handle,
147 cublasOperation_t trans,
162 const char* symbol_name =
"cublasSgemv_v2";
165 dynamic_loading::load_symbol<cublasSgemv_type>(
171 incx, beta, y, incy);
183 cublasHandle_t handle,
184 cublasOperation_t trans,
199 const char* symbol_name =
"cublasDgemv_v2";
202 dynamic_loading::load_symbol<cublasDgemv_type>(
208 incx, beta, y, incy);
220 cublasHandle_t handle,
int n,
229 const char* symbol_name =
"cublasScopy_v2";
232 dynamic_loading::load_symbol<cublasScopy_type>(
249 cublasHandle_t handle,
int n,
258 const char* symbol_name =
"cublasDcopy_v2";
261 dynamic_loading::load_symbol<cublasDcopy_type>(
278 cublasHandle_t handle,
289 const char* symbol_name =
"cublasSaxpy_v2";
292 dynamic_loading::load_symbol<cublasSaxpy_type>(
309 cublasHandle_t handle,
320 const char* symbol_name =
"cublasDaxpy_v2";
323 dynamic_loading::load_symbol<cublasDaxpy_type>(
340 cublasHandle_t handle,
351 const char* symbol_name =
"cublasSdot_v2";
354 dynamic_loading::load_symbol<cublasSdot_type>(
371 cublasHandle_t handle,
382 const char* symbol_name =
"cublasDdot_v2";
385 dynamic_loading::load_symbol<cublasDdot_type>(
402 cublasHandle_t handle,
411 const char* symbol_name =
"cublasSnrm2_v2";
414 dynamic_loading::load_symbol<cublasSnrm2_type>(
431 cublasHandle_t handle,
440 const char* symbol_name =
"cublasDnrm2_v2";
443 dynamic_loading::load_symbol<cublasDnrm2_type>(
460 cublasHandle_t handle,
469 const char* symbol_name =
"cublasSscal_v2";
472 dynamic_loading::load_symbol<cublasSscal_type>(
489 cublasHandle_t handle,
498 const char* symbol_name =
"cublasDscal_v2";
501 dynamic_loading::load_symbol<cublasDscal_type>(
static cublasSaxpy_type cublasSaxpy
static cublasDdot_type cublasDdot
static cublasScopy_type cublasScopy
static cublasSscal_type cublasSscal
static cublasDaxpy_type cublasDaxpy
static cublasCreate_type cublasCreate
static cublasDestroy_type cublasDestroy
static cublasDnrm2_type cublasDnrm2
static cublasSdot_type cublasSdot
static cublasDcopy_type cublasDcopy
static cublasSnrm2_type cublasSnrm2
static cublasDscal_type cublasDscal
static cublasSgemv_type cublasSgemv
static std::string get_lib_name()
Returns the name of cublas shared library.
static cublasDgemv_type cublasDgemv
cublasStatus_t cublasDcopy(cublasHandle_t handle, int n, const double *x, int incx, double *y, int incy)
Definition of CUDA's cublasDcopy function using dynamically loaded cublas library.
cublasStatus_t cublasSgemv_v2(cublasHandle_t handle, cublasOperation_t trans, int m, int n, const float *alpha, const float *A, int lda, const float *x, int incx, const float *beta, float *y, int incy)
Definition of CUDA's cublasSgemv function using dynamically loaded cublas library.
cublasStatus_t cublasSscal(cublasHandle_t handle, int n, const float *alpha, float *x, int incx)
Definition of CUDA's cublasSscal function using dynamically loaded cublas library.
cublasStatus_t cublasDscal(cublasHandle_t handle, int n, const double *alpha, double *x, int incx)
Definition of CUDA's cublasDscal function using dynamically loaded cublas library.
cublasStatus_t cublasSdot(cublasHandle_t handle, int n, const float *x, int incx, const float *y, int incy, float *result)
Definition of CUDA's cublasSdot function using dynamically loaded cublas library.
cublasStatus_t cublasSnrm2(cublasHandle_t handle, int n, const float *x, int incx, float *result)
Definition of CUDA's cublasSnrm2 function using dynamically loaded cublas library.
cublasStatus_t cublasSaxpy(cublasHandle_t handle, int n, const float *alpha, const float *x, int incx, float *y, int incy)
Definition of CUDA's cublasSaxpy function using dynamically loaded cublas library.
cublasStatus_t cublasDaxpy(cublasHandle_t handle, int n, const double *alpha, const double *x, int incx, double *y, int incy)
Definition of CUDA's cublasDaxpy function using dynamically loaded cublas library.
cublasStatus_t cublasScopy(cublasHandle_t handle, int n, const float *x, int incx, float *y, int incy)
Definition of CUDA's cublasScopy function using dynamically loaded cublas library.
cublasStatus_t cublasDestroy_v2(cublasHandle_t handle)
Definition of CUDA's cublasDestroy function using dynamically loaded cublas library.
cublasStatus_t cublasDnrm2(cublasHandle_t handle, int n, const double *x, int incx, double *result)
Definition of CUDA's cublasDnrm2 function using dynamically loaded cublas library.
cublasStatus_t cublasDgemv_v2(cublasHandle_t handle, cublasOperation_t trans, int m, int n, const double *alpha, const double *A, int lda, const double *x, int incx, const double *beta, double *y, int incy)
Definition of CUDA's cublasDgemv function using dynamically loaded cublas library.
cublasStatus_t cublasDdot(cublasHandle_t handle, int n, const double *x, int incx, const double *y, int incy, double *result)
Definition of CUDA's cublasDdot function using dynamically loaded cublas library.
cublasStatus_t cublasCreate_v2(cublasHandle_t *handle)
Definition of CUDA's cublasCreate function using dynamically loaded cublas library.
cublasStatus_t(* cublasDestroy_type)(cublasHandle_t handle)
cublasStatus_t(* cublasDgemv_type)(cublasHandle_t handle, cublasOperation_t trans, int m, int n, const double *alpha, const double *A, int lda, const double *x, int incx, const double *beta, double *y, int incy)
cublasStatus_t(* cublasDcopy_type)(cublasHandle_t handle, int n, const double *x, int incx, double *y, int incy)
cublasStatus_t(* cublasDaxpy_type)(cublasHandle_t handle, int n, const double *alpha, const double *x, int incx, double *y, int incy)
cublasStatus_t(* cublasDscal_type)(cublasHandle_t handle, int n, const double *alpha, double *x, int incx)
cublasStatus_t(* cublasSaxpy_type)(cublasHandle_t handle, int n, const float *alpha, const float *x, int incx, float *y, int incy)
cublasStatus_t(* cublasCreate_type)(cublasHandle_t *handle)
cublasStatus_t(* cublasSscal_type)(cublasHandle_t handle, int n, const float *alpha, float *x, int incx)
cublasStatus_t(* cublasSgemv_type)(cublasHandle_t handle, cublasOperation_t trans, int m, int n, const float *alpha, const float *A, int lda, const float *x, int incx, const float *beta, float *y, int incy)
cublasStatus_t(* cublasSdot_type)(cublasHandle_t handle, int n, const float *x, int incx, const float *y, int incy, float *result)
cublasStatus_t(* cublasScopy_type)(cublasHandle_t handle, int n, const float *x, int incx, float *y, int incy)
cublasStatus_t(* cublasSnrm2_type)(cublasHandle_t handle, int n, const float *x, int incx, float *result)
cublasStatus_t(* cublasDdot_type)(cublasHandle_t handle, int n, const double *x, int incx, const double *y, int incy, double *result)
cublasStatus_t(* cublasDnrm2_type)(cublasHandle_t handle, int n, const double *x, int incx, double *result)