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

Ptr Containers

imtrobin
Beginner
419 Views

Hi

Is there any plans to addpointer containers like boost ptr_vector? It would be better than storing a referenced counted smart pointer.

0 Kudos
8 Replies
ARCH_R_Intel
Employee
419 Views

There's no current plan to add such. Is there some way that TBB could improve upon the existing Boost implementation?

0 Kudos
AJ13
New Contributor I
419 Views
Hey,

I implemented something like that... here's a link. I plan on implementing it again now that I am more familiar with template programming, and do a better job on it. This is an older version, I have a new SVN repository that I'll get you the link for... the newer version has iterators...

http://code.google.com/p/tbbcommunity/source/browse/trunk/include/tcc/ptr_container/ptr_vector.h

I lurk on #tbb on Freenode if you need help or want to help out with some generic Boost-like components for TBB... my long-term idea is to make tbbcommunity.org something like Boost but for TBB.

AJ
0 Kudos
imtrobin
Beginner
419 Views
MADadrobiso:

There's no current plan to add such. Is there some way that TBB could improve upon the existing Boost implementation?

Yes, the boost implementation is not threadsafe. To use TBB containers with pointers, I have to store a referenced count smart pointer (boost shared_ptr), which takes more memory and slower. Boost Ptr containers was designed to avoid using STL containers with boost shared_ptr.

0 Kudos
imtrobin
Beginner
419 Views

aj.guillon@gmail.com:
Hey,

I implemented something like that... here's a link. I plan on implementing it again now that I am more familiar with template programming, and do a better job on it. This is an older version, I have a new SVN repository that I'll get you the link for... the newer version has iterators...

http://code.google.com/p/tbbcommunity/source/browse/trunk/include/tcc/ptr_container/ptr_vector.h

I lurk on #tbb on Freenode if you need help or want to help out with some generic Boost-like components for TBB... my long-term idea is to make tbbcommunity.org something like Boost but for TBB.

AJ

Cool work AJ. That is what I'm looking for. If you can addall TBB containers working, it will be fantastic. I just curious, I see you are implementing a mutex lock on STL containers, isn't it better to integrate/modify TBB container directly?

0 Kudos
AJ13
New Contributor I
419 Views
Yes it is, but I was just learning templates at the time! In fact I was also learning a lot about parallel performance, so in hind sight I might not have used a spin_lock.

I will be rebuilding the ptr_container class the "right" way very soon, and do some benchmarks with VTune to make sure it scales well. I'm waiting on a dual quad-core system to be delivered, at which point I'll be able to do some better tests and work.

Also I lurk on #tbb on freenode. Feel free to drop by if you need some help or just want to chat and hang out.

AJ
0 Kudos
imtrobin
Beginner
419 Views

I see. It's quite an effort and it's something very useful so I hope Intel can officially include a ptr container version.

Sorry. I don't go to irc much cos my timezone is at the total opposite of everyone :)

0 Kudos
AJ13
New Contributor I
419 Views
There are some people on the channel who are from the UK and Europe... might be in the same TZ as you. We can also schedule a meeting together at a certain time if required.

Also, I think that "Threading Building Blocks" has the "building blocks" part in it for just this reason. There are a lot of extra components that can be built, but it might not make sense to package them all as part of TBB itself. Once something is part of TBB, it's going to have to be tested and maintained forever.

My idea for tbbcommunity.org is to have something like Boost where all these extra packages built on TBB can reside in one place with SVN access nd documentation. People can download the pacages they need, or perhaps a tbbcommunity package can be built which bundles all the stable and useful components together. This way anyone can contribute a package for distribution... and others using TBB can download a supplementary package to make TBB more powerful.

If you are willing to collaborate, perhaps we can implement a good pointer container together?

AJ
0 Kudos
imtrobin
Beginner
419 Views

My time zone is +8, that outcast people in UK and Europe too.

Unfortunately I do not have the time or expertise to implement a good tbb container. Perhaps you can try taking the idea to be boost to be boostified, there are moredevelopers thathave more expertise about threading and container design to review and design.

0 Kudos
Reply