Step one
Start Delphi XE.
Step Two
Create simple project.
Start Delphi XE.
Create simple project.
In my last post, I’ve presented an overview of classes hiding behind the parallel for implementation. Today I’ll focus on the input part of the parallel for – the part that fetches values the loop is iterating over and passes them to parallel tasks. More specifically, I’ll present source providers, data managers and local queue.
Today is the day to fulfill that promise.
This article starts the journey that will (hope, hope) explain the murky waters of parallel loop data management. Three parts are planned – Overview (which you are reading now), Input and Output.
Even if you are interested in parallel programming, you may think that such low-level stuff is of no interest to you. Well, you may be right, but let me state three reasons why you should read this three-part series.
1) Because you will then know what the OtlDataManager unit is good for and will be able to use it in your application.
2) Because it’s an interesting topic ;)
3) So I can convince you that Parallel.ForEach is better than home-brew multithreaded parallel loops and that you should always use OmniThreadLibrary ;)
Ready?
A lifetime ago when I was still programming on two 1280 × 1024 monitors I’ve published a post about the IDE layout I was using at that time (in Delphi 2006).
I was always saying that there’s only one reason why a programmer should use two monitors – because (s)he has no place for the third one! So when the opportunity knocked I did the same – cleaned up some place on the desk and installed a 1920 × 1200 monitor in the middle.
GpLists 1.49: Implemented TGpGUIDList, a TGUID list.
GpStructuredStorage 2.0c: Uses GpStreams instead of (deprecated) GpMemStr.
Erik Berry fixed GpTextStream and GpLists to compile with Delphi 6; those changes were committed to SVN only.
See you around in 2011 – with some luck maybe even in person.
[Picture of the living room wall taken by my trusty Panasonic Lumix DMC-LX5 and heavily processed in Adobe Photoshop Lightroom 3.]
As always, all units are available on the Google Code.
It was only three days ago that I released the new OTL and already I’ve got a gift – and it came from the other side of the world, from a place so far ago that Google Maps doesn’t know how to calculate directions to guide me there, from Australia!
No, I’m not kidding about the Google Maps.
Inside were books, books and more books. Chris, thanks a lot!
OmniThreadLibrary 1.05 was a great success …
… but all good things must come to an end. Don’t worry, I’m not ending the project. It’s just that there’s a new player in town. Ladies and gentlemen, in the left corner I give you …
… OmniThreadLibrary 2.0! Get it while its hot!
Only few things to do before the alpha release:
Thanks to the great people of DevJET software there may something (finally) happen on the very much neglected documentation front. They have donated a Documentation Insight license to the OmniThreadLibrary and I intend to use it to add documentation here and there while I’m working on the project.
A big Thank You to the DevJET!
The next part of the puzzle is how to export XmlDoc documentation into some useful form. I know Delphi XE can do html+javascript export but I don’t believe that it’s included in the Professional release which I have (but correct me if I’m wrong). It would be even better if it could be converted into the Wiki format used by the Google Code. Can you help me with suggestions?
The OtlParallel unit in OmniThreadLibrary offers some high-level solutions that allow you to easily run some kinds of processes in parallel. Up to now it supported self-contained background calculations (Parallel.Future), independent parallel processes (Parallel.Join) and loop calculations where the background task is stateless (i.e. it only depends on the input – the loop value – and not on calculations done on other inputs – loop values; Parallel.ForEach). But lots of time processes don’t fall into any of those categories.
Mason Wheeler recently suggested adding support for multistage processes. Over the weekend I’ve implemented it in the OmniThreadLibrary and now this feature is ready for you to start testing. Great thanks to Mason for his suggestion and also for work on the implementation and design of newly introduced Parallel.Pipeline.
ITDevCon has finished almost a 24 hours ago but I was simply too tired to write anything about it until now. In short – great event!
There was close to 50 participants and sessions were in most cases nicely filled up. Three tracks were running in parallel and sometimes it was quite hard to choose the most interesting session. I was quite sad as I was not able to see any of Alexander Alexeev’s sessions on debugging (the first one overlapped with my own session and in the second case seeing Ray Konopka speaking of user interface design trumped all other options). Besides Ray session which was definitely the best on the ITDevCon (Ray told me to say so ;) ) I have to mention PaweÅ‚’s expose on DataSnap and Thierry’s multitouch session which were both very interesting.
“No valid license information found for Embarcadero(R) Delphi(R) XE.The funny thing was that my registration count got incremented nevertheless! Of course I only noticed this after five failed installs when the sixth attempt told me that I’ve used my installation bonus and I can install no more Delphis :( Most probably there was some clash between the fresh Delphi XE installation, previous trial version and pre-previous [sorry I can’t tell you about it] version. Of course, I did try to fully remove all remnants of all installations but obviously I missed some important part.
You must provide a valid serial number in order to use Embarcadero(R)
Delphi(R) XE. Do you want to run the registration wizard again?”
I’m trying to uninstall Delphi XE so “Embarcadero RAD Studio XE” would be a better choice.2. Remove the C:\Program Files\Codegear\Rad Studio\8.0 directory
Actually, folder is named \Embarcadero\, not \Codegear\.3. Remove the C:\Users\Public\Public Documents\Rad Studio directory
That would trash the Delphi 2010 install. Only 8.0 subfolder has to be removed.4. Remove the c:\ProgramData\CodeGear\Rad Studio\8.0 directory
Again, it’s \Embarcadero\.5. Remove the HKEY_LOCAL_MACHINE\SOFTWARE\CodeGear\BDS\8.0 registry key
Same here.6. Remove the HKEY_CURRENT_USER\SOFTWARE\CodeGear\BDS\8.0 registry key
And here.7. Remove the
Embarcadero RAD Studio XE, not CodeGear RAD Studio 2010.9. Remove folders with a GUID name in C:\Documents and Settings\All Users\Application Data\
In item 3, C:\Users was used. Here, C:\Documents and Settings. On every computer, one of those will not be the correct choice.9a. You can find the specific GUID folder names to remove by browsing to the subkeys of HKEY_LOCAL_MACHINE\Software\MimarSinan\InstallAware\Ident.Cache\
In Delphi XE, those files end in 150, not 120. And on a 64-bit system they live in \Windows\SysWOW64.10d. bdeadmin.*
This article was originally written for the Blaise Pascal Magazine and was published in Issue #5.
Relevant Delphi code is available at http://17slon.com/blogs/gabr/BPM/RealWorldEnumerators.zip
This article was originally written for the Blaise Pascal Magazine and was published in Issue #4.
Relevant Delphi code is available at http://17slon.com/blogs/gabr/BPM/AdvancedEnumerators.zip.
This article was originally written for the Blaise Pascal Magazine and was published in Issue #3.
Delphi 2007.
Conditional symbols:
16 symbols.
257 characters in total.
Too many? Was Delphi 2007 built in DOS times?
Can somebody please check this with Delphi XE?
const fm: array[Boolean] of Word = (fmCreate, fmOpenWrite); fs := TFileStream.Create(fileName, fm[FileExists(fileName)]);
While I was on vacation, Robert published a recording of my OmniThreadLibrary webinar. Happy downloading!