Open3D (C++ API)  0.18.0+5c982c7
Namespaces | Macros | Functions
ParallelFor.h File Reference

(5c982c7 (Thu Apr 18 12:15:13 2024 -0700))

#include <cstdint>
#include <type_traits>
#include "open3d/core/Device.h"
#include "open3d/utility/Logging.h"
#include "open3d/utility/Overload.h"
#include "open3d/utility/Parallel.h"
#include "open3d/utility/Preprocessor.h"

Go to the source code of this file.

Namespaces

 open3d
 
 open3d::core
 

Macros

#define OPEN3D_CALL_ISPC_KERNEL_(ISPCKernel, start, end, ...)
 
#define OPEN3D_OVERLOADED_LAMBDA_(T, ISPCKernel, ...)
 Internal helper macro. More...
 
#define OPEN3D_VECTORIZED(ISPCKernel, ...)
 
#define OPEN3D_TEMPLATE_VECTORIZED(T, ISPCKernel, ...)
 

Functions

template<typename func_t >
void open3d::core::ParallelForCPU_ (const Device &device, int64_t n, const func_t &func)
 Run a function in parallel on CPU. More...
 
template<typename func_t >
void open3d::core::ParallelFor (const Device &device, int64_t n, const func_t &func)
 
template<typename vec_func_t , typename func_t >
void open3d::core::ParallelFor (const Device &device, int64_t n, const func_t &func, const vec_func_t &vec_func)
 

Macro Definition Documentation

◆ OPEN3D_CALL_ISPC_KERNEL_

#define OPEN3D_CALL_ISPC_KERNEL_ (   ISPCKernel,
  start,
  end,
  ... 
)
Value:
"ISPC module disabled. Unable to call vectorized kernel {}", \
OPEN3D_STRINGIFY(ISPCKernel));
#define LogError(...)
Definition: Logging.h:48
#define OPEN3D_STRINGIFY(s)
Definition: Preprocessor.h:32

◆ OPEN3D_OVERLOADED_LAMBDA_

#define OPEN3D_OVERLOADED_LAMBDA_ (   T,
  ISPCKernel,
  ... 
)
Value:
[&](T, int64_t start, int64_t end) { \
OPEN3D_CALL_ISPC_KERNEL_( \
OPEN3D_CONCAT(ISPCKernel, OPEN3D_CONCAT(_, T)), start, end, \
__VA_ARGS__); \
}
#define OPEN3D_CONCAT(s1, s2)
Definition: Preprocessor.h:26

Internal helper macro.

◆ OPEN3D_TEMPLATE_VECTORIZED

#define OPEN3D_TEMPLATE_VECTORIZED (   T,
  ISPCKernel,
  ... 
)
Value:
[&](int64_t start, int64_t end) { \
static_assert(std::is_arithmetic<T>::value, \
"Data type is not an arithmetic type"); \
OPEN3D_OVERLOADED_LAMBDA_(bool, ISPCKernel, __VA_ARGS__), \
OPEN3D_OVERLOADED_LAMBDA_(uint8_t, ISPCKernel, __VA_ARGS__), \
OPEN3D_OVERLOADED_LAMBDA_(int8_t, ISPCKernel, __VA_ARGS__), \
OPEN3D_OVERLOADED_LAMBDA_(uint16_t, ISPCKernel, __VA_ARGS__), \
OPEN3D_OVERLOADED_LAMBDA_(int16_t, ISPCKernel, __VA_ARGS__), \
OPEN3D_OVERLOADED_LAMBDA_(uint32_t, ISPCKernel, __VA_ARGS__), \
OPEN3D_OVERLOADED_LAMBDA_(int32_t, ISPCKernel, __VA_ARGS__), \
OPEN3D_OVERLOADED_LAMBDA_(uint64_t, ISPCKernel, __VA_ARGS__), \
OPEN3D_OVERLOADED_LAMBDA_(int64_t, ISPCKernel, __VA_ARGS__), \
OPEN3D_OVERLOADED_LAMBDA_(float, ISPCKernel, __VA_ARGS__), \
OPEN3D_OVERLOADED_LAMBDA_(double, ISPCKernel, __VA_ARGS__), \
[&](auto&& generic, int64_t start, int64_t end) { \
"Unsupported data type {} for calling " \
"vectorized kernel {}", \
typeid(generic).name(), \
OPEN3D_STRINGIFY(ISPCKernel)); \
})(T{}, start, end); \
}
#define OPEN3D_OVERLOADED_LAMBDA_(T, ISPCKernel,...)
Internal helper macro.
Definition: ParallelFor.h:204
std::string name
Definition: FilePCD.cpp:39
const char const char value recording_handle imu_sample recording_handle uint8_t size_t data_size k4a_record_configuration_t config target_format k4a_capture_t capture_handle k4a_imu_sample_t imu_sample playback_handle k4a_logging_message_cb_t void min_level device_handle k4a_imu_sample_t timeout_in_ms capture_handle capture_handle capture_handle image_handle temperature_c k4a_image_t image_handle uint8_t image_handle image_handle image_handle image_handle uint32_t
Definition: K4aPlugin.cpp:548
const char const char value recording_handle imu_sample recording_handle uint8_t size_t data_size k4a_record_configuration_t config target_format k4a_capture_t capture_handle k4a_imu_sample_t imu_sample uint64_t
Definition: K4aPlugin.cpp:343
const char const char value recording_handle imu_sample recording_handle uint8_t size_t data_size k4a_record_configuration_t config target_format k4a_capture_t capture_handle k4a_imu_sample_t imu_sample playback_handle k4a_logging_message_cb_t void min_level device_handle k4a_imu_sample_t int32_t
Definition: K4aPlugin.cpp:395
Overloaded< Ts... > Overload(Ts... ts)
Definition: Overload.h:55

OPEN3D_TEMPLATE_VECTORIZED(T, ISPCKernel, ...)

Defines a lambda function to call the provided template-like kernel. Supported types:

  • bool
  • unsigned + signed {8,16,32,64} bit integers,
  • float, double

Use the OPEN3D_EXPORT_TEMPLATE_VECTORIZED macro to define the kernel in the ISPC source file.

Note: The arguments to the kernel only have to exist if ISPC support is enabled via BUILD_ISPC_MODULE=ON.

◆ OPEN3D_VECTORIZED

#define OPEN3D_VECTORIZED (   ISPCKernel,
  ... 
)
Value:
[&](int64_t start, int64_t end) { \
OPEN3D_CALL_ISPC_KERNEL_(ISPCKernel, start, end, __VA_ARGS__); \
}

OPEN3D_VECTORIZED(ISPCKernel, ...)

Defines a lambda function to call the provided kernel.

Use the OPEN3D_EXPORT_TEMPLATE_VECTORIZED macro to define the kernel in the ISPC source file.

Note: The arguments to the kernel only have to exist if ISPC support is enabled via BUILD_ISPC_MODULE=ON.