C++ Multithreading Cookbook in 2014 (publication year), that seems quite interesting, with all the new stuff from the current C++ standard. Is it what the book delivers?
Continue reading Book review: C++ Multithreading Cookbook
In the new C++ standard, multithread finally appears, with the old standard supported with TR2. This new addition has numerous implications on how programs are coded, and there are of course almost no book on this matter. This one is an exception.
Note: this review is not based on the final version that is now available (June the 28th), but on the MEAP one. There may be some differences between the final draft and the one I based my review on, although I don’t expect many, and certainly not any huge change.
Continue reading Book review: C++ Concurrency in Action: Practical Multithreading
Some months ago, I’ve decided to dig into raytracing, and more exactly interactive raytracing. So I’ve started writting my own library, based on several publications.
nVidia announced recently its own framework, Intel wants also to do raytracing on Larrabee, it is the current trend.
Continue reading Interactive RayTracer
As I have to parellize some programs developed in my new lab, I monitor CPU usage during thier execution. I do not usually need MPI to optimize them (although sometimes it is needed), only OpenMP, which means I can track /proc/ to get CPU and instantaneously memory usages.
So I wrote a small script that can be used by anyone for this purpose. I’ll explain how it works now.
Continue reading Monitoring CPU usage in multithreaded applications
I was looking for some days in SWIG documentation how I could release the GIL (Global Interpreter Lock) with SWIG. There were some macros defined in the generated code, but none was used in any place.
In fact, I just had to enable the thread support with an additional argument (-threads) and now every wrapped function releases the GIL before it is called, but that does not satisfy me. Indeed, some of my wrappers must retain the GIL while they are used (see this item). So here are the features that can be used :
- nothread enables or disables the whole thread lock for a function :
- %nothread activates the nothread feature
- %thread disables the feature
- %clearnothread clears the feature
- nothreadblock enables or disables the block thread lock for a function :
- %nothreadblock activates the nothreadblock feature
- %threadblock disables the feature
- %clearnothreadblock clears the feature
- nothreadallow enables or disables the allow thread lock for a function :
- %nothreadallow activates the nothreadallow feature
- %threadallow disables the feature
- %clearnothreadallow clears the feature
When the whole thread lock is enabled, the GIL is locked when entering the C function (with the macro SWIG_PYTHON_THREAD_BEGIN_BLOCK). Then it is released before the call to the function (with SWIG_PYTHON_THREAD_BEGIN_ALLOW), retained after the end (SWIG_PYTHON_THREAD_END_ALLOW) and finally it is released when exiting the function (SWIG_PYTHON_THREAD_END_BLOCK), after all Python result variables are created and/or modified.