ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
AddMMCUDA.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #include <Logging.h>
9 
13 
14 namespace cloudViewer {
15 namespace core {
16 
17 void AddMMCUDA(void* A_data,
18  void* B_data,
19  void* C_data,
20  int64_t m,
21  int64_t k,
22  int64_t n,
23  double alpha,
24  double beta,
25  bool gemmTrA,
26  bool gemmTrB,
27  int lda,
28  int ldb,
29  int ldc,
30  Dtype dtype,
31  const Device& device) {
32  cublasHandle_t handle = CuBLASContext::GetInstance().GetHandle(device);
34  scalar_t alpha_ = scalar_t(alpha);
35  scalar_t beta_ = scalar_t(beta);
36  OPEN3D_CUBLAS_CHECK(
37  gemm_cuda(handle, gemmTrA ? CUBLAS_OP_T : CUBLAS_OP_N,
38  gemmTrB ? CUBLAS_OP_T : CUBLAS_OP_N, m, n, k, &alpha_,
39  static_cast<const scalar_t*>(A_data), lda,
40  static_cast<const scalar_t*>(B_data), ldb, &beta_,
41  static_cast<scalar_t*>(C_data), ldc),
42  "cuda gemm failed");
43  });
44 }
45 
46 } // namespace core
47 } // namespace cloudViewer
#define DISPATCH_LINALG_DTYPE_TO_TEMPLATE(DTYPE,...)
Definition: LinalgUtils.h:23
ccGuiPythonInstance * GetInstance() noexcept
Definition: Runtime.cpp:72
void AddMMCUDA(void *A_data, void *B_data, void *C_data, int64_t m, int64_t k, int64_t n, double alpha, double beta, bool gemmTrA, bool gemmTrB, int lda, int ldb, int ldc, Dtype dtype, const Device &device)
Definition: AddMMCUDA.cpp:17
Generic file read and write utility for python interface.