users > CMTK 1.7 will support Grand Central Dispatch
Showing 1-5 of 5 posts
Mar 4, 2011 11:03 PM | Torsten Rohlfing
CMTK 1.7 will support Grand Central Dispatch
To all CMTK users on the MacOS platform -
Starting with the next version, 1.7.0, CMTK will support Apple's Grand Central Dispatch for parallel computation. Among other benefits, this will also help replace OpenMP on this platform, which is broken when building shared libraries.
The current svn/trunk code base already contains much of the upcoming GCD functionality, so if you are interested, feel free to start testing. Feedback will be very welcome!
Torsten
Starting with the next version, 1.7.0, CMTK will support Apple's Grand Central Dispatch for parallel computation. Among other benefits, this will also help replace OpenMP on this platform, which is broken when building shared libraries.
The current svn/trunk code base already contains much of the upcoming GCD functionality, so if you are interested, feel free to start testing. Feedback will be very welcome!
Torsten
Mar 5, 2011 03:03 AM | Torsten Rohlfing
RE: CMTK 1.7 will support Grand Central Dispatch
Status update - GCD computation in the current svn trunk (r2962)
seems quite broken, so don't bother testing. New developments will
be posted here.
Mar 8, 2011 06:03 AM | Torsten Rohlfing
RE: CMTK 1.7 will support Grand Central Dispatch
Okay, here we go - trunk at svn/r2966 now seems to be working using
GCD. Essentially, whatever computation is otherwise using CMTK's
built-in thread pool will now use GCD on OS-X 10.6 and higher by
default. Code parallelized using OpenMP will be gradually ported to
GCD as much as possible (Note that Apple's current compiler cannot
"dispatch" from class or function templates, so there are some
functions that cannot be ported to GCD at this time). Guess this
post should have gone to the developers forum instead ;)
Mar 8, 2011 07:03 AM | Greg Jefferis
RE: CMTK 1.7 will support Grand Central
Dispatch
Hi Torsten,
This sounds interesting. Will this be more efficient than the OpenMP
functionality? I believe there are BSD and linux (Debian) ports of
various stages of maturity, so is it an option on other platforms?
Is there a big difference between OpenMP and pthreads operation on Mac?
Best,
Greg.
This sounds interesting. Will this be more efficient than the OpenMP
functionality? I believe there are BSD and linux (Debian) ports of
various stages of maturity, so is it an option on other platforms?
Is there a big difference between OpenMP and pthreads operation on Mac?
Best,
Greg.
Mar 8, 2011 05:03 PM | Torsten Rohlfing
RE: CMTK 1.7 will support Grand Central Dispatch
Hi Greg:
The main advantage for now is that OpenMP is broken with shared library builds on OSX, whereas GCD appears to work with shared libs. So we can now get parallelization where previously we could not. Also, when you run multiple parallel applications on the same multi-CPU system, you should system-wide load balancing with GCD, which you don't with OpenMP, so you could get better overall resource utilization.
In terms of efficiency, there should be little difference. To some degree, OpenMP is actually more idiot-proof, so for me, GCD may be less efficient in some cases due to poor application. As an example, when you parallelize a loop with many but cheap iterations, in OpenMP you simply put the usual pragma and that's it. In GCD, you want to compute a stride size for the loop first and thus cut it into larger blocks, otherwise each iteration will be submitted separately to a thread, which is inefficient in this scenario.
The final disadvantage of GCD so far is that, at least until I get my hands on XCode4, you cannot "dispatch" parallel sections from function templates or member functions of class templates, which means that some OpenMP-parallel code in CMTK right now cannot be ported to GCD at all. This affects, for example, the deblurring super-resolution volume reconstruction, which is in a class templated over the point spread function kernel shape.
TR
The main advantage for now is that OpenMP is broken with shared library builds on OSX, whereas GCD appears to work with shared libs. So we can now get parallelization where previously we could not. Also, when you run multiple parallel applications on the same multi-CPU system, you should system-wide load balancing with GCD, which you don't with OpenMP, so you could get better overall resource utilization.
In terms of efficiency, there should be little difference. To some degree, OpenMP is actually more idiot-proof, so for me, GCD may be less efficient in some cases due to poor application. As an example, when you parallelize a loop with many but cheap iterations, in OpenMP you simply put the usual pragma and that's it. In GCD, you want to compute a stride size for the loop first and thus cut it into larger blocks, otherwise each iteration will be submitted separately to a thread, which is inefficient in this scenario.
The final disadvantage of GCD so far is that, at least until I get my hands on XCode4, you cannot "dispatch" parallel sections from function templates or member functions of class templates, which means that some OpenMP-parallel code in CMTK right now cannot be ported to GCD at all. This affects, for example, the deblurring super-resolution volume reconstruction, which is in a class templated over the point spread function kernel shape.
TR