How to run CUDA without a GPU using a software implementation?
Asked Answered
M

5

19

My laptop doesn't have a nVidia graphic cards, and I want to work on CUDA. The website says that CUDA can be used in emulation mode on non-cuda hardware too. But when I tried installing CUDA drivers downloaded from their website, it gives an error "The nvidia setup couldn't locate any drivers that are compatible with your current hardware. Setup will now exit".

Also when I tried to run sample codes from SDK in Visual studio 2008, I'm getting an error that .obj file is not found.

Monteith answered 18/11, 2009 at 5:0 Comment(2)
I know it's more than two years, but you should accept one of the answers already given. Nils' answer fits nicely.Metro
Possible duplicate of GPU Emulator for CUDA programming without the hardwareGlasser
S
14

The easiest way to get started with GPU development is to get a cheap (for example GTX285) GPU and a desktop computer (obviously since u can't change the GPU in your laptop).

There are a few research projects on getting CUDA kernels to work efficiently on CPUs as well as on FPGAs (Google wen mei hwu and see his research projects) however if you want to learn CUDA this is not for you, as said above the easiest way is to get some cheap hardware.

Streetman answered 18/8, 2010 at 10:56 Comment(0)
R
6

Have you downloaded the CUDA toolkit? You'll need to download the toolkit (which includes the compiler and the runtime library) and the SDK. When you are building the SDK samples be sure to change the configuration to "EmuDebug" or "EmuRelease".

Rutharuthann answered 19/11, 2009 at 10:32 Comment(3)
Emulation is no longer supported, currently you can look at PGI's CUDA x86 compiler or GPU Ocelot.Rutharuthann
@Rutharuthann is the emulation is not supported in the newer versions like CUDA 10.0.13?Sweetbread
@Sweetbread that’s correct, no emulation. If you don’t have a GPU then could you rent from a cloud provider like AWS or Azure or Google? Not free, but you can do all the compilation and analysis locally without a GPU.Rutharuthann
L
6

Nowadays we have OpenCL. It's works on almost every hardware you can have: CPUs, GPUs (nvidia or amd), APUs, FPGAs etc.

(I reached here searching for CUDA compilation in a non nvidia hardware - for comparison purposes with OpenCL - but apparently it's still works on nvidia only. Sad :/).

Lem answered 21/2, 2016 at 12:55 Comment(0)
S
1

I know this is super late, but you can actually run CUDA on Google Colab! It takes 2 minutes to get used to and set up, but it works decently well and almost exactly like how you would on your own machine, and it's pretty cheap if you're just trying to practice! I posted a notebook in my GitHub repo here to show you how you can set it up: https://github.com/notY0rick/cuda_practice

Stuyvesant answered 16/7, 2023 at 10:44 Comment(0)
B
-1

As of 2024, there are at least two more valid options to run cuda code without nvidia GPUs.

  1. chipStar compiles CUDA and HIP code using OpenCL or level zero from Intels OneApi. Once setup it provides cuspvc, a more or less drop in replacement for the cuda compiler. Compiling a cuda file goes like

    cuspvc example.cu -o example

  2. A combination of HIPIFY and HIP-CPU can first convert your cuda code to HIP code which then can be compiled for any CPU. Once both are setup, the two steps to compile a cuda file look something like:

    1. hipify-clang example.cu --hip-kernel-execution-syntax -o example.cpp
    2. g++ example.cpp -ltbb -o example

I tested both successfully for a simple saxpy cuda example.

Barchan answered 14/3, 2024 at 6:59 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.