How to compile a CUDA Visual Studio 2010 application?

How to compile a CUDA Visual Studio 2010 application?

Here are my steps: 1. Create an empty C ++ project without precompiled headers 2. Add main.cpp

int main() { return 0; } 
  • Add kernels.cu

    I mentioned a sample MAtrixMul project and copied its settings step by step. it can be done now

#include "cuda.h"

 __global__ void VecAdd(float* A, float* B, float* C) { int i = threadId.x; C[i] = A[i] + B[i]; } 
  • Right click on the project → Build Settings → Check cuda 3.2
  • kernels.cu -> properties -> Compile with CUDA C / C ++
  • TRY Compilation: I get an error message:

Error 37 error: This version of the CUDA Toolkit does not support the v100 compiler. . Ensure that the Platform Platform property is set to v90 under the common project node properties. C: \ Program Files (X86) \ MSBuild \ Microsoft.Cpp \ v4.0 \ BuildCustomizations \ CUDA 3.1.targets 157 4 dfdfs

  • Change ToolSet platform to v90
  • TRY Compilation: I get errors:

Error 38 MSB3721: command "C: \ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v3.1 \ Bin \ nvcc.exe" -gencode = arch = compute_10, code = \ "sm_10, compute_10 \" --use- local-env --cl version 2008 -ccbin "C: \ Program Files (x86) \ Microsoft Visual Studio 9.0 \ VC \ bin" -I "C: \ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v3.1 \ include "-G0 --keep-dir" Debug \ "-maxrregcount = 32 --machine 32 --compile -D_NEXUS_DEBUG -g -Xcompiler" / EHsc / nologo / Od / Zi / MDd "-o" Debug \ kernels.obj "" E: \ Projects Sensing \ dfdfs \ kernels.cu "" came out with code 2. C: \ Program Files (X86) \ MSBuild \ Microsoft.Cpp \ v4.0 \ BuildCustomizations \ CUDA 3.1.targets 272 4 dfdfs

Error 37 Error: The identifier "threadId" is undefined E: \ Projects! Research \ dfdfs \ kernels.cu 5 1 dfdfs

Please help me.

Thank you, Ilya

+4
source share
4 answers

Yes, I did, and it works.

  • Create a project in C ++

  • Project (right click) → build setup Check "Cuda 3.2 compiler" *

  • Add cudart.lib to properties-> linker-> input-> additional dependencies

  • Add main.cu properties Element Type = CUDA C / C ++ *

  • Project → Properties → Configuration Properties → General → Toolbox v90 **

*) will appear after installing Nvidia Parallel Nsight. Be careful, for this you need special drivers, more on the NSight main page)

**) you need to install visual C ++ 2008 express.

In any case, my nvidia forum should still be available as an example project. The problem I'm complaining about is simply outdated drivers.

+5
source

I found this post on the cuda forums on nVidia. One of the moderators says (November 09: we do not yet support VS2010).

This may not be the case anymore, but the error message indicates that the version of CUDA tool you are using does not support the V100 compiler, would suggest that you might need to update your CUDA tool kit.

If you have the latest version, check and see if the CUDA VS2010 toolkit still supports.

v90 is a way to reference the compiler that ships with VS2008, so I would suggest that VS2010 is a v100 compiler.

Perhaps you have a subscription to MSDN and can return to VS2008.

This SO post would also indicate that CUDA does not support the VS2010 compiler (yet!)

+1
source

Visual Studio 2010 is definitely supported - be sure to use the recently released nSight 1.5 (and not the beta). I did not update the question I asked, but @portland, you followed all the right steps. You just have a typo in your core.

You specified threadId.x instead of threadIdx.x - pay attention to x.

0
source

i referenced the MAtrixMul sample project and copied its settings step by step. Now it can match , but does not handle any calculations. This issue is described here in the SO section in detail.

You can view my project with everything you need from my post on the nvidia forums (2.7 kb)

Thank you, Ilya

0
source

All Articles