Auto-Parallelizing Compiler From Codeplay
Max Romantschuk writes "Parallelization of code can be a very tricky thing. We've all heard of the challenges with Cell, and with dual and quad core processors this is becoming an ever more important issue to deal with. The Inquirer writes about a new auto-parallelizing compiler called Sieve from Codeplay: 'What Sieve is is a C++ compiler that will take a section of code and parallelize it for you with a minimum hassle. All you really need to do is take the code you want to run across multiple CPUs and put beginning and end tags on the parts you want to run in parallel.' There is more info on Sieve available on Codeplay's site."
Forgive me if I'm wrong (I've not coded parallel things before), but if the code is re-entrant, does this go a long way towards running the code in parallel? Obviously there are other factors involved here, like addressing memory, but this is thought of in re-entrant programming. I'm not sure what the difference is... please enlighten me :-)
Frtprallps
is arle ot
I loved 'Clocks'. Oh wait, Codeplay...not Coldplay.
Nevermind.
Oh look. A duck.
The opposite of progress is congress
and what the difference between this and openMP ?
And call it "automatic" while we're at it.
Shouldn't this be at http://ads.slashdot.org/ instead of http://it.slashdot.org?
The compiler will put out code for x86, Ageia PhysX and Cell/PS3. There were three tests talked about today, CRC, Julia Ray Tracing and Matrix Multiply. All were run on 8 cores (2S Xeon 5300 CPUs) and showed 739, 789 and 660% speedups respectively.
That's great - but do the algorithms involved here naturally lend themselves to the parallelization techniques the compiler uses? Are there algorithms that are very poor choices for parallelization? For example, can you effectively parallelize a sort? Wouldn't each thread have to avoid exchanging data elements any other thread was working on, and therefore cause massive synchronization issues? A solution might be to divide the data set by the number of threads and then after each set was sorted merge them in order - but that requires more code tweaking than the summary implies. So I wonder how different this is from Open/MT?
You got it.
- Adam L. Beberg - The Cosm Project - http://www.mithral.com/
I think anybody who is claiming to get decent automatic parallelization out of C/C++ is selling snake oil. Even if a strict reading of the C/C++ standard ends up letting you do something useful, in my experience, real C/C++ programmers make so many assumptions that you can't parallelize their programs without breaking them.
1: OpenMP is supported by Sun, Intel, IBM, $MS(?) etc, and implemented in gcc 4.2.
2: OpenMP has been used successfully for about 10 years now, and is on a 2.5 release of the SPEC.
3. It is Open - the white paper for Codeplay mentions it being protected by patents. (boo hiss)
4. Did I mention that it is supported in gcc 4.2 which I built it on my Powerbook last week and it is very cool?
So maybe Codeplay is a nice system. Maybe they even have users and can offer support. But if you are looking to make your C++ code run multi-threaded with the least amount of effort I've seen ( It is still effort! ) take a look at OpenMP. In my simple tests it was pretty easy to make use of OpenMP, and I am looking forward to trying it on a rather more complicated application.
I'm impressed. The website you are pimping by posting dozens of inane comments to /. doesn't even have any ads on it.
Nerd rage is the funniest rage.
For the majority of apps, OpenMP is enough. That is what this looks like - a proprietary OpenMP. It might make it easier than creating and managing your own threads but calling it "auto" parallelizing when you need to mark what to execute in parallel is a bit of a stretch.
For apps that need more, it is probably a big enough requirement that someone knowledgable is already on the coding team. Which isn't to say that a compiler/lang/lib lowering the "experience required" bar wouldn't be welcomed, just that I wish these people would work on solving some new problems instead of re-tackling old ones.
The main purpose of these extensions seems to be finding a way to restrict the noob developer enough that they won't be able to abuse threading like some apps love to do. That is a very good thing in my book! (Think Freenet, where 200-600 threads is normal.)
Website Hosting
Yep, it's in there.
And it works, too.
So, anything within the loop (using your example) cannot depend on i-1 being known? So, for the loop:
;-)
for (i = 0; i doSomething (i);
doSomething() cannot know or infer i-1. Is that right? So doSomething() really has to regard i as (almost) random. So the loop becomes:
for (i = 0; i doSomething (uniqueRand (i/RANDMAX*100);
No wonder it's so complicated and hard to debug
In Capitalist West no hassle for you to submit slashvertisement about faster proprietary compiler.
In Soviet Russia no hassle to get compiler source code as slashvertisement links to you.
Domestic spying is now "Benign Information Gathering"
I have my 'Mips Pro Auto Parallellizing Option 7.2.1' cd sitting right next to my Irix 6.5 machine... and I know it's YEARS old
"When life gives you lemons, don't make lemonade. Make life take the lemons back!" -- Cave Johnson
For what I have seen is that this system just parallelizes only the part of the code in sieve instead of the whole code. How is this better than others. Please can someone enlighten me on that.
Our SGI compilers at work come with an -apo (automatic parallization optimization) command line option. That one option cost us a pretty penny. It's nice to see other people getting in on the action.
Snippet from the manpage, highlighting is mine:
Trolling is a art,
I'm no parallelization expert but it seems to me that a compiler that reliably gives you a scaling factor above 80% would be a huge deal. Is it really possible to achieve those kind of results across the board? Or is this a bunch of bull.
Let's see if I can teach any old dogs some new trix.
r amming.pdf
Here is a quote from the SmartVariables white-paper:
"The GPL open-source SmartVariables technology works well as a replacement for both MPI and PVM based systems, simplifying such applications. Systems built with SmartVariables don't need to worry about explicit message passing. New tasks can be invoked by using Web-Service modules. Programs always work directly with named-data, in parallel. Tasks are easily sub-divided and farmed out to additional web-services, as needed - without worry of breaking the natural parallelism. If two or more tasks ever access data of the same name and location, then that data is automatically shared between them - without need for additional parallel programming constructs. Instead of using configuration files with lists of available machines, a shared SmartVariables List object (with a commonly accepted name, like "machines@localhost") could easily hold the available host names, which can then be used for dynamic task allocation. The end-result is that SmartVariables-based parallel systems need only reference and work with distributed data, and don't need to manage it. Automatic sharing means there is no need to worry about explicit connection, infrastructure, or message-passing code. Instead, applications only need agree on the names used for their data. Names and object locations are easily managed by using a SmartVariables based Directory-Service as an additional layer of object indirection."
The rest of this paper is here: http://www.smartvariables.com/doc/DistributedProg
A single code-base works on Apple / Linux / Windows.
Complete code and docs at http://smartvariables.com/
I read the article, the information at the company's web site and even white papers written on the compiler. And although I did see one reference to "Multiple computers across a network (e.g. a "grid")" there was no other mention of it.
When I think of Parallelizing software, after getting over my humors mind thinking of a virus that paralyzes users, what comes to mind is clustering. When I think of clustering the train of thought directs me to Beowulf and MPI or it's predecessor PVM. Though I can find no information that supports the concept of clustering in any manner.
Again I did see a reference to: "Multiple computers across a network (e.g. a "grid")" but according to Wikipedia grid computing is defined "A grid uses the resources of many separate computers connected by a network (usually the Internet) to solve large-scale computation problems. Most use idle time on many thousands of computers throughout the world."
Well, that sounds like the distributed SETI project and the like, which would seem even more ambitious than a compiler that would help write MPI code for Beowulf clusters.
From all the examples this looks like a god compiler for writing code that will run more efficiently on multi-core and multi-processor systems but would not help you in writing parallel code for clustering.
Though, this brings up a concept that many people forget. Even people that I would consider to be rather intelligent on the subject of clustering often forget this. And that is that if you have an 8 computer cluster with each node running on a system with dual-core Intel CPU installed that if you write parallel code for it using MPI you are benefiting from 8 cores in parallel. Many people that write parallel code forget about multi-threading. To benefit from all 16 cores in a cluster I just described the code would have to be written multi-threaded and parallel. One of the main professors involved in a clustering project at my university stated to me that in their test environment they were using 8 dell systems with dual-core Intel CPU so in total they had the power of 16 cores. Since he has his Ph. D. and all I didn't feel the need to correct him and explain that unless his code was both parallel and multi-threaded he was only getting the benefit of 8 cores. I knew he was not multi-threading because they were not even writing the code in MPI rather they were using Python and batching processes to the cluster. From my knowledge Python cannot write multi-threaded applications. Even if it can I know they were not (from looking at their code).
Sometimes it's the simplest things that confuse the brightest of us....
Nick Powers
Encryption: I may not agree with what you say, but I will defend your right to encrypt it...
The trick to taking advantage of future processors like the ones architecture futurists such as David Patterson envisions when he talks about "manycore" chips is to make parallel programming easy. Making the programmer puzzle out the parallelism for himself isn't the way to do that. We already know pre-emptive threading is too difficult for most; putting pervasively parallel programming (PPP) in human hands would be even worse. A proper approach to PPP involves inventing a new language, not adding warts to C++, which already has more than enough of its own, thank you very much.
Assuming their cluster management system knows that each node is dual core, can you explain why they couldn't run two processes on each node?
I mean, it was only running on two threads AND showed clear signs of excess barrier operations at the end of every character. From here on out, I expect first parallel posts to run over at least four threads and not be sequentially-coherent. The world is moving towards async! Don't let first posts suffer with past limitations!
It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
I'd like to evaluate this new technology.
Just what we need, another C++ crutch.
Can't we just let that wretched language die already?
This is a feature of WCF - Windows Communication Foundation in .NET 3.0 (part of Win V). WCF is designed for next gen CPUs with large numbers of cores. It spawns worker threads for you as needed and sychronises these calls for you automatically. You have the option of manually creating and sychronising threads, but out of the box it does it all for you behind the scenes.
Just imagine coding for a machine with 1024 cores! It's obvious that writing software as we've done in the past where you manually spawn threads and sychronise them is never going to effectively use such hardware. You are obviously going to have a framework like WCF (or this compiler) that takes advantage of this for you.
Maybe the wow has started now after all hmm? ;) I love being flame bait ... especially when I'm right.
sorry to do the anonymous coward thing, but i'm too lazy to make an account. If he has several processes running at once on each node, the OS schedules them on different cpu's, using the dual core. That's what an OS does.
i was just going to ask "who cares, openmp does this already" now i know that i don't care. it's not nearly as interesting as the work done out of nasa greenbelt on a project called ace (which actually is a genuinely automatic parallel compiler that targets clusters rather than cpus --- really kickass concept). my very limited experience with openmp is that i prefer the mpi approach. that said, i don't think mpi or openmp are really the right answer -- it takes a language that was designed from the ground up to do parallel execution "right". in this case, i think things like HP fortran actually hurt rather than help because they're very familiar which ends up being a bad thing because they're most like something that doesn't solve the problem.
Deterministic concurrency is a great aid for debugging - no more race conditions, no more heisenbugs, no more visibly different program behaviour on 1 core, 2-core, hyper-threading, Quad Core, 8 Core, and whatever the Intel and AMD road maps bring out in the future. Looks good for the sanity of all those programmers who have ever had problems manifest only on one machine after testing!
This Sieve programming seems also to make it easier to target the PS3, which has gotten a bad rap as being notoriously difficult to program well. Who wants to break programs into tiny chunks that DMA work in and results out, instead of letting some automated system translate a higher level program into that low level programming model? Its about time that getting decent returns on parallelisation was easy. Its also time for the low level OS threading APIs (Posix, Win32) to be forgotten and buried. No more locking, data races, dead locks, and general programming complexity in order to get any speed up out of multi-core systems.
I also like the idea of buying a Physics processor unit (PPU) and having an automatic speed boost in my programs.
Perhaps some programmers would like their code to run in parellel without a GPL viral license infection?
This looks similar to RapidMind, which is a software development platform that, among other things, "Enables applications to run in a data-parallel way." (I'm not affiliated with them.)
The operating system on a multiple-core machine can split up the processes but one process can only run on one core unless it has been written in a multi-threaded fashion.
In parallel processing general each machine is running one part of a program, thus one program, and unless that program is multi-threaded as well as parallel then it can only use one core per node on a cluster.
Though, someone who writes multi-threaded parallel applications should be held in high esteem! I don't know any such coders.
Nick Powers
Encryption: I may not agree with what you say, but I will defend your right to encrypt it...
So, I fail to see what's new about this. As has been mentioned before, OpenMP auto-parallelizes for SMP systems quite well, as long as you know what you're doing. Like anything done in parallel, if you don't figure out where your data and algorithm dependencies are you'll hose your program. If Sieve does some sort of dependency analysis, that would be interesting, but I doubt it would catch all problems. In fact, I imagine it's provably impossible to auto-parallelize in the general case -- it will likely be proven equivalent to the halting problem eventually.
What would be new is when someone substantially improves on MPI. Auto-parallelizing a FOR loop is amusing, doing the same for a complex algorithm moving data around in a cluster, well, that's a different sort of difficult.
Anyway, no matter how many libraries and tools come out to ease the pain, parallel programming is frigging hard. In fact, the more automagic the compiler, the harder it will be to debug when the inevitable race condition sneaks through. Combine this with lowering the bar for parallel programming and letting more idiots in and we can look forward to some truly horrific code. If you make it so any idiot can code, any idiot will!
Why use C++? Aren't there languages that support parallelizing better, like the functional ones? Or perhaps develop your own language tuned to parallelizing.
The operating system on a multiple-core machine can split up the processes but one process can only run on one core unless it has been written in a multi-threaded fashion.
In parallel processing general each machine is running one part of a program, thus one program, and unless that program is multi-threaded as well as parallel then it can only use one core per node on a cluster.
Though, someone who writes multi-threaded parallel applications should be held in high esteem! I don't know any such coders.
Have you considered that if you run two copies of the process on each node, it will use both cores?
I think the parent's point was that the cluster management system could simply batch out two individual (single threaded) processes to each node (for a total of 16 processes over 8 nodes), rather than just a single process per node. This may or may not work, depending on how the processes communicate over the network, but it is certainly a substantially easier task than writing a multi-threaded distributed program in most any case.
Game! - Where the stick is mightier than the sword!
Intel's compiler (icc), available for Linux, Windows, and FreeBSD extends OpenMP to clusters.
You can build your OpenMP code and it will run on clusters automatically. Intel's additional pragmas allow you to control, which things you want parallelized over multiple machines vs. multiple CPUs (the former being fairly expensive to setup and keep in sync).
I've also seen messages on gcc's mailing list, that talk about extending gcc's OpenMP implementation (moved from GOMP to mainstream in gcc-4.2) to clusters the same way.
Nothing in OpenMP prevents a particular implementation from offering multi-machine parallelization. Intel's is just the first compiler to get there...
The beauty of it all is that OpenMP is just compiler pragmas — you can always build the same code with them off (or with a non-supporting compiler), and it will still run serially.
In Soviet Washington the swamp drains you.
Cilk has been around for years, indeed it won the ICFP 1998 programming contest.
How can be automatic a compiler that needs you to mark the parallel sections? It just simplify the use of threads, but you still have to find parallelism and write your code parallel. It is like OpenMP...
And the parent was correct -- the original poster is talking nonsense. I'm running MPI code on a cluster consisting of some single-core machines, some 2-CPU boxes, and some 2-CPU 2-core systems. All the cores are in use.
'What Sieve is is a C++ compiler that will take a section of code and parallelize it for you with a minimum hassle."
What does the compiler do, taunt you with harsh language while it compiles your code?
If "disco" means "I learn" in Latin, does "discothèque" mean "I learn technology"?
Well then you would have non multi-threaded code and non parallel code as well. There are only 2 ways to have jobs run on a cluster.
1) Write the code using MPI or it's predecessor PVM.
2) Have non parallel code that has separate programs that each handle a part of the data and batch it to nodes on the cluster.
Method 2 is either done as an initial step to help determine how to split up your processing so you could use that information to write a MPI or PVM version or by people that don't know how to write parallel code (MPI or PVM) but still want to be able to use some of the power their cluster provides.
If you chose method 2 and never intended to modify your code to be parallel then I wouldn't go bragging about your great cluster to anyone that knows much about clusters because once they figured out what you were doing they would be shocked at your ignorance and consider it very humorous that you went to so much trouble to build a cluster but never learned how to use it properly.
So, yes you could use method 2 and batch each node 2 batches and in most cases the operating system would run the second batch it received on a unique core compared to it's first batch though you could not guarantee that since the operating system might think it's better to have both on the same CPU depending on what other processes were running on the system at that given time.
But, what if you had nodes in your cluster that have varying numbers of cores / CPUs on each system? This is quite common. So, you could have a cluster that had 20 single core machines 40 dual-core machines and 10 8-core machines. So, if you could use all of the core on all the machines you would have the potential of 180 cores worth of computing power.
To take advantage of this using batching you would have to have 180 separate programs, each that handled the calculation of 1 / 180 th of the complete solution and have written your batch script so that it knows how to allocate those batches based upon the number of cores a machines has. And again, there would be no guarantee that there would be no instances where a node would have a single core running more than 1 batch, except for the single core machines. This uncertainty would increase as the number of cores on a node increased. for example if you sent 8 batches to a node with 8 cores it would be very unlikely that each batch would be running on a unique core, meaning you could assume that at least 1 core was running multiple batches and at least 1 core was running no batches.
What is even more common is that you have a cluster of varying numbers of nodes with unknown numbers of cores / CPU in each node. In this scenario it would be impossible to batch your code in a manner that would take advantage of all the cores available, not to mention that it would also be impossible to make sure that every node was even participating. In this scenario the only way you could guarantee that your code took advantage of all the nodes and all the cores / CPU of each node would be to write your code in parallel mode (via MPI or PVM) and that the code was also written in a multi-threaded fashion.
It may be more difficult to write parallel code than batching non parallel code, for someone who doesn't know how to write MPI or PVM code. And if any of your nodes contained multiple core / CPU it would be even more difficult to write a parallel version of the code that could take advantage of the additional cores on the nodes that had them. But, if you really wanted to take maximum advantage of all the available resources in your cluster then you would have to write parallel code that is multi-threaded.
It's not as difficult as it sounds since the segments of code that could be parallelized would also be the same segments that would lend themselves to be multi-threaded. Both require segments of code where all iterations do not have dependences on previous or subsequent iterations of the same code segment. Some code can be written in parallel and some must be wr
Encryption: I may not agree with what you say, but I will defend your right to encrypt it...
It may or may not be easier to program, but will it perform well enough? Does it support high-speed low-latency interconnects like Myrinet or Infiniband? Will it perform well enough to make up for the high price of such interconnects? Gigabit Ethernet performance is not enough on such systems, as latency is a major factor, and the latency of Ethernet is typically high compared to HPC interconnects.
Actually, if the message passing implementation is done right, communication between processes on the same node is done though shared memory, and not network communication. Actually mixing threading and message passing in the application code just means unnecessary complexity in this case.
Both multi-threading and message passing systems are parallel systems, they are just different subsets of the parallel computing paradigm. You cannot really claim with any authority that multithreading isn't parallel computing, and that only message passing is.
Multithreading is used on a shared memory multiprocessor, and message passing is used on distributed memory multiprocessors. They are just two different ways of implementing parallel code, and none of them is more parallel than the other.
Well, that sounds like the distributed SETI project and the like, which would seem even more ambitious than a compiler that would help write MPI code for Beowulf clusters.Actually, the parallelization is much more complex in the cluster case than in the distributed computing (e.g. SETI@Home) case. Distributed systems are often processing data packages that are inherently independent of one another, and require no communication between the compute nodes at all. In this case, parallelization just amounts to splitting the work into pieces and handing out to the worker nodes, as well as collecting and aggregating the results.
Clusters, on the other hand, are primarily used for tasks that need (often intense) cooperation between the compute nodes to solve, such as solving large systems of linear equations. Such parallelization is much harder, and I won't hold my breath waiting for such a compiler to appear.
Anything when more than a single thread or process is executing simultaneously is parallel. Anything running on multiple computers at the same time can also be called parallel, but is more precisely (and commonly) referred to as clustered or distributed computing. These are the commonly agreed upon meanings.
Or you could (very obviously) start two instances per node.
You know how I know your gay? You use codeplay.
How about an auto-commenting compiler. All you have to do is put tags in it where you want comments and it automatically comments them.
Seriously, Sieve sounds so trivial and meaningless, it's the ultimate silicon valley startup. How about something more valuable like an auto-vectorizing compiler that really works.
Already implement "auto-parallelization" of sorts. It's called "out of order" execution - code specificially written with this in mind can perform quite a bit faster - all you have to do is to create separate independent sections of code.
It's long past time for this.
Support SETI@home
C++ does have such statements: http://cppreference.com/cppalgorithm/index.html. Check out "for_each" for an example.
It's a quote from "The 40 Year Old Virgin"!
David: You know how I know you're gay?
Cal: How?
David: You like Coldplay.
new? 10 inches from my head i have a 2 volume collection edited by
shapiro called 'concurrent prolog' published in 1986 which uses the concept of named
streams to communicate between concurrent processes, which to a
large extent are treated as variables in the language. i could
find an earlier reference, but it would be more work than turning 60 degrees.
try harder
Never, ever tell a Scotsman that they're a European. Doubly so if they're into their fourth single-malt and second haggis of the morning.
It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
http://sisal.sourceforge.net/
Parallelism is hard. Trying to slap a layer of automatic parallelism on a existing non-parallel language is unlikely to achieve a lot. It may help in some specific instances, but to get really good speedup you need to provide extra information. This is the OpenMP model. A language like Sisal provides the compiler even more information about parallel operation, and can intrinsically get better results.
Actually, C++'s STL containers do have such a utility: std::for_each (part of the standard header.
If you ever have free time and the computer time... write a simple algorithm that benefits from parallel processing and write one using MPI and the other by breaking up a program into batchable units and see which one is more efficient. I haven't tested this but my money would be on MPI. This is one of those cases where programmers can't argue about it not worth optimizing your code since running in a cluster is so that you can get more performance so any optimization that you can incorporate into your code the better.
It may indeed be easier to write the code but if it efficiency is effecting performance on your cluster that has a problem take longer than it would have taken you to write the more efficient version. Though only testing will let you know.
Nick Powers
Encryption: I may not agree with what you say, but I will defend your right to encrypt it...
I can see that. I suppose I was thinking of the cases where intercommunications between the nodes is important. If you don't need intercommunication between nodes then batching would most likely be just as efficient.
Nick Powers
Encryption: I may not agree with what you say, but I will defend your right to encrypt it...
ow about an auto-commenting compiler. All you have to do is put tags in it where you want comments and it automatically comments them.
// increment i by one.
Do you really know the difference between a compiler and an development environment?
What "comments" is a compiler going to derive from your code? Something like "EAX will contain the result of the last add." is NOT going to be a useful comment in most situations. What do you expect the *compiler* to be able to tell you about *your* code?
And I believe it is widely held that comments should often describe higher-level things (such as what a function does, when it can be called, requirements on its inputs/outputs) -- things other than just what the following code literally does...
In C/C++, things like this do not help anyone:
++i;
The idea of a compiler modifying the source code is a bit stupid and dangerous.
And in lowlevel implementation, vectorized processing, parallel processing, and multi-threaded processing are all entirely different. The granularity they operate at dictates how efficiently they can parallelize things.
One could automatically parallelize a simple for loop on a Beowulf cluster of 10000 nodes each with the latest processors... It just make take a few million times longer to run than it would on a single 80386 PC from the 1990s...