Search code examples
visual-studio-2010cudaarrayfire

Trouble with Arrayfire: exited with code -1073741701


I installed CUDA 5.0 and Arrayfire 1.9, and when I compile the example files, they work perfectly.

If I try to set up my own project in a different folder, I get a runtime error when I try to use anything related to the af namespace. I get the same error if I literally copy the hello-world example folder to another location and try to compile it from there. This indicates something, but I don't know what because I have little experience with using external libraries.

The error is: "The application was unable to start correctly (0xc000007b). Click OK to close the application."

My debug output is:

CODE: SELECT ALL
'DerdePoging.exe': Loaded 'C:\Users\######\Dropbox\Public\2D_CUDA_UNWRAPPER\Unwrapper_ArrayFire\DerdePoging\Debug\DerdePoging.exe', Symbols loaded.
'DerdePoging.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'DerdePoging.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'DerdePoging.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
The program '[5588] DerdePoging.exe: Native' has exited with code -1073741701 (0xc000007b).

I have noticed that my CUDA_LIB_PATH and CUDA_BIN_PATH and CUDA_INC_PATH variables are non-existent (even though I have created fully functional applications that use CUDA), so I created those (pointing to their respective folders in my Cuda installation directory). That didn't solve anything, didn't really expect it to.

Current environment variables:

AF_PATH=C:\Program Files\AccelerEyes\ArrayFire\1.9
CUDA_BIN_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\bin
CUDA_LIB_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\lib
CUDA_INC_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\include
CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\
CUDA_PATH_V5_0=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\

Those first 3 could use a \, though nothing changed when I added these variables so I don't think it matters.

I think I am missing some crucial step when I create my VS2010 project. StackOverflow tells me it's probably a missing runtime .dll. So what's of key importance here is that the examples work fine, but in different locations, they don't. I think that narrows it down to some include path that is defined relative instead of absolute.

Not sure if it's relevant, but I'll post it here anyway:

using an NVIDIA geForce 540M with 1GB of memory. An Intel i5 2410M dualcore CPU. (Asus k53sv)

Thanks in advance.

Update:

following those exact steps gives the following error:

1>Release\main.obj : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Update:

I'll try and get it to work in VS2010 Professional, which contains an x64 build configuration

Final Update: Okay so if I had to explain this to my past self (so this post has some value to people who have the same error) I would say this: -hardcode the include stuff, because the environment variables act weird -push apply after every single configuration step in VS2010 (or they won't be saved) -get VS2010 Pro so you can choose the x64 platform (this is critical and probably caused the first error, 2012 does NOT work properly)


Solution

  • You're right about CUDA_LIB_PATH and CUDA_INC_PATH being irrelevant (since CUDA 5.0). AccelerEyes has updated more recent builds of the ArrayFire library, but if you have an older release, then you're Visual Studio projects are probably still relying on the old (CUDA_X_PATH) paths instead of the new ones. Since the examples run fine, I think your problem is just that you haven't specified all the dependencies in your Visual Studio project...

    First I suggest making sure that the ArrayFire .dll is in your system path: Set environment variable PATH="%PATH%;%AF_PATH%\lib64" (assuming you are on a 64 bit machine. This allows your runtime to find the ArrayFire dll.

    Now to fix the Visual Studio build:

    1. Open up Project Properties
    2. Under "C/C++" under "General" make sure that "Additional Include Directories" contains "%CUDA_PATH%\include" and "%AF_PATH%\include"
    3. Under "Linker" under "General" make sure that "Additional Library Directories" contains "%CUDA_PATH%\lib\x64" and "%AF_PATH%\lib64"
    4. Under "Linker" under "Input" also make sure that "Additional Dependencies" contains "libaf.lib" and possibly "libafGFX.lib"