CUDA newbie read image


I work with VS 8.0 and I would like to know how I can specify the localisation of my data.

In fact when I’m running my CUDA appliaction with VisualStudio there is no problem but if I want to execute the file .exe the appliaction return an reading image error

So if someone know why, please help me

Not sure I quite understand the question…but I’ll take a stab at it anyway. I’m assuming what you’re seeing is that when you run from within the VS ide, you load an image file (placed in the project’s folder) and then do stuff with it. When you go into the .\Debug (or .\bin\Debug) folder and double-click the exe, it complains that it can’t find the image (which is in one of the parent directories).

My experience has indicated that VS artifically changes the working directory of the program when it’s run from the ide so you don’t have to keep a bunch of copies of files around for each build configuration (so you don’t need an image in the Debug folder, another in the Release folder, and so on). I don’t know how to change this behavior from within VS, but I’ve come up with a few solutions in my experiments:

  1. Use absolute paths. Not a very appealing option, but it should make things work.

  2. Make local copies of your input data (my general preferred option), especially if the files aren’t too big.

  3. Run from within the ide using the “Start without debugging” command (Debug menu). I believe that is “supposed” to make it act like any other exe on your system while keeping the working directory the project directory.

  4. Use a shortcut to run the exe standalone. In the shortcut properties box, you can specify the “Start In” path - this is the directory the exe perceives as “here” when the program starts.

Hope that helps!


In the properties for the solution, change the entry for configuration properties : debugging : working directory.

Remember to select “all configurations” or the specific configuration you want to modify. It’s easy to forget the configuration and then not have the setting you wanted in the right place.

Yes, but the default is still the project directory, not the directory the actual exe is located in. Incidentally, is there a way to specify the exe’s directory without going through each configuration individually?