Community
cancel
Showing results for 
Search instead for 
Did you mean: 
nsa666
Beginner
131 Views

"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?
Aborted

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?
Thanks!
0 Kudos
6 Replies
robert-reed
Valued Contributor II
131 Views

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

nsa666
Beginner
131 Views

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.
robert-reed
Valued Contributor II
131 Views

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.
nsa666
Beginner
131 Views

#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;
double *A;
double operations;
double *testM;
double *testV;
task_scheduler_init init; //error here
...my_functions();
return 0;
}
Alexey_K_Intel3
Employee
131 Views

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!

nsa666
Beginner
131 Views

Thank you!

Now it works.

Reply