1

I've been using CUDA 4.0 for sometime now. I've recently downloaded and copied CUDA 4.1 new API (I need Thrust's lambda expressions support) but my solution's properties are still linked to the old 4.0 API. How do I change it dynamically? My guess is that I need to change the $(CudaToolkitLibDir) variable, but how exactly?

edit : i'm asking this because i'm trying to use thrust::placeholders

igal k
  • 1,883
  • 2
  • 28
  • 57
  • Well, environment variables are located in Control Panel->System->Advanced System Settings->Environment Variables. – Apprentice Queue Mar 13 '12 at 18:13
  • What is `$(CudaToolkitLibDir)`? An environment variable, a Makefile variable? What OS build system are you asking about here? – talonmies Mar 13 '12 at 18:18
  • If you're talking about Windows+VS, I seem to remember that CudaToolkitLibDir is specified as part of the build customizations used in Visual Studio. It is automatically derived from your CUDA_PATH environment variable. So check if that points to your CUDA 4.1 directory. I'm not 100% sure, so just a comment. And if you make use of these build customizations, have you made sure you switched to the 4.1 ones? – Bart Mar 13 '12 at 18:20
  • you guys were right, it was under the build cust.. problem now that 4.1 causes my program to crush right on the first cudaMalloc() function(), when i switch back to to 4.0 everything works perfectly, is it possible to only cuda 's 4.0 thrust library to 1.6? – igal k Mar 13 '12 at 18:26
  • So it was the build customization switch that helped? You can always download Thrust from http://code.google.com/p/thrust/ . But I haven't combined 4.0 with 1.6 myself, so no guarantees. – Bart Mar 13 '12 at 18:29
  • yea i switched, well i tried to copy thrust 1.6 instead of the existing one... thrust::placeholders remains undefined :( – igal k Mar 13 '12 at 18:32
  • Perhaps make that a separate question, showing the code you've written. – Bart Mar 13 '12 at 18:38
  • 1
    @igalk: placeholders is declared in `thrust/functional.h`. If you include it and then add the namespace with `using namespace thrust::placeholders`, it should just work. – talonmies Mar 13 '12 at 18:48
  • When you installed CUDA 4.1, did you first upgrade your NVIDIA driver to the one required by CUDA 4.1? Please submit an answer explaining how to change `$(CudaToolkitLibDir)` so future askers can benefit. – harrism Mar 14 '12 at 01:10
  • @harrism: i just installed 4.1 sdk toolkit.. and changed the build customization, doing that allowed me to compile the program without any errors but caused crashes which i couldn't resolve... in the end i switched back to 4.0 and developed my own kernel function.. – igal k Mar 14 '12 at 06:21

1 Answers1

2

To answer the specific question:

  • For VS2005 or VS2008, you need to change the Custom Build Rules to pick up the CUDA 4.1 rule instead of 4.0. See this post for more information.
  • For VS2010, you need to change the Build Customization to pick up CUDA 4.1 instead. See this post for more information.

Looking at the comments, it's also clear you will need to install a CUDA 4.1 driver which you can download from the NVIDIA website. You said your program crashed on the first cudaMalloc() when you updated to 4.1, you should check the error message (in general you should check all API calls for errors). The first CUDA API call will return an "Insufficient Driver Version" message if your driver is not up-to-date.

Community
  • 1
  • 1
Tom
  • 20,852
  • 4
  • 42
  • 54