Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
2464 Discussions

The advantage of TBB memory allocator for serial algorithm

yanling_zhisina_com
244 Views

Hi,
As can be seen in Tutorial.pdf about TBB, the TBBmemory allocator is designed for parallel programming including scalable_allocator and cache_aligned_allocator. I use TBB memory allocator by the automatic replacement method (set LD_PRELOAD environment variable). What surprises me is that it speedup my serial program by 80%. BTW, my serial program consumes about 2.6G memory.
So can anyone tell me what does TBB memory allocator do to allocat memory so effeciently, compared with the STL memory allocator? Thanks.

0 Kudos
1 Solution
Alexey-Kukanov
Employee
244 Views

Hi,
As can be seen in Tutorial.pdf about TBB, the TBBmemory allocator is designed for parallel programming including scalable_allocator and cache_aligned_allocator. I use TBB memory allocator by the automatic replacement method (set LD_PRELOAD environment variable). What surprises me is that it speedup my serial program by 80%. BTW, my serial program consumes about 2.6G memory.
So can anyone tell me what does TBB memory allocator do to allocat memory so effeciently, compared with the STL memory allocator? Thanks.


Most likely, such a significant speedup for the serial program is not only due to faster allocation but also better cache utilization. The allocator does its best to re-allocate recently freed space with the same or "close enough" allocation size.For some applications, especially allocating lots of similar-sized small objects, it can make significant difference; but this can not be guaranteed.

View solution in original post

0 Kudos
2 Replies
Alexey-Kukanov
Employee
245 Views

Hi,
As can be seen in Tutorial.pdf about TBB, the TBBmemory allocator is designed for parallel programming including scalable_allocator and cache_aligned_allocator. I use TBB memory allocator by the automatic replacement method (set LD_PRELOAD environment variable). What surprises me is that it speedup my serial program by 80%. BTW, my serial program consumes about 2.6G memory.
So can anyone tell me what does TBB memory allocator do to allocat memory so effeciently, compared with the STL memory allocator? Thanks.


Most likely, such a significant speedup for the serial program is not only due to faster allocation but also better cache utilization. The allocator does its best to re-allocate recently freed space with the same or "close enough" allocation size.For some applications, especially allocating lots of similar-sized small objects, it can make significant difference; but this can not be guaranteed.
0 Kudos
yanling_zhisina_com
244 Views

Hi,
As can be seen in Tutorial.pdf about TBB, the TBBmemory allocator is designed for parallel programming including scalable_allocator and cache_aligned_allocator. I use TBB memory allocator by the automatic replacement method (set LD_PRELOAD environment variable). What surprises me is that it speedup my serial program by 80%. BTW, my serial program consumes about 2.6G memory.
So can anyone tell me what does TBB memory allocator do to allocat memory so effeciently, compared with the STL memory allocator? Thanks.


Most likely, such a significant speedup for the serial program is not only due to faster allocation but also better cache utilization. The allocator does its best to re-allocate recently freed space with the same or "close enough" allocation size.For some applications, especially allocating lots of similar-sized small objects, it can make significant difference; but this can not be guaranteed.

Got it. Thank you very much.

0 Kudos
Reply