5 ms·
Cilk Plus/LLVM: Intel Cilk Plus C/C++ Language Extensions in LLVM
- nkurz 11y agoCilk 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 11y agoYou don't need to do any of that last link for GCC 5.0+, which supports the Cilk extensions out of the box.
- nkurz 11y agoWow, 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 11y agoYes, 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 11y agoSo 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 11y agoIt 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.
- iheartmemcache 11y agoMore of the latter, from what I've skimmed at least. Cilk was a language originally developed for parallelism by MIT, they developed a Cilk Plus revision, and it later adopted by Intel as Cilk++ (where they added more functionality and a few keywords). This is basically an OSS implementation of the language without all the "good stuff" that comes with the Intel Compiler. You get green threads (fibers in Intel's lexicon), an acceptable malloc which is swapped in thought appropriate, real threading (which marks off critical sections in the conventional fashion) as necessary, and the ability to use spawn/async (a conventional barrier-wait thinger). They say "SIMD[check]" so in theory there are all of those AVX512 with the SIMD stuff (xmm0,16..ymm0-32? It's been a while since I've looked at the ISA) in here but I went through the code briefly and saw no reference to utilization of those registers. This page is really doing a real disservice to the language because where it really shines is in the tooling that integrates with the language. The Parallel Suite XE (priced around Visual Studio) lets you get some crazy-granular stuff for traditional number--crunching that GCC and LLVM doesn't produce (effectively leaving those registers unused). With ICC, to state the obvious, you get that functionality, as well as all the fantastic cluster analysis stuff. (n.b. VS with TPL does a not-too-bad-job at utilizing the AVX(edit: put in "AVR" originally ugh haha) subset of the ISA.) edit: https://bitbucket.org/intelcilkruntime/intel-cilk-runtime/src/d1f3fb93f5ab5f1276c323f40891188717b7026a/runtime/config/x86/cilk-abi-vla.c?at=master&fileviewer=file-view-default https://bitbucket.org/intelcilkruntime/intel-cilk-runtime/sr... Yeah.. not too much processor specific stuff. In that dir, a few files showed the impl details of their threads which was just a conventional mov $1, rax; mov $2,rbx, blah blah. Nothing special. There are references to the 'special sauce' (vla references) left in the code from "if __INTEL__COMPILER__" macros, so I'm guessing it's just a copy-paste. Shame, it's a great language/toolset.
- DannyBee 11y ago"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 11y agoI 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 11y agoWhat 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 11y agoThe vast majority of compiler runtime libraries have explicit exceptions to licenses to avoid this, to avoid creating copyright infringers out of everyone.
- cowsandmilk 11y agoSo? 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...
- misframer 11y agoIs this true for MIT? BSD, for example, explicitly mentions binary distribution but MIT does not.
- tbirdz 11y ago