Is it possible to emulate a GPU for CUDA/OpenCL unit testing purposes?

10,798

It depends on what you mean on emulation. You cannot emulate the speed of GPUs.

The GPU is architecturally very different from the CPU, with a lot of working threads (1000s, 10000s, ...), that's why we use it. The CPU can have only a few threads, even when you parallelize the code. They also have different instruction sets.

You can however emulate the execution using special softwares, like NVEmulate for NVIDIA GPUs and OpenCL Emulator-Debugger for AMD.

A related question: GPU Emulator for CUDA programming without the hardware, where the accepted answer recommends gpuocelot for CUDA emulation.

Share:
10,798
Rob
Author by

Rob

Dr. Roberto Diaz received his degree in Telecommunications Engineering in 2006, a M.Sc.(Hons) degree in multimedia and communications in 2011 and a PhD focused on Machine Learning in 2016 from the university Carlos III de Madrid. He has worked as a Software Engineer in Sun Microsystems and as a researcher in the University Carlos III de Madrid where he has published relevant papers about the parallelization of Kernel Methods (a family of Machine Learning algorithms like SVMs or Gaussian Processes) and has taken part in many research national projects: https://scholar.google.es/citations?user=qwsmJyMAAAAJ&hl=es Currently he is the leader of the Deep Learning research line at Treelogic where he takes part in many H2020 European Research Projects. His research interest include Machine Learning and parallelization. His hobbies include taking part in Machine Learning competitions, such as those organized by Kaggle where he has won several awards and he has reached the top 100 of the world ranking of data scientist.

Updated on June 08, 2022

Comments

  • Rob
    Rob almost 2 years

    I would like to develop a library with an algorithm that can run on the CPU or the GPU. The GPU can be Nvidia (then the algorithm will use CUDA) or not (then the algorithm will use OpenCL).

    I would like to emulate a GPU in this project because maybe:

    • I will use different computer to develop the software and some of them don't have a GPU.

    • The software will be finally executed in servers that can have a GPU or not and the unit test must be executed and passed.

    Is there a way to emulate a GPU for unit testing purposes?

    In the following link:

    GPU Emulator for CUDA programming without the hardware

    They show a solution but only for CUDA, not for OpenCL and the software they propose "GPUOcelot" is no longer actively maintained.

  • Rob
    Rob over 7 years
    Thank you very much, this is what I was looking for. I have a GPU in my computer, but sometimes I prefer to code on my sofa using an old laptop with no gpu and I need to know if the code works.
  • Rohan Saxena
    Rohan Saxena almost 7 years
    @Rob in that case you may want to give rCUDA a look. It allows you to access a remote GPU from a node without a GPU. See: rcuda.net/index.php/what-s-rcuda.html