ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
LUCUDA.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 
11 
12 namespace cloudViewer {
13 namespace core {
14 
15 void LUCUDA(void* A_data,
16  void* ipiv_data,
17  int64_t rows,
18  int64_t cols,
19  Dtype dtype,
20  const Device& device) {
21  cusolverDnHandle_t handle =
22  CuSolverContext::GetInstance().GetHandle(device);
24  int len;
25  OPEN3D_CUSOLVER_CHECK(
26  getrf_cuda_buffersize<scalar_t>(handle, rows, cols, rows, &len),
27  "getrf_buffersize failed in LUCUDA");
28 
29  int* dinfo =
30  static_cast<int*>(MemoryManager::Malloc(sizeof(int), device));
31  void* workspace = MemoryManager::Malloc(len * sizeof(scalar_t), device);
32 
33  cusolverStatus_t getrf_status = getrf_cuda<scalar_t>(
34  handle, rows, cols, static_cast<scalar_t*>(A_data), rows,
35  static_cast<scalar_t*>(workspace), static_cast<int*>(ipiv_data),
36  dinfo);
37 
38  MemoryManager::Free(workspace, device);
39  MemoryManager::Free(dinfo, device);
40 
41  OPEN3D_CUSOLVER_CHECK_WITH_DINFO(getrf_status, "getrf failed in LUCUDA",
42  dinfo, device);
43  });
44 }
45 
46 } // namespace core
47 } // namespace cloudViewer
#define DISPATCH_LINALG_DTYPE_TO_TEMPLATE(DTYPE,...)
Definition: LinalgUtils.h:23
static void * Malloc(size_t byte_size, const Device &device)
static void Free(void *ptr, const Device &device)
Frees previously allocated memory at address ptr on device device.
ccGuiPythonInstance * GetInstance() noexcept
Definition: Runtime.cpp:72
void LUCUDA(void *A_data, void *ipiv_data, int64_t rows, int64_t cols, Dtype dtype, const Device &device)
Definition: LUCUDA.cpp:15
Generic file read and write utility for python interface.