# Cuda Emulation

**URL:** <https://forums.developer.nvidia.com/t/cuda-emulation/8852>\
**Category:** CUDA Programming and Performance\
**Created:** [April 11, 2009, 6:03pm UTC](https://forums.developer.nvidia.com/t/cuda-emulation/8852 "2009-04-11T18:03:08Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Huang-feihong](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Huang-feihong](https://forums.developer.nvidia.com/u/Huang-feihong)\
**Post date:** [April 11, 2009, 6:03pm UTC](https://forums.developer.nvidia.com/t/cuda-emulation/8852/1 "2009-04-11T18:03:08Z")

</div>

Hi everyone! [External Image](http://hqnveipbwb20/public/style_emoticons/<#EMO_DIR#>/thumbup.gif "Image hosted on another site. Click to open in a new tab.")

My computer don’t have a GPU capable to handle CUDA (a poor GF4 MX400 :wacko: ) so i want to test some programs in emulation mode.

I have MS Visual C++ Express and all the things froms CUDA (drivers, SDK etc) but i don’t know how to compile a CUDA program to work in emulation mode.

So i hope someone know how to do this…

Thanks!

---

<div class="post-metadata">

**Author:** ![Huang-feihong](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Huang-feihong](https://forums.developer.nvidia.com/u/Huang-feihong)\
**Post date:** [April 11, 2009, 9:35pm UTC](https://forums.developer.nvidia.com/t/cuda-emulation/8852/2 "2009-04-11T21:35:44Z")

</div>

I found this to run a cuda file on CPU:

nvcc -deviceemu -g .cu

But there is one thing i can’t understand.

When i choose a file in the SDK folders like “marchingCubes” there is a lot of files.

If i take the .cu (In this case marchingCubes\_kernel.cu) how can i have a .exe with just this file?

Second problem, when i try to compile with nvcc in command line prompt i have an error with cl.exe

Please give some help

---

<div class="post-metadata">

**Author:** ![Huang-feihong](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Huang-feihong](https://forums.developer.nvidia.com/u/Huang-feihong)\
**Post date:** [April 11, 2009, 9:42pm UTC](https://forums.developer.nvidia.com/t/cuda-emulation/8852/3 "2009-04-11T21:42:23Z")

</div>

Another thing, I run on VS 9.0 Express Edition (Visual C++ 2008)

---

<div class="post-metadata">

**Author:** ![parmar](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@parmar](https://forums.developer.nvidia.com/u/parmar)\
**Post date:** [April 17, 2009, 12:02pm UTC](https://forums.developer.nvidia.com/t/cuda-emulation/8852/4 "2009-04-17T12:02:52Z")

</div>

For windows you dont need to bother about the command line stuffs.Just install toolkit and SDK properly  
and compile the project in emudebug or emurelease build configuration.

---

<div class="post-metadata">

**Author:** ![parmar](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@parmar](https://forums.developer.nvidia.com/u/parmar)\
**Post date:** [April 17, 2009, 1:20pm UTC](https://forums.developer.nvidia.com/t/cuda-emulation/8852/5 "2009-04-17T13:20:21Z")

</div>

If you want to run your SDK project with emulator , without hardware,follow the steps

- Open your project in visual studio

- Open the cuda file from the project,which is with extension .cu

- Search for cudaSetDevice( cutGetMaxGflopsDeviceId() ); function in the cuda file.

- Set the argument as “zero”

- Now run your application with the build emudebug or emurelease

[External Image](http://hqnveipbwb20/public/style_emoticons/<#EMO_DIR#>/thumbup.gif "Image hosted on another site. Click to open in a new tab.")

---

<div class="post-metadata">

**Author:** ![SombraLee](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@SombraLee](https://forums.developer.nvidia.com/u/SombraLee)\
**Post date:** [April 17, 2009, 1:31pm UTC](https://forums.developer.nvidia.com/t/cuda-emulation/8852/6 "2009-04-17T13:31:23Z")

</div>

> [@](#):
>
> If you want to run your SDK project with emulator , without hardware,follow the steps
> 
> - Open your project in visual studio
> 
> - Open the cuda file from the project,which is with extension .cu
> 
> - Search for cudaSetDevice( cutGetMaxGflopsDeviceId() ); function in the cuda file.
> 
> - Set the argument as “zero”
> 
> eg: cudaSetDevice( 0 );
> 
> - Now run your application with the build emudebug or emurelease
> 
> [External Media](http://hqnveipbwb20/public/style_emoticons/<#EMO_DIR#>/thumbup.gif "Media hosted on another site. Click to open in a new tab.")

Wow!!! Thank you so much!!! I was stuck trying to run the template project with emulator… Now it worked. Thanks again

---

<div class="post-metadata">

**Author:** ![lion88](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@lion88](https://forums.developer.nvidia.com/u/lion88)\
**Post date:** [April 18, 2009, 7:10pm UTC](https://forums.developer.nvidia.com/t/cuda-emulation/8852/7 "2009-04-18T19:10:57Z")

</div>

"compile the project in emudebug or emurelease build configuration. " ,But how to do in VC2008?I can’t find any “emudebug or emurelease” in VC IDE?  
can anyone tell me who to do?

---

<div class="post-metadata">

**Author:** ![\_Big\_Mac](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@\_Big\_Mac](https://forums.developer.nvidia.com/u/_Big_Mac)\
**Post date:** [April 18, 2009, 8:11pm UTC](https://forums.developer.nvidia.com/t/cuda-emulation/8852/8 "2009-04-18T20:11:22Z")

</div>

lion88, are you using the CUDA Wizard that has been posted on the forum?

---

<div class="post-metadata">

**Author:** ![Huang-feihong](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Huang-feihong](https://forums.developer.nvidia.com/u/Huang-feihong)\
**Post date:** [April 18, 2009, 9:35pm UTC](https://forums.developer.nvidia.com/t/cuda-emulation/8852/9 "2009-04-18T21:35:55Z")

</div>

Hi im back!

Thanks for the useful answers!

But i have a problem with VS 9.0:

I don’t have any “Emudebug” or “Emurelease” just “Debug” or “Release”

How can i inform the IDE to match these propreties?

---

<div class="post-metadata">

**Author:** ![\_Big\_Mac](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@\_Big\_Mac](https://forums.developer.nvidia.com/u/_Big_Mac)\
**Post date:** [April 19, 2009, 9:29am UTC](https://forums.developer.nvidia.com/t/cuda-emulation/8852/10 "2009-04-19T09:29:37Z")

</div>

I think both of you should try to use the wizard if you haven’t already. Here it is  
[url=“[CUDA VS Wizard - Browse Files at SourceForge.net](http://sourceforge.net/project/showfiles.php?group_id=243299)”][CUDA VS Wizard - Browse Files at SourceForge.net](http://sourceforge.net/project/showfiles.php?group_id=243299%5B/url%5D)

Install it, start a new project in VS using CUDA template and see if now you see Emu versions.

---

<div class="post-metadata">

**Author:** ![Huang-feihong](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Huang-feihong](https://forums.developer.nvidia.com/u/Huang-feihong)\
**Post date:** [April 19, 2009, 10:27am UTC](https://forums.developer.nvidia.com/t/cuda-emulation/8852/11 "2009-04-19T10:27:04Z")

</div>

Good it works!

Now i have “Emudebug” and “Emurelease” thanks but i don’t know why when i compile the “particle” project i don’t have a .exe even if the compiler tell me that the opÃ©ration suceed.

------ DÃ©but de la gÃ©nÃ©rationÂ : ProjetÂ : particles, ConfigurationÂ : EmuDebug Win32 ------  
Compiling with CUDA Build Rule…  
“C:\CUDA\bin\nvcc.exe” -arch sm\_10 -ccbin “C:\Program Files\Microsoft Visual Studio 9.0\VC\bin” -Xcompiler "/EHsc /W3 /nologo /O2 /Zi /MTd " -IC:\CUDA\include -I./ -I…/…/common/inc -maxrregcount=32 --compile -o EmuDebug\particleSystem.cu.obj particleSystem.cu  
particleSystem.cu  
tmpxft\_0000be98\_00000000-3\_particleSystem.cudafe1.gpu  
tmpxft\_0000be98\_00000000-8\_particleSystem.cudafe2.gpu  
tmpxft\_0000be98\_00000000-3\_particleSystem.cudafe1.cpp  
tmpxft\_0000be98\_00000000-13\_particleSystem.ii  
Note: including lib: glut32.lib  
Compilation en cours…  
clÂ : Ligne de commande warning D9035Â : l’option ‘Wp64’ est dÃ©sapprouvÃ©e et sera supprimÃ©e dans une version ultÃ©rieure  
param.cpp  
paramgl.cpp  
Note: including lib: glut32.lib  
particles.cpp  
Note: including lib: glut32.lib  
particleSystem.cpp  
render\_particles.cpp  
shaders.cpp  
GÃ©nÃ©ration de code en cours…  
Ã‰dition des liens en cours…  
Incorporation du manifeste en cours…  
ExÃ©cution d’un Ã©vÃ©nement aprÃ¨s gÃ©nÃ©ration…  
Le journal de gÃ©nÃ©ration a Ã©tÃ© enregistrÃ© Ã l’emplacement “file://c:\Documents and Settings\All Users\Application Data\NVIDIA Corporation\NVIDIA CUDA SDK\projects\particles\EmuDebug\BuildLog.htm”  
particles - 0 erreur(s), 1 avertissement(s)  
========== GÃ©nÃ©rationÂ : 1 a rÃ©ussi, 0 a Ã©chouÃ©, 0 mis Ã jour, 0 a Ã©tÃ© ignorÃ© ==========

---

<div class="post-metadata">

**Author:** ![Huang-feihong](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Huang-feihong](https://forums.developer.nvidia.com/u/Huang-feihong)\
**Post date:** [April 19, 2009, 11:28am UTC](https://forums.developer.nvidia.com/t/cuda-emulation/8852/12 "2009-04-19T11:28:56Z")

</div>

If you want to run your SDK project with emulator , without hardware,follow the steps

- Open your project in visual studio
- Open the cuda file from the project,which is with extension .cu
- Search for cudaSetDevice( cutGetMaxGflopsDeviceId() ); function in the cuda file.
- Set the argument as “zero”

eg: cudaSetDevice( 0 );

- Now run your application with the build emudebug or emurelease

==\> Yes i found the line “cudaSetDevice( cutGetMaxGflopsDeviceId() )” in the file “ParticleSystem.cu”.

I erase cutGetMaxGflopsDeviceId() to just let the line “cudaSedDevice( 0 );” but same problem, no .exe

---

<div class="post-metadata">

**Author:** ![\_Big\_Mac](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@\_Big\_Mac](https://forums.developer.nvidia.com/u/_Big_Mac)\
**Post date:** [April 19, 2009, 11:30am UTC](https://forums.developer.nvidia.com/t/cuda-emulation/8852/13 "2009-04-19T11:30:30Z")

</div>

It seems the linker doesn’t kick in after the compiler is done. I don’t know what might be causing it.

---

<div class="post-metadata">

**Author:** ![Huang-feihong](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Huang-feihong](https://forums.developer.nvidia.com/u/Huang-feihong)\
**Post date:** [April 19, 2009, 11:34am UTC](https://forums.developer.nvidia.com/t/cuda-emulation/8852/14 "2009-04-19T11:34:10Z")

</div>

Another, i have a strange file in my folder after compiling called : “particle.exe.intermediate.manifest”

---

<div class="post-metadata">

**Author:** ![parmar](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@parmar](https://forums.developer.nvidia.com/u/parmar)\
**Post date:** [April 20, 2009, 12:16pm UTC](https://forums.developer.nvidia.com/t/cuda-emulation/8852/15 "2009-04-20T12:16:51Z")

</div>

Hi all,  
You cant see the exe in the EmuDebug folder.Please find the executable file in the given path

```
      ..\NVIDIA CUDA SDK\bin\win32\EmuDebug

   This is the path where you installed your CUDA SDK

```

thanks,…

---

<div class="post-metadata">

**Author:** ![Huang-feihong](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Huang-feihong](https://forums.developer.nvidia.com/u/Huang-feihong)\
**Post date:** [April 20, 2009, 12:29pm UTC](https://forums.developer.nvidia.com/t/cuda-emulation/8852/16 "2009-04-20T12:29:54Z")

</div>

Thanks! I found the directory which contain all the executables.

But how can i have OpenGL support? (when i double clik on an exe, the command prompt tell me that i miss OpenGl and quit after)

---

<div class="post-metadata">

**Author:** ![Huang-feihong](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Huang-feihong](https://forums.developer.nvidia.com/u/Huang-feihong)\
**Post date:** [April 20, 2009, 1:34pm UTC](https://forums.developer.nvidia.com/t/cuda-emulation/8852/17 "2009-04-20T13:34:08Z")

</div>

OpenGL extensions exactly

---

<div class="post-metadata">

**Author:** ![joshhart](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@joshhart](https://forums.developer.nvidia.com/u/joshhart)\
**Post date:** [April 20, 2009, 3:21pm UTC](https://forums.developer.nvidia.com/t/cuda-emulation/8852/18 "2009-04-20T15:21:53Z")

</div>

> [@](#):
>
> OpenGL extensions exactly

I’m having a very similar error. Running simpleGL gives the message: ERROR: Support for necessary OpenGL extensions missing.

I’m trying to run CUDA in emulation on an Intel GPU under Vista, with Visual Studio 2008. This seems like it’s an OpenGL problem and not a CUDA problem, but as far as I can tell the libraries included with the SDK should run fine on my machine. Any leads?

---

<div class="post-metadata">

**Author:** ![parmar](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@parmar](https://forums.developer.nvidia.com/u/parmar)\
**Post date:** [April 21, 2009, 6:05am UTC](https://forums.developer.nvidia.com/t/cuda-emulation/8852/19 "2009-04-21T06:05:08Z")

</div>

Hi all,

```
   I am getting the output, when we double clicked on exe for given path.
   Can you mention which card(like nVidia or ATI) you are using??its required some card that support OpenGL.

```

Regards,  
Parmar

---

<div class="post-metadata">

**Author:** ![parmar](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@parmar](https://forums.developer.nvidia.com/u/parmar)\
**Post date:** [April 21, 2009, 6:13am UTC](https://forums.developer.nvidia.com/t/cuda-emulation/8852/20 "2009-04-21T06:13:28Z")

</div>

Hi all,

```
   Please check in SDK clock and bandWidthTest sample is working on your system.
   If these are working,then surely you need some graphics card for OpenGL sample.

```

Regards,  
parmar.

[Next page](https://forums.developer.nvidia.com/t/cuda-emulation/8852.md?page=2)
