There is always the promise of using more computing power for a single task. Your computer has multiple CPUs now, surely. Your video card has even more. Your computer is probably networked to a slew of other computers. But how do you write software to take advantage of that? There are many complex systems, of course, but there’s also Chapel.
Chapel is a reasonably simple programming language, but it supports parallelism in various forms. The run time controls how computers — whatever that means — communicate with one another. You can have code running on your local CPUs, your GPU, and other processing elements over the network without much work on your part.
What’s it look like? Here’s a simple distributed program from the project’s homepage:
// print a message per compute node coforall loc in Locales do on loc do writeln("Hello from locale ", loc.id); // print a message per core per compute node coforall loc in Locales do on loc do coforall tid in 0..<here.maxTaskPar do writeln("Hello from task ", tid, " on locale ", loc.id);
As you might guess, Locales is an array of locale objects that each describe some computing resource. The coforall statement splits a loop up to run on different locales or CPUs. You can even write GPU kernels:
coforall (gpu, row) in zip(here.gpus, localRowStart..) do on gpu {
You can try it in your browser, but for best results, you really want to download it or run it in a container. The license is Apache 2.0, so you can even contribute if you want to. If you want to really do distributed work, be sure to grab the package built for GASNet or Slurm.
While it is something new to learn, you might find it easier and more generally applicable than something like CUDA.
Whatever happened to OpenCL? I thought it was the go-to language for writing parallel computing applications for GPUs
Or OpenMP? I was always impressed how some simple pragmas could parallelise my loops (For image processing, looping through pixels).
And as of OpenMP v4, supports GPU offloading: https://www.openmp.org/wp-content/uploads/2021-10-20-Webinar-OpenMP-Offload-Programming-Introduction.pdf
Cheers,
John
I could be wrong but I think it’s been largely displaced by Vulkan since previous language limits no longer apply.
The broken quotation marks in the examples, lack of indentation and color highlighting kinda sabotages the presentation of this language than helping it.
Unfortunately, there is something in WordPress where making some kind of change (e.g., an undo) creams your code with HTML entities. I fixed it but since we haven’t figured out all the possible ways to trigger it, any time someone edits it there is a danger of it happening again.
Thanks for the fix! Didn’t know that WordPress can be such a hassle to present code.
Is that logotype a real font? That is, erm, remarkable kerning and weighting.
Looks like the font Cray used.
And?
It looks like the Cray Research logo font from the 1990s
Probably because the language was developed at Cray.
https://en.m.wikipedia.org/wiki/Chapel_(programming_language)
And the graphic is reminiscent of a Cray-2.