Open3D (C++ API)  0.20.0
Loading...
Searching...
No Matches
Parallel.h
Go to the documentation of this file.
1// ----------------------------------------------------------------------------
2// - Open3D: www.open3d.org -
3// ----------------------------------------------------------------------------
4// Copyright (c) 2018-2026 www.open3d.org
5// SPDX-License-Identifier: MIT
6// ----------------------------------------------------------------------------
7
8#pragma once
9
10#include <atomic>
11#include <cstddef>
12
13namespace open3d {
14namespace utility {
15
23template <typename T>
24inline void AtomicAdd(std::atomic<T>& total, const T& val) noexcept {
25#ifdef __cpp_lib_atomic_float
26 total.fetch_add(val);
27#else
28 T expected = total.load(std::memory_order_relaxed);
29 while (!total.compare_exchange_weak(expected, expected + val,
30 std::memory_order_relaxed,
31 std::memory_order_relaxed)) {
32 }
33#endif
34}
35
42
45std::size_t& DefaultGrainSizeTBB() noexcept;
46
50std::size_t& DefaultGrainSizeTBB2D() noexcept;
51
62void SetMaxThreads(int num_threads);
63
64} // namespace utility
65} // namespace open3d
void SetMaxThreads(int num_threads)
Definition Parallel.cpp:52
std::size_t & DefaultGrainSizeTBB() noexcept
Definition Parallel.cpp:31
void AtomicAdd(std::atomic< T > &total, const T &val) noexcept
Definition Parallel.h:24
std::size_t & DefaultGrainSizeTBB2D() noexcept
Definition Parallel.cpp:43
int EstimateMaxThreads()
Definition Parallel.cpp:22
Definition PinholeCameraIntrinsic.cpp:16
Definition Device.h:113