ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
MatmulCUDA.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 MatmulCUDA(void* A_data,
18  void* B_data,
19  void* C_data,
20  int64_t m,
21  int64_t k,
22  int64_t n,
23  Dtype dtype,
24  const Device& device) {
25  cublasHandle_t handle = CuBLASContext::GetInstance().GetHandle(device);
27  scalar_t alpha = 1, beta = 0;
28  OPEN3D_CUBLAS_CHECK(
29  gemm_cuda<scalar_t>(handle, CUBLAS_OP_N, CUBLAS_OP_N, m, n, k,
30  &alpha,
31  static_cast<const scalar_t*>(A_data), m,
32  static_cast<const scalar_t*>(B_data), k,
33  &beta, static_cast<scalar_t*>(C_data), m),
34  "cuda gemm failed");
35  });
36 }
37 
38 } // namespace core
39 } // namespace cloudViewer
#define DISPATCH_LINALG_DTYPE_TO_TEMPLATE(DTYPE,...)
Definition: LinalgUtils.h:23
ccGuiPythonInstance * GetInstance() noexcept
Definition: Runtime.cpp:72
void MatmulCUDA(void *A_data, void *B_data, void *C_data, int64_t m, int64_t k, int64_t n, Dtype dtype, const Device &device)
Definition: MatmulCUDA.cpp:17
Generic file read and write utility for python interface.