ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
ArangeSYCL.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 "
cloudViewer/core/Dispatch.h
"
9
#include "
cloudViewer/core/SYCLContext.h
"
10
#include "
cloudViewer/core/Tensor.h
"
11
#include "
cloudViewer/core/kernel/Arange.h
"
12
13
namespace
cloudViewer
{
14
namespace
core {
15
namespace
kernel {
16
17
void
ArangeSYCL
(
const
Tensor
& start,
18
const
Tensor
& stop,
19
const
Tensor
& step,
20
Tensor
& dst) {
21
Dtype
dtype = start.
GetDtype
();
22
sycl::queue queue =
23
sy::SYCLContext::GetInstance
().
GetDefaultQueue
(start.
GetDevice
());
24
DISPATCH_DTYPE_TO_TEMPLATE
(dtype, [&]() {
25
scalar_t sstart = start.
Item
<scalar_t>();
26
scalar_t sstep = step.
Item
<scalar_t>();
27
scalar_t* dst_ptr = dst.
GetDataPtr
<scalar_t>();
28
int64_t n = dst.
GetLength
();
29
queue.parallel_for(n, [=](int64_t i) {
30
dst_ptr[i] = sstart +
static_cast<
scalar_t
>
(sstep * i);
31
}).wait_and_throw();
32
});
33
}
34
35
}
// namespace kernel
36
}
// namespace core
37
}
// namespace cloudViewer
Arange.h
Dispatch.h
DISPATCH_DTYPE_TO_TEMPLATE
#define DISPATCH_DTYPE_TO_TEMPLATE(DTYPE,...)
Definition:
Dispatch.h:31
SYCLContext.h
SYCL queue manager.
Tensor.h
cloudViewer::core::Dtype
Definition:
Dtype.h:21
cloudViewer::core::Tensor
Definition:
Tensor.h:32
cloudViewer::core::Tensor::Item
T Item() const
Definition:
Tensor.h:618
cloudViewer::core::Tensor::GetLength
int64_t GetLength() const
Definition:
Tensor.h:1125
cloudViewer::core::Tensor::GetDtype
Dtype GetDtype() const
Definition:
Tensor.h:1164
cloudViewer::core::Tensor::GetDataPtr
T * GetDataPtr()
Definition:
Tensor.h:1144
cloudViewer::core::Tensor::GetDevice
Device GetDevice() const override
Definition:
Tensor.cpp:1435
cloudViewer::core::sy::SYCLContext::GetInstance
static SYCLContext & GetInstance()
Get singleton instance.
Definition:
SYCLContext.cpp:25
cloudViewer::core::sy::SYCLContext::GetDefaultQueue
sycl::queue GetDefaultQueue(const Device &device)
Get the default SYCL queue given an CloudViewer device.
Definition:
SYCLContext.cpp:43
cloudViewer::core::kernel::ArangeSYCL
void ArangeSYCL(const Tensor &start, const Tensor &stop, const Tensor &step, Tensor &dst)
Definition:
ArangeSYCL.cpp:17
cloudViewer
Generic file read and write utility for python interface.
Definition:
AutoSegmentationTools.h:16
libs
cloudViewer
core
kernel
ArangeSYCL.cpp
Generated on Wed Jan 28 2026 09:00:54 for ACloudViewer by
1.9.1