Community
cancel
Showing results for 
Search instead for 
Did you mean: 
imtrobin
Beginner
36 Views

Ptr Containers

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
36 Views

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

AJ13
New Contributor I
36 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
imtrobin
Beginner
36 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.

imtrobin
Beginner
36 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?

AJ13
New Contributor I
36 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
imtrobin
Beginner
36 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 :)

AJ13
New Contributor I
36 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
imtrobin
Beginner
36 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.