ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ParallelFor.h File Reference
#include <Logging.h>
#include <Parallel.h>
#include <cstdint>
#include <type_traits>
#include "cloudViewer/Macro.h"
#include "cloudViewer/core/Device.h"
#include "cloudViewer/utility/Overload.h"
#include "cloudViewer/utility/Preprocessor.h"
Include dependency graph for ParallelFor.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 cloudViewer
 Generic file read and write utility for python interface.
 
 cloudViewer::core
 

Macros

#define CLOUDVIEWER_CALL_ISPC_KERNEL_(ISPCKernel, start, end, ...)
 
#define CLOUDVIEWER_OVERLOADED_LAMBDA_(T, ISPCKernel, ...)
 Internal helper macro. More...
 
#define CLOUDVIEWER_VECTORIZED(ISPCKernel, ...)
 
#define CLOUDVIEWER_TEMPLATE_VECTORIZED(T, ISPCKernel, ...)
 

Functions

template<typename func_t >
void cloudViewer::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 cloudViewer::core::ParallelFor (const Device &device, int64_t n, const func_t &func)
 
template<typename vec_func_t , typename func_t >
void cloudViewer::core::ParallelFor (const Device &device, int64_t n, const func_t &func, const vec_func_t &vec_func)
 

Macro Definition Documentation

◆ CLOUDVIEWER_CALL_ISPC_KERNEL_

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

Definition at line 204 of file ParallelFor.h.

◆ CLOUDVIEWER_OVERLOADED_LAMBDA_

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

Internal helper macro.

Definition at line 212 of file ParallelFor.h.

◆ CLOUDVIEWER_TEMPLATE_VECTORIZED

#define CLOUDVIEWER_TEMPLATE_VECTORIZED (   T,
  ISPCKernel,
  ... 
)

CLOUDVIEWER_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 CLOUDVIEWER_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.

Definition at line 246 of file ParallelFor.h.

◆ CLOUDVIEWER_VECTORIZED

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

CLOUDVIEWER_VECTORIZED(ISPCKernel, ...)

Defines a lambda function to call the provided kernel.

Use the CLOUDVIEWER_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.

Definition at line 228 of file ParallelFor.h.