"thread did not activate a task_scheduler_init object?"

"thread did not activate a task_scheduler_init object?"

I'm trying to develop an application with TBB(tbb20_20080408oss). it compiled without problems, but when i try to initialize the task scheduler it fails:

Assertion OneTimeInitializationsDone failed on line 774 of file ../../src/tbb/task.cpp

Detailed description: thread did not activate a task_scheduler_init object?


I'm using following flags (gcc 4.1):

-pg -O2 -Wall -funroll-all-loops -Winline -finline-functions -march=opteron -lnuma -ltbbmalloc_debug -ltbb_debug -lgoto_opteronp-r1.10

Can somebody help?


7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Intel Threading Building Blocks uses a thread pool to execute the tasks and has other initialization tasks that need to be performed. The way this is done in TBB is through the creation of a task_scheduler_init object whose lifetime spans the duration in the program where TBB is employed. The error listed above indicates that no task_scheduler_init object was created prior to the first TBB task initiation request. If you add something like

main(int argc, char **argv) {
tbb::task_scheduler_init init;

to your program, the error you're seeing SHOULD go away. (You'll need to add an "#include " line in the list of includes.)

The error occures on that command(task_scheduler_init init;)!

And not after that. I dont have any other commands that calls the TBB yet.

The #include... line is there too.

That's odd. Can you share a bit of your code in context to show how you're using the task_scheduler_init object? Even with just creating that object but not doing anything with it, you shouldn't see a program abort because of TBB.

#include iostream //changed due to html filter

#include "Matrix.hh"

#include "qr_decomp.hh"

#include "morton.h"

#include "time_mes.hh"

#include fstream //changed due to html filter

#include "tbb/task_scheduler_init.h"

using namespace std;

using namespace tbb;

int main ( int argc, char** argv )


int M=2048;

int N=2048;

int bs=32;

double beta1[N];

double *A;

double operations;

double *testM;

double *testV;

task_scheduler_init init; //error here


return 0;


Thanks for reporting the problem. I think I know what is the root cause. Check if changing the order of TBB libraries in the command line fixes the issue for you, i.e. use -ltbb_debug first and -ltbbmalloc_debug second. If you do not use scalable memory allocator directly, you might consider completely removing tbbmalloc from compilation command; internally, TBB will still use tbbmalloc via dlopen.

And of course we will fix the issue in one of subsequent developer updates. Thanks again!

Thank you!

Now it works.

Leave a Comment

Please sign in to add a comment. Not a member? Join today