
Cilk Plus/LLVM: Intel Cilk Plus C/C++ Language Extensions in LLVM - nkurz
http://cilkplus.github.io
======
nkurz
Cilk Plus is an Intel language extension for expressing parallelism in C and
C++: [https://www.cilkplus.org](https://www.cilkplus.org)

Mostly it's supported by Intel's ICC and ICPC compilers, but I was interested
to see that it's been ported to LLVM.

There's a parallel project for GCC as well: [https://www.cilkplus.org/build-
gcc-cilkplus](https://www.cilkplus.org/build-gcc-cilkplus)

~~~
dmpk2k
You don't need to do any of that last link for GCC 5.0+, which supports the
Cilk extensions out of the box.

~~~
nkurz
Wow, I hadn't realized! That makes it dramatically more likely that Cilk will
gain some traction.

 _Full support for Cilk Plus has been added to the GCC compiler. Cilk Plus is
an extension to the C and C++ languages to support data and task parallelism_

[https://gcc.gnu.org/gcc-5/changes.html](https://gcc.gnu.org/gcc-5/changes.html)

Do you have any idea if support is likely to be built into clang as well?

~~~
dmpk2k
Yes, the moment GCC landed those Cilk extensions, I started using them. The
Cilk5 paper was seminal, and modern Cilk incorporates some support for SIMD,
so I was delighted when GCC 5 arrived.

I don't know what the status for Clang is, but I'd be surprised if they
weren't mainlined soon; that's a largely uneducated opinion though...

------
valarauca1
So does this attempt to better utilize the multiple compute units which make
up a single compute pipeline? For example Skylake technically has 4 FPU's per
_physical core_ 1 SIMD, 3 x87 FPU-esque units, 1 branch processors, and 3-4ish
IPU's (branch processors have some IPU uOPs)?

Or is it just a compiler integrated green thread library?

The FAQ is really vague just says its makes interfacing with parallelism
easier.

~~~
aarongolliver
It started as a very simple green-parallelism library (spawn/sync/for), but it
looks like it has been expanded to include an array syntax for c (a[:] =
sqrt(b[:])*c[:])), which will automatically vectorize if possible. It also
has`#pragma simd` to hint to the compiler that you want a code block to be
vectorized, even if the compiler would otherwise not.

There's something about 'hyper objects' too which sound like race-condition
safe objects for doing things like reductions.

------
DannyBee
"The Intel® Cilk™ Plus runtime library is distributed under a BSD 3-Clause
license.

"

Enjoy having to put attribution in literally every Cilk binary you distribute
:P

~~~
silverpikezero
I don't know why you are getting downvoted. Clause #2 would require the
inclusion of the BSD license with any release of compiled code. This is a very
serious issue with the library. Any additional licensing terms which must be
propagated to the compiled software is bad juju.

~~~
tbirdz
What are you talking about? Every open source license I can think of requires
you to distribute the license with your binary: GPL, LGPL, BSD, MIT, Apache,
etc.

~~~
DannyBee
The vast majority of compiler runtime libraries have explicit exceptions to
licenses to avoid this, to avoid creating copyright infringers out of
everyone.

~~~
cowsandmilk
So? You just don't use Cilk if you don't want to include the license, just
like a normal library. It is a language extension, not something that
magically infects your regular C or Fortran code...

