Well, this is an interesting turn of events. Intel has just released their Threading Building Blocks library as GPLv2 with the runtime exception, as opposed to it being a commercial only library. I actually ‘attended’ a webinar (ack) on TBB a few weeks ago but I didn’t pay a huge amount of attention at the time because of the commercial license and lack of OS X support, but they’ve now seemingly addressed both things. For those who don’t know, TBB is a library that provides higher-level constructs useful in threading, such as a task scheduler, various data-parallel algorithms, threaded pipelines, threadsafe containers and such – all of which adjust to the number of hardware threads on the machine at runtime and implements best-practice stuff like when to spin-wait and when to wait on an OS mutex.
I’m not sure what it’s like in practice compared to rolling your own using other libs (e.g. either direct to pthreads / Win32 threads or via an abstraction like boost::thread, which is what I use) but the fact that it’s open source means it’s considerably easier to try it out to see, or even just to get some ideas from. I’ve grabbed it but I’m always short of time – if anyone else has tried it in anger I’d love to hear what you think.
July 25th, 2007 at 10:13 am
It says “obtain the advantages of multi-core Intel processors“, but I assume that’s just Intel pushing their product, and not an actual restriction in the software.
It also says “Provides a single solution for Windows*, Linux*, and Mac OS* on 32-bit and 64-bit platforms using Intel®, Microsoft, and GNU compilers.” which makes me all warm and fuzzy inside.
There’s been a lot of buzz lately about the difficulties of multi-thread programming and it’s nice to see a major company put out an open-source effort to help with it.
And of course, the runtime GPL is very very nice.
July 25th, 2007 at 10:35 am
Having read the runtime exception, it’s not as lenient as I thought. It does free you from the regular GPL virality, but only for software that is itself ‘free’ (as in speech). It specifically says “As a special exception, you may use this file as part of a free software library without restriction. Specifically, ….”. I read that as meaning you’re fine if you incorporate it into something else which is under a free software license but not anything else. This is good, but it’s not a free for all – so they clearly still want to sell the commercial version.
July 26th, 2007 at 12:06 am
What about AMD – will it work on those?
July 26th, 2007 at 5:19 am
“What about AMD – will it work on those?”
Yes, according to responses in the forum.
I took a brief look at it. It looks to me like you can continue using traditional threading techniques to ensure thread safety, including things like boost::threads. So for example (and I’m no expert in threading) you could use a boost mutex to perform thread safety.
However, you wouldn’t use a boost thread which runs in a loop or whatever, instead you’d create a class that derives from tbb::task and override the execute() function and put code in there that you’d normally put in your thread loop.
Then you spawn a new task to execute that code on a separate thread. It’ll use its thread scheduler to determine which thread to put it on based on your hardware settings.
Seems pretty nice to me.
July 26th, 2007 at 2:09 pm
“Then you spawn a new task to execute that code on a separate thread. It’ll use its thread scheduler to determine which thread to put it on based on your hardware settings.”
Actually, that description wasn’t how I intended it.
You spawn a new task every time you want to execute the code that would normally go inside a loop. So for example, if you have some physics code that should be executed on a separate thread, you’d have a PhysicsUpdateTask and you’d create a new instance of that task every time you wanted to update the physics simulation.
July 28th, 2007 at 6:24 pm
you may use this file as part of a free software
library without restriction.
I am reading the license as you can link to the library which the file is a part of without you being forced to release your stuff under a GPL license.
It’s more commonly known as the “linking exception”.
July 28th, 2007 at 6:47 pm
That’s not what it says though. The ‘linking exception’ is _not_ the same thing as the ‘runtime exception’ I believe (that’s the problem with these things). The ‘linking exception’ is worded differently, the ‘runtime exception’ explicitly says free software. You only have to read more of the GNU site to know that they have a very explicit meaning for that, and it doesn’t include other software.
July 30th, 2007 at 10:44 pm
TBB is using the exact same license as the GNU C++ compiler does for its C++ library. It is as usable for open source and closed source libraries as gnu C++. Intel did not change the licenses at all – we just used them as is.
July 31st, 2007 at 8:37 am
Thanks for the official clarification!
I did notice that the runtime exception was from libstdc++ (which I’ve never actually read the license for before) but the wording is rather confusing, given that it explicitly says that the exception covers ‘free software’.
However it seems that the Q&A on the libstdc++ runtime exception refutes this because it says (outside the license text) “The special exception permits use of the library in proprietary applications.”.
Sorry if I confused people but personally I think the actual license text of the runtime exception (which is the one I think of as the master) is very poorly worded because it definitely talks about the exception covering ‘a free software library’, which as we all know has a very particular meaning for GNU / FSF, rather than just ‘software’. I’d personally feel more comfortable if the TBB website clarified this if I was making a proprietary app with it.
August 6th, 2007 at 1:49 am
All the FSF licenses are giant messes of confusing legalese. They seem to be under the impression that the bigger and harder to understand it is, the more likely it will seem legally enforcable. More licenses should be the same size and clarity as the ISC and BSD licenses, it would make things so much easier.