Slashdot Mirror


New Languages Vs. Old For Parallel Programming

joabj writes "Getting the most from multicore processors is becoming an increasingly difficult task for programmers. DARPA has commissioned a number of new programming languages, notably X10 and Chapel, written especially for developing programs that can be run across multiple processors, though others see them as too much of a departure to ever gain widespread usage among coders."

64 of 321 comments (clear)

  1. Parallel is here to stay but not for every app by Meshach · · Score: 3, Insightful

    Parallel is not going to go anywhere but is only really valid for certain types if applications. Larger items like operating systems or most system tasks need it. Whether it is worthwhile in lowly application land is a case by case decision; but will mostly depend on the skill of programmers involved and the budget for the particular application in question.

    --
    "Maybe this world is another planet's hell"
    Aldous Huxley
    1. Re:Parallel is here to stay but not for every app by aereinha · · Score: 2, Insightful

      Parallel is not going to go anywhere but is only really valid for certain types if applications.

      Exactly, some problems are inherently serial. These programs would run slower if you made them run in parallel.

    2. Re:Parallel is here to stay but not for every app by Nursie · · Score: 4, Informative

      How blinkered are you?

      There exist whole classes of software that have been doing parallel execution, be it through threads, processes or messaging, for decades.

      Look at any/all server software, for god's sake, look at apache, or any database, or any transaction engine.

      If you're talking about desktop apps then make it clear. The thing with most of those is that the machines far exceed their requirements with a single core, most of the time. But stuff like video encoding has been threaded for a while too.

    3. Re:Parallel is here to stay but not for every app by Daniel+Dvorkin · · Score: 4, Interesting

      True enough, but the class of applications for which parallel processing is useful is growing rapidly as programmers learn to think in those terms. Any program with a "for" or "while" loop in which the results of one iteration do not depend on the results of the previous iteration, as well as a fair number of such loops in which the results do have such a dependency, is a candidate for parallelization -- and that means most of the programs which most programmers will ever write. We just need the languages not to make coding this way too painful.

      --
      The correlation between ignorance of statistics and using "correlation is not causation" as an argument is close to 1.
    4. Re:Parallel is here to stay but not for every app by cheftw · · Score: 2, Funny

      The individual cores aren't going to get that much faster in the years to come

      I'm sure I've heard something like this before...

      --
      Always back up, never back down. ---- Think you're cool 'cos your uid is prime? Take mine, modulo the one digit integers
    5. Re:Parallel is here to stay but not for every app by Meshach · · Score: 2, Insightful

      I guess in hindsight I should have been clearer and less "blinkered"...

      For real time apps that do transactions Parallel is needed. What I was comparing them to is desktop apps where in many cases the benefit does not really exist. The main point I was trying to get across is that parallel programming is difficult and not needed for every application.

      --
      "Maybe this world is another planet's hell"
      Aldous Huxley
    6. Re:Parallel is here to stay but not for every app by grumbel · · Score: 4, Insightful

      Most computing intensive problems that a user will encounter at home are easily parallelizable, i.e. video encoding, gaming, photoshop filters, webbrowsing and so on. The amount of times where I maxed out a single CPU and the given problem would not have been to some large degree parallelizable are close to zero.

      The trouble is that they are only "easy" parallelizable in concept, implementing parallelization on an exciting serial codebase is where it gets messy.

    7. Re:Parallel is here to stay but not for every app by AuMatar · · Score: 4, Insightful

      And how many of those cores are above 2% utilization for 90% of the day? Parallelization on the desktop is a solution is search of a problem- we have in a single core dozens of times what the average user needs. My email, web browsing, word processor, etc aren't cpu limited. They're network limited, and after that they're user limited (a human can only read so many slashdot stories a minute). There's no point in anything other than servers having 4 or 8 cores. But if Intel doesn't fool people into thinking they need new computers their revenue will go down, so 16 core desktops next year it is.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    8. Re:Parallel is here to stay but not for every app by peragrin · · Score: 2, Interesting

      yea why can't you buy 6 ghz cores ? Is it because unless you super cool them you can't clock them that high?

      3.8 ghz P4 was released in 2005. Instead Intel has focused on power savings, and adding cores while to shrink die sizes.

      Quantum computing is a long ways off, heck they can't even get a good Memresistor yet. The advantage we are having is that Memory speeds are finally catching up to processor speeds. Combine that with a memresistor at that speed and Computing will take a whole new direction for efficiencies and speed. However clock speed isn't gong to significantly increase for a while.

      --
      i thought once I was found, but it was only a dream.
    9. Re:Parallel is here to stay but not for every app by maxume · · Score: 2, Insightful

      The 16 cores help because your operating system is doing hundreds of things all the time, not just waiting for you to type B into the currently active gui.

      --
      Nerd rage is the funniest rage.
    10. Re:Parallel is here to stay but not for every app by Eskarel · · Score: 2, Insightful

      While technically most servers are somewhat parallel in nature, it isn't really the same sort of thing that these sorts of languages are designed to achieve.

      Servers, for the most part, are parallel because they have to be able to handle a lot of requests simultaneously, so they spin off a new thread or process(depending on the architecture) for each request to the server, do some relatively simple concurrency checking and then run each request, for the most part, in serial. They're parallel because the task being performed is parallel, a web server that could only return the page to one person at a time wouldn't work, not to make them faster or more efficient, or to take advantage of multiple processors. This kind of parallel architecture is relatively simple, because the architecture is defined by the requirements of the project and you just have to ensure that it works.

      Taking something like a video encoder, PC game, compiler, etc and making it run in parallel so that it's faster and can take advantage of modern hardware is a totally different kettle of fish. You have to redesign your core idea so that it works in parallel, you have to turn one discrete task into two or more which can be run at the same time. It's a whole different challenge and one which very few programmers(myself included) seem to be prepared to meet.

    11. Re:Parallel is here to stay but not for every app by bertok · · Score: 3, Interesting

      The % utilization metric is a red herring. Most servers are underutilized by that metric, which is why VMware is making so much money consolidating them!

      Users don't actually notice, or care, about CPU utilization. What users notice, is latency. If my computer is 99% idle, that's fine, but I want it to respond to mouse clicks in a timely fashion. I don't want to wait, even if it's just a few hundred milliseconds. This is where parallel computation can bring big wins.

      One thing I noticed is that MS SQL Server still has its default "threshold for query parallelism" set to "5", which AFAIK means that if the query planner estimates that a query will take more than 5 seconds, it'll attempt a parallel query plan instead. That's insane! I don't know what kind of users Microsoft is thinking of, but in my world, if a form takes 5 seconds to display, it's way too slow to be considered acceptable. Many servers now have 8 or more cores, and 24 (4x hexacore) is going to be common for database servers very soon. In that picture, even if you only consider a 15x speedup due to overhead, 5 seconds becomes something like 300 milliseconds!

      Ordinary Windows applications can benefit from the same kind of speedup. For example, a huge number of applications use compression internally (all Java JAR files, of the docx-style Office 2007 files, etc...), yet the only parallel compressor I know of is WinRAR, which really does get 4x the speed on my quad-core. Did you know that the average compression rate for a normal algorithm like zip is something like 10MB/sec/core? That's pathetic. A Core i7 with 8 threads could probably do the same thing at 60 MB/sec or more, which is more in line with, say, gigabit ethernet speeds, or a typical hard-drive.

      In other words, for a large class of apps, your hard-drive is not the bottleneck, your CPU is. How pathetic is that? A modern CPU has 4 or more cores, and it's busy hammering just one of those while your hard-drive, a mechanical component, is waiting to send it more data.

      You wait until you get an SSD. Suddenly, a whole range of apps become "cpu limited".

    12. Re:Parallel is here to stay but not for every app by grumbel · · Score: 3, Insightful

      Web-browsing for instance, is not inherently paralizable.

      Of course it is. Each Tab can be rendered in parallel, each JPEG can be decoded in parallel, each character can be antialiased in parallel, each download can happen in parallel, all the pixel that make up the final image can be alpha blended in parallel.

      Yes, at some point you hit a wall where you will be left with a piece of code that you have to evaluate sequentially, you can't alpha blend half a pixel and your layouting engine might also require some sequential evalution. My point however is that none of those are CPU intensive enough to be a problem for normal use.

      These days I don't have to wait for my computer because it has to solve some tiny non-parallelizable task, but because my computer is doing some heavy data crunching that could be done in parallel without much of a problem.

      Or to put it another way: Half the for-loops out there just process each element in a list, the major reason why the don't do it in parallel is because the programming language makes it extremely hard to do so, not because there is some fundamental reason why it can't be done.

    13. Re:Parallel is here to stay but not for every app by DragonWriter · · Score: 2, Insightful

      And how many of those cores are above 2% utilization for 90% of the day? Parallelization on the desktop is a solution is search of a problem-

      The indication of the need to parallelization isn't the number of cores that are above 2% utilization for 90% of the day, but the number that are above 90% utilization for any part of the day.

      My email, web browsing, word processor, etc aren't cpu limited.

      Some of use our computers for more than that.

    14. Re:Parallel is here to stay but not for every app by PitaBred · · Score: 2, Insightful

      What about that other 10% of the day? It's mostly for gamers and developers, but multiple cores really does speed a lot of things up. And they're starting to be quite useful now that Joe User is getting into video and audio editing and so on. Those most certainly are CPU-limited applications, and they are pretty amenable to parallelism as well. Just because you only email, browse the web and use a word processor doesn't mean that's what everyone does.

  2. We need async frameworks too! by PhrostyMcByte · · Score: 4, Insightful

    A lot of problems are I/O driven -- I would like to see more database client libraries allow a full async approach that lets us not block the threads we are trying to do concurrent work on.

  3. Re:I'm waiting for parallel libs for R by Daniel+Dvorkin · · Score: 2, Interesting

    There are some packages on CRAN that claim to implement parallel processing for R -- go to http://cran.r-project.org/web/packages/ and search for the text "parallel" to find several examples. I haven't tried any of them out yet, but sooner or later I'm going to have to.

    And actually, I think that "scripting" languages in general will have a very bright future in the parallel processing world. If memory management and garbage collection are implemented invisibly (and well!) in the core language, then the programmer can concentrate on the application logic and not have to worry about the kind of allocation headaches discussed in TFA. Python and R, where I spend most of my coding time these days, both offer very nicely implemented versions of function mapping, which I see as the key to making multiple processors useful for a wide variety of tasks. And no, the memory management and GC aren't quite there yet in either language, but they will be.

    --
    The correlation between ignorance of statistics and using "correlation is not causation" as an argument is close to 1.
  4. What's so hard? by 4D6963 · · Score: 2, Interesting

    Not trying to troll or anything, but I'd always hear of how parallel programming is very complicated for programmers, but then I learnt to use pthread in C to parallelise everything in my C program from parallel concurrent processing of the same things to threading any aspect of the program, and I was surprised by how simple and straightforward it was using pthread, even creating a number of threads depending on the number of detected cores was simple.

    OK, maybe what I did was simple enough, but I just don't see what's so inherently hard about parellel programming. Surely I am missing something.

    --
    You just got troll'd!
    1. Re:What's so hard? by Anonymous Coward · · Score: 2, Insightful

      Do your programs ever leak memory? Did you have to work with a team of 100+ SWE's to write the program? Did you have technical specs to satisfy, or was this a weekend project? This is the difference between swimming 100 meters and sailing across the Pacific.

    2. Re:What's so hard? by beelsebob · · Score: 4, Informative

      It's not creating threads that's hard - it's getting them to communicate with each other, without ever getting into a situation where thread a is waiting for thread b and thread b is waiting for thread a that's hard.

    3. Re:What's so hard? by Anonymous Coward · · Score: 4, Funny

      How many lines does it take you to parallelize this with pthreads in C?

      One. Newline characters are for wimps.

    4. Re:What's so hard? by Unoti · · Score: 3, Interesting

      The fact that it seems so simple at first is where the problem starts. You had no trouble in your program. One program. That's a great start. Now do something non-trivial. Say, make something that simulates digital circuits-- and gates, or gates, not gates. Let them be wired up together. Accept an arbitrarily complex setup of digital logic gates. Have it simulate the outputs propagating to the inputs. And make it so that it expands across an arbitrary number of threads, and make it expand across an arbitrary number of processes, both on the same computer and on other computers on the same network.

      There are some languages and approaches you could choose for such a project that will help you avoid the kinds of pitfalls that await you, and provide most or all of the infrastructure that you'd have to write yourself in other languages.

      If you're interested in learning more about parallel programming, why it's hard, and what can go wrong, and how to make it easy, I suggest you read a book about Erlang. Then read a book about Scala.

      The thing is, it looks easy at first, and it really is easy at first. Then you launch your application into production, and stuff goes real funny and it's nigh unto impossible to troubleshoot what's wrong. In the lab, it's always easy. With multithreaded/multiprocess/multi-node systems, you've got to work very very hard to make them mess up in the lab the same way they will in the real world. So it seems like not a big deal at first until you launch the stuff and have to support it running every day in crazy unpredictable conditions.

    5. Re:What's so hard? by quanticle · · Score: 2, Insightful

      Making a threaded application in C isn't difficult. Testing and debugging said application is. Given that threads share memory, rigorously testing buffer overflow conditions becomes doubly important. In addition, adding threading introduces a whole new set of potential errors (such as race conditions, deadlocks, etc.) that need to be tested for.

      Its easy enough to create a multi-threaded version of a program when its for personal use. However, there are a number of issues that arise whenever a threaded program interacts with the (potentially malicious) outside world, and these issues are not trivial to test for or fix. That's why I think that parallel programs are going to be increasingly written in functional programming languages (Common Lisp, Haskell, Scala, etc.). The limitations on side effects that functional languages impose reduces the amount of interaction between threads, and reduces the probability that a failure in a single thread will propagate through the entire application.

      --
      We all know what to do, but we don't know how to get re-elected once we have done it
    6. Re:What's so hard? by Yacoby · · Score: 2, Interesting

      Data communication in a foolproof way. Writing a threaded program is easy if the program is simple. You can even get a bit more performance out of a program using multiple threads if you use locking. If you use locking, you end up with the possibility of race conditions, deadlock and other nightmares.

      Extending this to something like a game engine is much harder. Say we split our physics and rendering into two threads. How does the physics thread update the render thread? We could just lock the whole scene graph, but then we don't get much of a performance increase, if at all. We then could use two buffers. The renderer renders the data from one, and the physics thread updates the other. When we are ready to update the frame, we just swap the buffers. Then we end up with some input lag. There are still complications. What happens if we add an AI thread. How does that add data to the buffer in a way that doesn't conflict with the physics thread?

      We could use lock free lists, which are very hard to get right. Even some implementations that I have seen end up locking the heap, which we want to avoid. But even then we end up with some issues.
      Don't get me started on debugging threaded applications. Finding that while it works fine on one and two cores. 0.1% of the time on a quad core there is a deadlock.

      So to sum it up. Anyone can write a threaded application where it is easy to split the tasks. If you are designing it from the ground up, it is even easier. If you need to write performance critical maintainable code that involves a lot of communication, it suddenly gets much harder.

    7. Re:What's so hard? by Unoti · · Score: 2, Insightful

      You could easily write a "vector_add" function which spawns (or unlocks pre-spawned which is smarter) threads to perform a variety of tasks.

      AC here is right, but also missing something. I often hear about things being "easy". Often when people say something is "easy" they really mean, "it's easy after it's done." This is one of those things where it's only easy after it's done. The code might look easy after it's created and debugged. But getting to the point where it's created and validated and debugged is much harder in some languages and approaches (e.g. C) than it is in others (e.g. Erlang).

      Take someone experienced with multithread, multi process, multi node programming in C. And put them up against someone experienced with same in a language designed for distributed systems. Have them drag race on producing code that expands to an arbitrary number of processes and computers and evenly distributes the load among them in a fault tolerant, smooth way. The person in a language designed for it is going to blow the doors off the person doing it in C in terms of productivity. And that's what these languages are all about.

      If you've got a library already present that does exactly what you need, great, and AC is right on target there. But when you don't have such a library, and you almost never will, then it's great to use a tool that makes the job easy to do well and do quickly.

  5. Old languages designed for parallel processing? by number6x · · Score: 4, Informative

    Erlang is an older established language designed for parallel processing.

    Erlang was first developed in 1986, making it about a decade older than Java or Ruby. It is younger than Perl or C, and just a tad older than Python. It is a mature language with a large support community, especially in industrial applications. It is time tested and proven.

    It is also Open source and offers many options for commercial support.

    Before anyone at DARPA thinks that they can design a better language for concurrent parallel programming then I think they should be forced to spend 1 year learning Ada, and a second year working in Ada. If they survive they will most likely be cured of the thought that the Defense department can design good programming languages

    1. Re:Old languages designed for parallel processing? by coppro · · Score: 4, Informative

      Erlang is probably the best language for servers and similar applications available. Not only is in inherently parallel (though they've only recently actually made the engine multithreaded, as the paralellism is in the software), but it is very easily networked as well. As a result, a well-written Erlang program can only be taken down by simultaneously killing an entire cluster of computers.

      What's more, it has a little-seen feature of being able to handle code upgrades to most any component of the program without ever stopping - it keeps two versions of each module (old and new) in memory, and code can be written to automatically ensure a smooth transition into the new code when the upgrade occurs.

      If I recall correctly, the Swedish telecom where Erlang was designed had one server running it with 7 continuous years uptime.

    2. Re:Old languages designed for parallel processing? by Anonymous Coward · · Score: 2, Informative

      The AXD301 which was the first major product to be implemented in Erlang by Ericsson was measured to achieve nine-nines uptime the first couple of years.

      To read more about concurrency in Erlang and uptime have a look at this article:
      http://www.computer.org/portal/pages/dsonline/2007/10/w5tow.xml by Steve Vinovski

    3. Re:Old languages designed for parallel processing? by Anonymous Coward · · Score: 2, Interesting

      If I recall correctly, the Swedish telecom where Erlang was designed had one server running it with 7 continuous years uptime.

      Certainly their ADX301 telephony-over-ATM switch has achieved 'nine nines' uptime - i.e. 99.9999999% up, which allows for ~31ms downtime a year.

      British Telecom use them to power their network and the passed the ultimate test (finals voting for Pop Star, the UK original for American Idol) with flying colours.

      And erlang is a fun language to program.

  6. Awful example in the article by theNote · · Score: 3, Insightful

    The example in the article is atrocious.

    Why would you want the withdrawal and balance check to run concurrently?

    1. Re:Awful example in the article by Anonymous Coward · · Score: 2, Funny

      The example in the article is atrocious.

      Why would you want the withdrawal and balance check to run concurrently?

      Because it would make it much easier to profit from self-introduced race conditions and other obscure bugs when I get to the ATM tomorrow :)

    2. Re:Awful example in the article by awol · · Score: 3, Interesting

      The example in the article is atrocious.

      Why would you want the withdrawal and balance check to run concurrently?

      Because I can do a whole lot of "local" withdrawal processing whilst my balance check is off checking the canonical source of balance information. If it's comes back OK then the work I have been doing in parallel is now commitable work and my transaction is done. Perhaps in no more time than either of the balance check or the withdrawal whichever is the longest. Whilst the balance check/withdrawal example may seem ridiculous. There are some very interesting applications of this kind of problem in securities (financial) trading systems where the canonical balances of different instruments would conveniently (and some times mandatorily) stored in different locations and some complex synthetic transactions require access to balances from more than one instrument in order to execute properly.

      It seems to me that most of the interesting parallism problems relate to distributed systems and it is not just a question of N phase commit databases but rather a construct of "end to end" dependencies in your processing chain where the true source of data cannot be accessed from all the nodes in the cluster at the same time from a procedural perspective.

      It is this fact that to me suggests that the answer to these issues is a radical change in language toward the functional or logical types of languages like haskel and prolog with erlang being a very interesting place on that path for right now.

      --
      "The first thing to do when you find yourself in a hole is stop digging."
  7. Re:Parallel programming is dead. No one uses it... by Nursie · · Score: 3, Informative

    Bullshit.

    Tell that to apache, and oracle, and basically anything that runs in a server room.

  8. Re:Parallel programming is dead. No one uses it... by beelsebob · · Score: 3, Insightful

    Threading i don't count as parallel processing for the desktop. I don't even hear of any games or applications built for parallel.

    Uhhhhhhhhhhh? Yes, well done with that...

  9. Clojure by slasho81 · · Score: 4, Interesting

    Check out Clojure. The only programming language around that really addresses the issue of programming in a multi-core environment. It's also quite a sweet language besides that.

    1. Re:Clojure by slasho81 · · Score: 2, Informative

      Erlang is meant for distributed computation, which is a grand overkill for most programs. See here: http://groups.google.com/group/clojure/msg/2ad59d1c4bb165ff Scala unlike Clojure did not embrace the importance of immutability to concurrency programming, which is why I think it's badly lacking. See here: http://clojure.org/state

    2. Re:Clojure by Cyberax · · Score: 2, Insightful

      Erlang is quite OK for non-distributed programming. Its model of threads exchanging messages is just a natural fit for it. As it is for multicore systems.

    3. Re:Clojure by slasho81 · · Score: 2, Informative
      Here's what Rich Hickey wrote about the matter in http://clojure.org/state

      I chose not to use the Erlang-style actor model for same-process state management in Clojure for several reasons:

      • It is a much more complex programming model, requiring 2-message conversations for the simplest data reads, and forcing the use of blocking message receives, which introduce the potential for deadlock. Programming for the failure modes of distribution means utilizing timeouts etc. It causes a bifurcation of the program protocols, some of which are represented by functions and others by the values of messages.
      • It doesn't let you fully leverage the efficiencies of being in the same process. It is quite possible to efficiently directly share a large immutable data structure between threads, but the actor model forces intervening conversations and, potentially, copying. Reads and writes get serialized and block each other, etc.
      • It reduces your flexibility in modeling - this is a world in which everyone sits in a windowless room and communicates only by mail. Programs are decomposed as piles of blocking switch statements. You can only handle messages you anticipated receiving. Coordinating activities involving multiple actors is very difficult. You can't observe anything without its cooperation/coordination - making ad-hoc reporting or analysis impossible, instead forcing every actor to participate in each protocol.
      • It is often the case that taking something that works well locally and transparently distributing it doesn't work out - the conversation granularity is too chatty or the message payloads are too large or the failure modes change the optimal work partitioning, i.e. transparent distribution isn't transparent and the code has to change anyway.
    4. Re:Clojure by shutdown+-p+now · · Score: 2, Insightful

      Check out Clojure [clojure.org]. The only programming language around that really addresses the issue of programming in a multi-core environment.

      That's a rather bold statement. You do realize that those neat features of Clojure like STM or actors weren't originally invented for it? In fact, you could do most (all?) of that in Haskell before Clojure even appeared.

      On a side note, while STM sounds great in theory for care-free concurrent programming, the performance penalty that comes with it in existing implementations is hefty. It's definitely a prospective area, but it needs more research before the results are consistently usable in production.

    5. Re:Clojure by slasho81 · · Score: 2, Interesting

      That's a rather bold statement. You do realize that those neat features of Clojure like STM or actors weren't originally invented for it? In fact, you could do most (all?) of that in Haskell before Clojure even appeared.

      I do realize that many of the innovations in Clojure are not brand new, but Clojure did put them into a practical form that incorporates many "right" innovations into one language. Haskell is a fine language and one of the languages that heavily influenced Clojure. Clojure makes some paradigms used in Haskell far more usable than they are in their original form.

      On a side note, while STM sounds great in theory for care-free concurrent programming, the performance penalty that comes with it in existing implementations is hefty. It's definitely a prospective area, but it needs more research before the results are consistently usable in production.

      In addition, things like STM is more of a general title for a set of technologies with same general principles but vastly different implementation. Clojure's implementation plus the immutability paradigm Clojure embraces makes its STM darn close to care-free concurrent programming in almost all situations you'll encounter. And I'm well aware that this is an even bolder statement, but I strongly recommend checking it out if you do any kind of concurrent programming. It delivers.

  10. A view based on history... by Anonymous Coward · · Score: 3, Insightful

    Rehash time...

    Parallelism typically falls into two buckets: Data parallel and functional parallel. The first challenge for the general programming public is identifying what is what. The second challenge is synchronizing parallelism in as bug free way as possible while retaining the performance advantage of the parallelism.

    Doing fine-grained parallelism - what the functional crowd is promising, is something that will take a *long* time to become mainstream (Other interesting examples are things like LLVM and K, but they tend to focus more on data parallel). Functional is too abstract for most people to deal with (yes, I understand it is easy for *you*).

    Short term (i.e. ~5 years), the real benefit will be in threaded/parallel frameworks (my app logic can be serial, tasks that my app needs happen in the background).

    Changing industry tool-chains to something entirely new takes many many years. What most likely will happen is transactional memory will make it into some level of hardware, enabling faster parallel constructs, a cool new language will pop up formalizing all of these features. Someone will tear that cool new language apart by removing the rigor and giving it C/C++ style syntax, then the industry will start using it

  11. Established vs new programming languages for HPC by Raul654 · · Score: 3, Informative

    This is a subject near and dear to my heart. I got to participate in one of the early X10 alpha tests (my research group was asked to try it out and give feedback to Vivek Sarker's IBM team). Since then, I've worked with lots of other specialized programming HPC programming languages.

    One extremely important aspect of supercomputing, a point that many people fail to grasp, is that application code tends to live a long, long, long time. Far longer than the machines themselves. Rewriting code is simply too expensive and economically inefficient. At Los Alamos National Lab, much of the source code they run are nuclear simulations written Fortran 77 or Fortran 90. Someone might have updated it to use MPI, but otherwise it's the same program. So it's important to bear in mind that those older languages, while not nearly as well suited for parallelism (either for programmer ease-of-use/effeciency, or to allow the compiler to do deep analysis/optimization/scheduling), are going to be around for a long time yet.

    --


    To make laws that man cannot, and will not obey, serves to bring all law into contempt.
    --E.C. Stanton
  12. Re:Parallel programming is dead. No one uses it... by quanticle · · Score: 2, Insightful

    If threading isn't parallelism, then what is? At what level of separation between separate streams of execution does an application become "parallel"?

    --
    We all know what to do, but we don't know how to get re-elected once we have done it
  13. Re:Chapel? by sam_handelman · · Score: 3, Funny

    You know what, I don't think I'm going to use modern English, either.

      Don't you know that early modern English was invented to have something standard into which the bible could be translated? For shame!

      As a devoted secularist, I'll just burn all my shakespeare and rushdie after I delete all my perl code.

    --
    The good and new comes from no quarter where it is looked for, and is always something different from what is expected.
  14. Re:Parallel programming is dead. No one uses it... by sam_handelman · · Score: 2, Interesting

    Parent is kinda flamebait, and it's exactly the opposite of my experience.

      Scientists (I am one) who also write some of their own code, have much better things to do with our time than to try and make the software efficient. When we figure out what we want done, we hand it over to professional programmers who, if the cost:benefit analysis works out, will parallelize or optimize it as they're told is needed. Even lousy programmers are expensive, and hardware is cheap.

      I 100% agree with the end of his statement - was it 10, 15 years ago scientific computing was still done in fortran FOR A REASON - the optimizing compiler didn't completely suck? Some scientific computing is still done in FORTRAN but that's been purely a legacy thing since the optimizing compilers for C caught up. I'm sure someone clever will find some way to get an interpreted language to figure out what depends on what and parallelize your code for you. This is a very hard problem to do perfectly, but sensible people will quickly realize that's okay. For some cases, I can beat an optimizing compiler by writing assembly - am I ever going to do that? Hell no.

      Now, this may result in additional good coding practices which will be required of us so that the optimizing compiler can make easier sense of our code. Might it be lower overhead to create an optimization friendly programming language, which I suspect will end up amounting to making such practices an explicit requirement? Probably not, but it depends on how closely these new programming languages adhere to existing languages (I haven't looked at either example discussed in the article.)

    --
    The good and new comes from no quarter where it is looked for, and is always something different from what is expected.
  15. The mess by Animats · · Score: 4, Interesting

    I've been very disappointed in parallel programming support. The C/C++ community has a major blind spot in this area - they think parallelism is an operating system feature, not a language issue. As a result, C and C++ provide no assistance in keeping track of what locks what. Hence race conditions. In Java, the problem was at least thought about, but "synchronized" didn't work out as well as expected. Microsoft Research people have done some good work in this area, and some of it made it into C#, but they have too much legacy to deal with.

    At the OS level, in most operating systems, the message passing primitives suck. The usual approach in the UNIX/Linux world is to put marshalling on top of byte streams on top of sockets. Stuff like XML and CORBA, with huge overhead. The situation sucks so bad that people think JSON is a step forward.

    What you usually want is a subroutine call; what the OS usually gives you is an I/O operation. There are better and faster message passing primitives (see MsgSend/MsgReceive in QNX), but they've never achieved any traction in the UNIX/Linux world. Nobody uses System V IPC, a mediocre idea from the 1980s. For that matter, there are still applications being written using lock files.

    Erlang is one of the few parallel languages actually used to implement large industrial applications.

    1. Re:The mess by Animats · · Score: 2, Interesting

      Sigh .. my last perl program used JSON messages over System V IPC (msgsnd,msgrcv). And here I was feeling proud of it

      I know, I know. I have an application in production which uses Python "pickle" over pipes to subprocesses.

      Incidentally, it's interesting to speculate what the UNIX/Linux world might have been like if, when a process exited, it was able to return a result list, like the parameter list that goes in. Shell scripts, and "make", might not have been so blind to what the subprogram actually did.

  16. Art of Parallel Programmin by rayharris · · Score: 2, Interesting

    There needs to be an equivalent of Donald Knuth's "Art of Computer Programming" as a definitive reference for parallel algorithms. Until then, I don't care how many cores you have, you won't get the most out of them.

    --
    I void warranties.
  17. How to Solve the Parallel Programming Crisis by Louis+Savain · · Score: 2, Interesting

    Exactly, some problems are inherently serial. These programs would run slower if you made them run in parallel.

    If they are inherently sequential, then obviously they cannot be made to run in parallel. The truth is that the vast majority of computing applications, both existing and future, are inherently parallel. As soon as some maverick startup (forget the big players like Intel, Microsoft, or AMD because they are too married to the old ways) figures out the solution to the parallel programming crisis (see link below), get ready for a flood of super complex parallel applications to hit the market, especially in the AI, gaming and simulation fields. Cars will drive themselves and robots will maintain your home, that kind of stuff. The possibilities are mind boggling.

    Now the reason that the old timers cannot solve the problem is that they are all addicted to the Turing Machine model of computing and last century's multithreaded approach to concurrency. The Turing Machine model is evidently no help in solving the crisis and threads are inherently non-deterministic. There is an urgent need to move away from antiquated and flawed paradigms that do not contribute to the solution. Indeed, they got us into this mess to begin with.

    How to Solve the Parallel Programming Crisis

    1. Re:How to Solve the Parallel Programming Crisis by Louis+Savain · · Score: 4, Insightful

      Sorry but, IMO, the cell is a perfect example of how not to design a multicore processor. Heterogenous processors introduce nothing new to the table of solutions that was not already there. We had systems with CPUs and GPUs before the Cell (or Intel's Larrabee and AMD's Fusion) showed up. Everybody knows that they're a pain in the ass to program. Neither CUDA nor OpenCL nor Microsoft's much ballyhooed TBB (threaded building blocks) will change that fact.

      My point is that one does not design a parallel processor and then come up with a programming model to exploit it. It should be the other way around. The programming model should come first. One should design a model that makes parallel programming easy and the resulting apps rock-solid. Only then, after you have perfected your model, should you even consider designing a processor to support the model.

      IOW, everybody's doing it wrong, and by everybody, I mean the all big players in the multicore hardware/software industry: Intel, Microsoft, IBM, Sun-Oracle, AMD, ARM, Apple, FreeScale, etc. The major computer science centers who are getting a lot of research money form the industry are not helping either since they have to kowtow to the likes of Intel and AMD whose main interest is to safeguard their installed base and preserve continuity.

      It makes no difference. When the pain becomes unbearable (it's all about money), it will suddenly dawn on everybody that what is needed is to break away from the past.

    2. Re:How to Solve the Parallel Programming Crisis by Louis+Savain · · Score: 2, Interesting

      I am not sure why you make your assumptions since the solution that I am proposing emphasizes intructions and timing more than anything else. Data is just the environment where the program effects changes and reacts to changes. If my solution is dataflow then so is a pulsed neural network that consists of connected sensors and effectors. I have never heard neural network programmers refer to their programs as dataflow programs. Yet, this is what I am proposing: a program should be more like a signal-driven neural network.

      AFAIK, dataflow systems do not concern themsleves with a program counter. One of the most important aspects of the solution that I am advancing is that determinism is essential to reliable software. There should never be any ambiguity as to whether any two events/operations in a program are sequential or parallel. This requires a program counter to mark time. Another important aspect is that a program should be 100% reactive, i.e., everything should happen in reaction to a change/event.

    3. Re:How to Solve the Parallel Programming Crisis by grumbel · · Score: 2, Insightful

      using threads, or even multiple processes, and nobody has found a good model that actually makes it easy to do parallel programming.

      The reason is that threads and processes are the wrong tool for the task, they introduce a lot of additional complexity while still failing at giving you fine grained parallelization. They are patchworks that try to add the ability to do parallelization to languages that where build for sequential evaluation, instead of solving the problem from the ground up.

      Functional languages look like a much better solution for parallel programming. Without side effects, a very large part of parallel programming problems disappears instantly. There will be a need for some relearning as functional languages require a different approach to tackle a programming problem, but in the end that is what it needs. Look at GPU programming, the reason why it is trivial to apply parallelization to it, is because the infrastructure forces you to write your program in a way that can be parallelized. You can't make your fragment shader go crazy and draw over other pixels and stuff, you have one pixel that you have to fill and no side-effects outside of that and as a result you can throw as much parallel processing power at it as you like.

  18. Chapel by jbolden · · Score: 2, Interesting

    Looking at the 99 bottles Chapel code (from original article)
    http://99-bottles-of-beer.net/language-chapel-1215.html

    This looks like the way you do stuff in Haskell. Functions compute the data and the I/O routine is moved into a "monad" where you need to sequence. This doesn't seem outside the realm of the possible.

  19. Multi-threaded or Parallel? by ipoverscsi · · Score: 5, Insightful

    I have not read the article (par for the course here) but I think there is probably some confusion among the commenters regarding the difference between multi-threading programs and parallel algorithms. Database servers, asynchronous I/O, background tasks and web servers are all examples of multi-threaded applications, where each thread can run independently of every other thread with locks protecting access to shared objects. This is different from (and probably simpler than) parallel programs. Map-reduce is a great example of a parallel distributed algorithm, but it is only one parallel computing model: Multiple Instruction / Multiple Data (MIMD). Single Instruction / Multiple Data (SIMD) algorithms implemented on super-computers like Cray (more of a vector machine, but it's close enough to SIMD) and MasPar systems require different and far more complex algorithms. In addition, purpose-built supercomputers may have additional restrictions on their memory accesses, such as whether multiple CPUs can concurrently read or write from memory.

    Of course, the Cray and Maspar systems are purpose-built machines, and, much like special-build processors have fallen in performance to general purpose CPUs, Cray and Maspar systems have fallen into disuse and virtual obscurity; therefore, one might argue that SIMD-type systems and their associated algorithms should be discounted. But, there is a large class of problems -- particularly sorting algorithms -- well suited to SIMD algorithms, so perhaps we shouldn't be so quick to dismiss them.

    There is a book called An Introduction to Parallel Algorithms by Joseph JaJa (http://www.amazon.com/Introduction-Parallel-Algorithms-Joseph-JaJa/dp/0201548569) that shows some of the complexities of developing truly parallel algorithms.

    (Disclaimer: I own a copy of that book but otherwise have no financial interests in it.)

  20. Re:Established vs new programming languages for HP by Raul654 · · Score: 2, Informative

    I think you're confusing two different uses of parallelism. One is "small" parallelism -- the kind you see in graphical user interfaces. That is to say, if Firefox is busy loading a page, you can still click on the menus and get a response. Different aspects of the GUI are handled by different threads, so the program is responsive instead of hanging. That's done by using threading libraries like Posix and the like. But that's really a negligible application of parallelism. The really important use of parallelism is for really large programs that require lots of hardware to run in a reasonable amount of time.

    The threading libraries that you use for GUI applications don't work well for computationally intensive applications requiring parallelism. They require a shared-memory architecture. (A shared memory architecture is one in which all processors see the same values in the RAM. E.g, if processor #1 writes X to memory block 0x87654321, and processor #2 reads 0x87654321, it returns X instead of whatever value processor #2 last wrote there) Shared-memory architectures don't scale -- the biggest ones you can buy have about 64 CPUs. If you do want to run computationally intensive applications on shared memory architectures, then OpenMP is the library of choice. It's also fairly simple to use.

    If you want to run a big applications, you need to use a distributed memory architecture. And MPI (message passing interface) is pretty much the only game in town where that is concerned. It's by far the dominant player.

    --


    To make laws that man cannot, and will not obey, serves to bring all law into contempt.
    --E.C. Stanton
  21. Re:Chapel? by Raffaello · · Score: 3, Insightful

    No widely spoken human natural language was "invented," Modern English included. Where do people come up with these things? Modern English evolved out of Middle English, just as Spanish evolved out of Latin, etc. Modern English was not "invented" in any meaningful sense of "invernted."

    reference for WikiWeenies.

  22. Re:I'm waiting for parallel libs for R by ceoyoyo · · Score: 4, Interesting

    Whoever told you that is mistaken.

    The easiest way to take advantage of a multiprocessing environment is to use techniques that will be familiar to any high level programmer. For example, you don't write for loops, you call functions written in a low level language to do things like that for you. Those low level functions can be easily parallelized, giving all your code a boost.

  23. it's getting easier, not harder by drfireman · · Score: 2, Interesting

    Recent versions of gcc support OpenMP, and there's now experimental support for a multithreading library that I gather is going to be in the next c++ standard. These don't solve everyone's problems, but certainly it's getting easier, not harder, to take better advantage of multi-processor multi-core systems. I recently test retrofit some of my own code with OpenMP, and it was ridiculously easy. Five years ago it would have been a much more irritating process. I realize not everyone develops in c/c++, nor does everyone use a compiler that supports OpenMP. But I doubt it's actually getting harder, probably just the rate at which it's getting easier is not the same for everyone.

  24. LIBRARIES!! by HiThere · · Score: 2, Interesting

    The main problem faced by each new language is "How do I access all the stuff that's already been done?"

    The "Do it over again" answer hasn't been successful since Sun pushed Java, and Java's initial target was an area that hadn't had a lot of development work. Sun spent a lot of money pushing Java, and was only partially successful. Now it probably couldn't be done again even by a major corporation.

    The other main answer is make calling stuff written in C or C++ (or Java) trivial.Python has used this to great effect, and Ruby to a slightly lesser one. Also note Jython, Groovy, Scala, etc. But if you're after high performance, Java has the dead weight of an interpreter (i.e., virtual machine). So that basically leaves easy linkage with C or C++. And both are purely DREADFUL languages to link to, due to pointer/integer conversions and macros. And callbacks. Individual libraries can be wrapped, but it's not easy to craft global solutions that work nicely. gcc has some compiler options that could be used to eliminate macros. Presumably so do other compilers. But they definitely aren't standardized. And you're still left not knowing what's a pointer so you don't know what memory can be freed.

    The result of this is that to get a new language into a workable state means a tremendous effort to wrap libraries. And this needs to be done AFTER the language is stabilized. And the people willing to work on this aren't the same people as the language implementers (who have their own jobs).

    I looked over those language sites, and I couldn't see any sign that thoughts had been given to either Foreign Function Interfaces or wrapping external libraries. Possibly they just used different terms, but I suspect not. My suspicion is that the implementers aren't really interested in language use so much as proving a concept. So THESE aren't the languages that we want, but they are test-beds for working out ideas that will later be imported into other languages.

    --

    I think we've pushed this "anyone can grow up to be president" thing too far.
  25. Inmos had it right by Tjp($)pjT · · Score: 2, Interesting

    In the let the compiler decide attitude of the C language families ... Inmos C had the correct solution. You add two new keywords to the language, parallel and sequential.
    sequential
    {
    stmt1;
    stmt2;
    stmt3;
    }

    as opposed to

    parallel
    {
    stmt4;
    stmt5;
    stmt6;
    }

    The stmt1 must be executed before stmt2 which must be executed before stmt3 in the sequential construct. C languages actually already support this in a bit more awkward way with the ravel operator. But sequential is an easier to understand and read method, and balances nicely the parallel keyword. The compiler and runtime have been told that stmt4, stmt5, and stmt6 can be executed in parallel. There is implicit synchronization at the end of the statement block.

    This is all well and good and many people look and say that it would not be so tough to do this in other ways, and so on. But combine this with fast iterators as are in Objective C 2.0 and it gets much more interesting. Or for the generalized case where any place a left brace is permissible, either of these two constructs could be substituted. This generalizes to braces enclosing a conventional block of statements as exists now, a forced sequential block of statements (so that side affects from say external inputs or other volatile entities can be dealt with at the specific case where needed) or a statement block where the contained statements may be executed in parallel. The programmer still has to have a bit of knowledge here, but the compiler and runtime can really lighten the load. And it does not have a syntax clash with either C, C++ or Objective C so could be adopted by all of them.

    I used this back in 1980s and it was awesomely easy to deal with dispatch of hundreds of lightweight instances. Essentially fibers in a more modern vernacular. By partitioning the work between the complier and the runtime systems I ran the same binary code across quad processor and 64 processor arrays. (Ancillary to this discussion was that Inmos Transputers had also built in message passing on dedicated links in hardware. Of course Fortran was also supported as was Pascal, but the main pushed language was Occam. And hardware timers were there as a data type too to make scheduling a breeze. Processors w/o hardware timers just mimicked them in the runtime. And locks were supported in the hardware as well...)

    The point is this was a elegantly solved problem in the 1980s that was mostly forgotten. It was a simple matter to have the runtime aware of the fabric an individual process could access and just turn stuff loose. But that part is a bit outside the main discussion, like I don't drift enough already!

    --
    - Tjp

    I am in wallow with my inner money grubbing capitalistic pig. ... Oink!

  26. Re:"for" or "while" loops by Haeleth · · Score: 2, Informative

    That's not what he meant. Yes, technically the index variable is changing, and it may also be used inside the loop. But the relevant questions are: "does it matter what order the iterations run in", and "does one iteration have to finish before the next can begin".

    If the answer to both questions is "no", then you can run several loop bodies at once on different processors. Bingo, instant speedup.

  27. Interesting article by Banador · · Score: 2, Interesting

    Threads Cannot be Implemented as a Library. That means pthreads is bad. Read: http://www.hpl.hp.com/techreports/2004/HPL-2004-209.pdf

    Then after a few years, work on Java memory model has found a good solution. Read: Foundations of the C++ concurrency memory model [based on the Java memory model] http://www.hpl.hp.com/techreports/2008/HPL-2008-56.pdf

    How fugly can this be for all you C++ wannabe fanguys??? (Phun intended!)

  28. Re:I'm waiting for parallel libs for R by ceoyoyo · · Score: 2, Informative

    Haeleth is correct. The problem with a for loop is that it may or may not be parallelizable. There are some compilers that attempt to guess, but they generally do a poor job.

    The secret to efficient programming in interpreted languages is that whenever you want to do something where you'd normally use a for loop, you call a compiled function to do that for you. Those utility functions are generally explicitly either parallelizable or not, so the compiler doesn't have to guess - it knows.

    Suppose I want to do C = A + B, where A and B are large arrays. In a language like C I would write a for loop:

    for (int i=0; iaLength; i++) {
        C[i] = A[i] + B[i]
    }

    That's a fairly trivial example, but that simple loop can foul up a parallelizing compiler. The equivalent in, say Python, is:

    C = A + B

    where the + operator calls a compiled C function. Whoever writes that C function KNOWS the necessary loop can be calculated in parallel, and so can code it that way. From then on, everyone who uses the + operator benefits.

    Yes, you can do the same thing with parallel libraries in compiled languages, but programmers in those languages tend not to be used to that way of thinking. As an interpreted programmer you see many, many clever tricks to, for example, do large array computations using provided compiled functions rather than straightforward for loops. Those tricks are precisely the ones you need to learn as a major component of effective parallel programming.

  29. Re:Chapel? by Eskarel · · Score: 2, Informative

    Mandarin is/was the court language of China, it was created in a rather clever way.

    The country, being very large had a number of different dialects. Mandarin was developed so that while the spoken word might be different in different areas of the country the Mandarin text was identical regardless of where you were. It was a language of scholars and regular people never really learned it(they didn't need to). The spoken form wasn't used much by anyone who wasn't a courtier(though neither was the written form).

    For example, Peking and Beijing are the same place, Peking is what they call(ed) it in the south, and Beijing is what they call it in the north, the written mandarin for both words is the same.

    To a certain extent nearly all written languages were initially created because so very few people actually wrote in the early days that there wasn't really any sort of natural evolution for a lot of written languages. For a more specific example, during the early years of the soviet union when the soviets were encouraging the development of their ethnic minorities(as opposed to kicking them off their land and putting them in work camps as they did a few years later. The Soviet government actually sent linguists out to some of the more nomadic of these groups to develop a written form of their language, which prior to this effort had never existed. That's not even counting resurrected languages which likely bear no significant resemblance to their previous forms, but which are spoken by real live people, or made up languages like Klingon that regular folks .

    Languages are both created and naturally evolve, and written languages and spoken languages do not always begin at the same time, are not always used by the same people, and are sometimes rather arbitrary.