Various pathways exist to run CUDA on a variety of different architectures. The freely available gpuOcelot project is unique in that it currently allows CUDA binaries to run on NVIDIA GPUs, AMD GPUs, x86 and Intel Xeon Phi at full speed without recompilation. It works by dynamically analyzing and recompiling the PTX instructions of the CUDA kernels so they can run on the destination device. Sound too good to be true? Udacity has prepared a tutorial to run CUDA codes without a GPU under Linux (link). The tutorial also provides links to using gpuOcelot on Windows and Mac.
The gpuOcelot is one of several pathways to write massively parallel code so it can run on a variety of non-NVIDIA architectures.
In my classes, I teach students to “make their lives easier” and use the highest level API first. Only delve down into the lower level APIs when you need some function or to get better performance than can be achieved via the higher level API.
The various APIs to run GPU code on different architectures – in ranked order from the highest level to the lowest – are:
- OpenACC: Both PGI and CAPS enterprise have demonstrated the ability to recompile the same OpenACC source code to run on x86, ARM, AMD GPUs, Intel Xeon Phi, and NVIDIA GPUs.
- The CUDA Thrust API: Adding a flag to the compilation line allows Thrust to be built using GPUs, OpenMP, or Intel’s TBB (Thread Building Blocks). Experience has shown that the TBB performance can be surprisingly good.
- CUDA-x86: PGI has the CUDA-x86 compiler that can be used instead of nvcc to compile CUDA source code for x86 processors. PGI notes that performance on at least once kernel is equivalent to an OpenMP program compiled with the Intel icc compiler.
- The gpuOcelot project: The subject of this article.
- LLVM: The Nvidia nvcc compiler now uses the open source LLVM compiler infrastructure,
Leave a Reply