chapel
I always keep a good eye on the programming language space, so I thought...
I just so happened to stumble upon Chapel this week and after having explored it for just a bit I'm hyped and can't understand how I didn't know about it before.
I'm interested particularly in performance, and always felt drawn towards low-level languages. But as fun as it can be to think about L1, L2 cache sizes and to program in a data-oriented manner, it doesn't mean much if your language of choice doesn't lend itself to parallelization. Hardware, especially post the dawn of multi-core CPUs and now even more so given powerful GPUs, isn't your PDP-11 C was invented for.
So yes, you can end up using OpenMP, writing crafty, verbose, difficult to debug C (without namespaces, without the proper concept of a package/module, dealing with the C build system...) or use Chapel, which seems to get you 95% of the way there in 10% the effort.
So, apparently, being interested in high performance computing and programming languages, I didn't know about a:
- high performance compiled language
- w/ nice syntax
- which can interface w/ C
- isn't exactly new (2009)
- is open-source and permissively licensed (Apache 2)
- is openly developed on Github
- and (experience thus far) seems to have good documentation
- and is used and developed by the corp w/ 7 in the overall Top 10 of supercomputers
And it's not your sciency community niche 90s website, tarball download, no community outreach project either. Lots of papers, good conference talks, official Youtube, Discord, Discourse Forum, Twitter, ...
config const cC: int = 1;
config param cP: bool = false;
config type cT = complex;
// foreach
var A: [0..5] real;
foreach a in A do {
a = 1.1;
a *= 2;
}
writeln("A after foreach: ", A); // 2.2 2.2 2.2 2.2 2.2 2.2
// forall
write("forall (any order possible): ");
forall i in 0..<10 do {
write(" ", i);
}
writeln();
From just this short code example:
config
parametersconst
runtime const (can be set at runtime)param
compile const (can be set when compiling)type
(also compile time const)
So this means:
- executing via
./exe --cC=2
we can change its value when running - compiling w/
chpl src.chpl -s cP=true -s cT=imag
we changed both for compilation
Also:
foreach
is hardware-parallel (vectorized), attempting SIMD/SIMTforall
is software-parallel (uses threads akin to machine core count)var A: [0..5] real;
- nice array syntax
- use 0 or 1-index
[0..5]
,[1..5]
whatever lends itself best to an algorithm - default-initialized to type's 0 value by default (
0.0
for areal
)
... the code looks nice, is succinct, performant... and not even showcased: you can very simply run computations on many compute nodes, even GPUs without CUDA... so... isn't this even more what Mojo wants to be, but only already proven and working? And not being pythonic and not being built on top of a duck-typed scripting language is only a plus for me...
Further resources:
- Hello World variants
- (showcases parallelism and dstributed programs)
- Chapel presentation
Spread the word :)