ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
LUSYCL.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 <sycl/sycl.hpp>
9 
10 #include "cloudViewer/core/Blob.h"
14 #include "oneapi/mkl.hpp"
15 
16 namespace cloudViewer {
17 namespace core {
18 
19 void LUSYCL(void* A_data,
20  void* ipiv_data,
21  int64_t m,
22  int64_t n,
23  Dtype dtype,
24  const Device& device) {
25  using namespace oneapi::mkl;
26  sycl::queue queue = sy::SYCLContext::GetInstance().GetDefaultQueue(device);
27  int64_t lda = m;
29  // Use blob to ensure cleanup of scratchpad memory.
30  int64_t scratchpad_size =
31  lapack::getrf_scratchpad_size<scalar_t>(queue, m, n, lda);
32  core::Blob scratchpad(scratchpad_size * sizeof(scalar_t), device);
33  lapack::getrf(queue, m, n, static_cast<scalar_t*>(A_data), lda,
34  static_cast<int64_t*>(ipiv_data),
35  static_cast<scalar_t*>(scratchpad.GetDataPtr()),
36  scratchpad_size)
37  .wait_and_throw();
38  });
39 }
40 
41 } // namespace core
42 } // namespace cloudViewer
#define DISPATCH_LINALG_DTYPE_TO_TEMPLATE(DTYPE,...)
Definition: LinalgUtils.h:23
SYCL queue manager.
void * GetDataPtr()
Definition: Blob.h:75
static SYCLContext & GetInstance()
Get singleton instance.
Definition: SYCLContext.cpp:25
sycl::queue GetDefaultQueue(const Device &device)
Get the default SYCL queue given an CloudViewer device.
Definition: SYCLContext.cpp:43
void LUSYCL(void *A_data, void *ipiv_data, int64_t m, int64_t n, Dtype dtype, const Device &device)
Definition: LUSYCL.cpp:19
Generic file read and write utility for python interface.