1

I want to be able to run my software in GPU mode on NVidia and in CPU (sofware) mode on ATI or Intel. How can I achieve this?

It's the same like PhysX works.

Currently I get an error on ATI card machine stating that nvcuda.dll is not found.

Please don't advise OpenCL. This question is similar to mine. But the OpenCL answer is not acceptable for me.

I'm on Windows 7 + Visual Studio 2008

Community
  • 1
  • 1
Dmitriy
  • 5,357
  • 8
  • 45
  • 57
  • 1
    There is no "software mode" in CUDA. You will have to provide you own CPU code path and use it when there is no available GPU detected by the CUDA runtime. – talonmies Apr 06 '12 at 13:18
  • @talonmies technically correct, but there's some awesome stuff out there: http://code.google.com/p/gpuocelot/ – Scott M. Apr 06 '12 at 13:22
  • @scottM: I am well aware of ocelot, but that doesn't help here. Ocelot relies on a reimplementation of the CUDA runtime. You can't use it *and* the CUDA runtime together in the same application. – talonmies Apr 06 '12 at 13:33
  • so... when he wants to run in GPU mode when an nvidia card is present and software mode on ati and intel... ocelot doesn't do that? – Scott M. Apr 06 '12 at 13:52

2 Answers2

8

converting this to an answer:

there's a software called GPU Ocelot that will figure out what hardware to run the gpu code on at runtime: http://code.google.com/p/gpuocelot/

run all your calls through Ocelot and you should be good to go.

From the homepage:

Ocelot is a modular dynamic compilation framework for heterogeneous system, providing various backend targets for CUDA programs and analysis modules for the PTX virtual instruction set. Ocelot currently allows CUDA programs to be executed on NVIDIA GPUs, AMD GPUs, and x86-CPUs at full speed without recompilation.

Scott M.
  • 7,313
  • 30
  • 39
  • 1
    You should determine if nvcuda.dll is resident on the machine. If so you can dynamically load nvcuda.dll and use cuDevice* API to query the devices. If there is a sufficient devices then you can dynamically load a DLL that references CUDART. GPU ocelot is a means for running CUDA code on multi machines. PhysX does not do this. PhysX has a CUDA code path and a multi-threaded CPU path. – Greg Smith Sep 25 '12 at 00:19
  • @GregSmith but how do I determine if nvcuda.dll is resident on the machine? Post you comments as an answer and I will accept it – Dmitriy Dec 21 '12 at 09:43
  • While nobody has made a PhysX backend for Ocelot yet, that is not to say it's impossible. I have been hoping someone would take this on. – Robert Wm Ruedisueli Nov 13 '16 at 05:23
1

There are now initiatives to run CUDA on non-NVidia hardware such as by Otoy : http://venturebeat.com/2016/03/09/otoy-breakthrough-lets-game-developers-run-the-best-graphics-software-across-platforms/

Essentially it translates CUDA calls to other backends (Metal, Vilkan, DirectX, OpenGL) to allow applications written for CUDA to run on a range of platforms. It's not known whether it will be possible to simply put their nvcuda.dll in the right location and thereby instantly get your app working, or if the developer would have to change something before deploying the software.

So far there is no public release afaik.

Elliot Woods
  • 834
  • 11
  • 20