Coriander Project: Compile CUDA Codes To OpenCL, Run Everywhere

Written by Michael Larabel in Programming on 21 May 2017 at 08:02 AM EDT. 11 Comments
AMD's GPUOpen has been working on the HIP compiler to allow NVIDIA CUDA code to be executed on AMD GPUs, but now there's a separate and more universal effort: Coriander.

The Coriander project, formerly known as the CUDA-On-CL effort, is allowing NVIDIA CUDA code to be compiled into OpenCL 1.2 kernels. With targeting generic OpenCL 1.2 code, this automatically ported code from CUDA can run on all GPUs having a CL 1.2 implementation. This effort uses LLVM's Clang to compile the CUDA kernels into bytecode and then from there is an OpenCL generator to take the bytecode into OpenCL 1.2 compliant code. There's also work on implementing portions of the CUDA API in OpenCL.

The generated OpenCL code is slower for full reductions and large batch sizes but is comparable for other operations. This project is at a stage where "CUDA-on-CL actually works, on some fairly complex kernels." Coriander is working with both Intel and Radeon graphics hardware as well as running back on NVIDIA GPUs over OpenCL, which makes for useful performance comparisons.

Those wanting to learn more can see these IWOCL slides while the code is hosted on GitHub under the Apache 2.0 license.
Related News
About The Author
Author picture

Michael Larabel is the principal author of and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via

Popular News This Week