Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change from tbb:task_scheduler to tbb::global_control #8

Open
wants to merge 1 commit into
base: release
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/rendering/rndr/RenderDriver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ RenderDriver::RenderDriver(const TLSInitParams &initParams) :
// building phase to that specified in the TLSInitParams. The second allows
// the render thread to take part in the rendering phase and ensures a TLS
// is created for it.
mTaskScheduler = new tbb::task_scheduler_init(int(tlsInitParams.mDesiredNumTBBThreads));
mTaskScheduler = new tbb::global_control(tbb::global_control::max_allowed_parallelism, int(tlsInitParams.mDesiredNumTBBThreads));

mFilms = alignedMallocArrayCtor<Film>(mNumFilmsAllocated, CACHE_LINE_SIZE);

Expand Down Expand Up @@ -620,7 +620,7 @@ RenderDriver::~RenderDriver()
// when building this library, and also to make sure that no other
// tbb::task_scheduler_init or other higher-level task scheduler objects
// (i.e. tbb::task_group, etc.) are active in the process.
MNRY_VERIFY(mTaskScheduler)->terminate();
// MNRY_VERIFY(mTaskScheduler)->terminate();
delete mTaskScheduler;

cleanUpTLS();
Expand Down Expand Up @@ -2427,7 +2427,7 @@ RenderDriver::renderThread(RenderDriver *driver,
// task scheduler used for rendering. By creating a new task scheduler
// instance here, we are allowing this thread to take part in rendering work
// (tbb will spawn tasks on this thread when invoked from this thread.)
tbb::task_scheduler_init scheduler(int(initParams.mDesiredNumTBBThreads));
tbb::global_control scheduler(tbb::global_control::max_allowed_parallelism, int(initParams.mDesiredNumTBBThreads));

// TLS initialization.
initTLS(initParams);
Expand Down Expand Up @@ -2467,7 +2467,7 @@ RenderDriver::renderThread(RenderDriver *driver,
case KILL_RENDER_THREAD:
// This is a sub-tbb scheduler init, we still have the main one to
// clean up later, which happens in the RenderDriver destructor.
scheduler.terminate();
// scheduler.terminate();
driver->mRenderThreadState.set(KILL_RENDER_THREAD, DEAD);
quit = true;
break;
Expand Down
4 changes: 2 additions & 2 deletions lib/rendering/rndr/RenderDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <scene_rdl2/common/grid_util/Parser.h>
#include <scene_rdl2/render/util/AtomicFloat.h>

#include <tbb/task_scheduler_init.h>
#include <tbb/global_control.h>

//#define SINGLE_THREAD_CRAWLALLPIXELS

Expand Down Expand Up @@ -766,7 +766,7 @@ class RenderDriver
std::unique_ptr<TileScheduler> mTileSchedulerCheckpointInitEstimation;
TileWorkQueue mTileWorkQueue;

tbb::task_scheduler_init *mTaskScheduler;
tbb::global_control *mTaskScheduler;

// The is the per film sample count, NOT the cumulative sample count over
// all films.
Expand Down
2 changes: 0 additions & 2 deletions tests/lib/rendering/pbr/TestLightSetSampler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
#include <scene_rdl2/common/math/Math.h>
#include <scene_rdl2/render/util/Arena.h>

#include <tbb/task_scheduler_init.h>


// to iterate over the [0, 1)^2 space we take (NUM_SAMPLES_PER_AXIS * NUM_SAMPLES_PER_AXIS) samples
#define NUM_SAMPLES_PER_AXIS 1000
Expand Down