HDK
|
#include "pxr/pxr.h"
#include "pxr/base/work/threadLimits.h"
#include "pxr/base/work/api.h"
#include <tbb/blocked_range.h>
#include <tbb/parallel_for.h>
#include <tbb/parallel_for_each.h>
#include <tbb/task_group.h>
Go to the source code of this file.
Functions | |
template<typename Fn > | |
PXR_NAMESPACE_OPEN_SCOPE void | WorkSerialForN (size_t n, Fn &&fn) |
template<typename Fn > | |
void | WorkParallelForN (size_t n, Fn &&callback, size_t grainSize) |
template<typename Fn > | |
void | WorkParallelForN (size_t n, Fn &&callback) |
template<typename InputIterator , typename Fn > | |
void | WorkParallelForEach (InputIterator first, InputIterator last, Fn &&fn) |
|
inline |
void WorkParallelForN | ( | size_t | n, |
Fn && | callback, | ||
size_t | grainSize | ||
) |
WorkParallelForN(size_t n, CallbackType callback, size_t grainSize = 1)
Runs callback
in parallel over the range 0 to n.
Callback must be of the form:
void LoopCallback(size_t begin, size_t end);
grainSize specifies a minimum amount of work to be done per-thread. There is overhead to launching a thread (or task) and a typical guideline is that you want to have at least 10,000 instructions to count for the overhead of launching a thread.
void WorkParallelForN | ( | size_t | n, |
Fn && | callback | ||
) |
PXR_NAMESPACE_OPEN_SCOPE void WorkSerialForN | ( | size_t | n, |
Fn && | fn | ||
) |
WorkSerialForN(size_t n, CallbackType callback)
A serial version of WorkParallelForN as a drop in replacement to selectively turn off multithreading for a single parallel loop for easier debugging.
Callback must be of the form:
void LoopCallback(size_t begin, size_t end);