Once we have installed DepSpawn, we are ready to test it in an application. For this purpose we will use the simple example code found in examples/test_subobject.cpp
. In order to compile a DepSpawn application, we need to:
-std=c++0x
or -std=c++11
), we must apply it-I
flag-L
flag-ldepspawn
) and, if desired, with the TBB (-ltbb
)DEPSPAWN_SCALABLE_POOL
was set to ON
when the library was compiled (see Installing DepSpawn), link also with -ltbbmalloc
So if for example DepSpawn has been installed in /usr/local
and our compiler does not automatically use /usr/local/include
and /usr/local/lib
to find header files and libraries, respectively, then test_subobject.cpp
would be compiled using g++
with the command
g++ -std=c++11 -I/usr/local/include -o test_subobject test_subobject.cpp -L/usr/local/lib -ldepspawn -ltbb
If DepSpawn relies on the TBB, the execution of our application requires that the TBB environment is correctly set up, as some TBB components are dynamically linked, and the TBB configuration allows to find them.
The DepSpawn runtime recognizes the following environment variables:
DEPSPAWN_NUM_THREADS
defines the number of threads to use in the execution.DEPSPAWN_TASK_QUEUE_LIMIT
defines the task queue limit as indicated by set_task_queue_limit(), described in Interface.DEPSPAWN_ENQUEUE_TASKS
, when defined, commands DepSpawn to launch tasks to execution using tbb::task::enqueue()
instead of tbb::task::spawn()
when the TBB is used. Please read the TBB manual on the differences between these task spawning methods.