VS 2009 Cant Find CULA

Support for issues specific to the Windows operating systems.

VS 2009 Cant Find CULA

Postby bzell » Thu Dec 09, 2010 3:41 pm

trying to compile my code using VS 2009.

I am calling the CULA routines from a .cu file and not from a .cpp [or .c for that matter]

the environment variables for CULA are set and all are correct in where they point.

VS [and I'm assuming the nvcc compiler] do not manage to find cula.h . . . So I explicitly stuck the absolute location of cula.h into the #include statement in my file. So it finds cula.h but then I get 100+ complaints about CULA data types being undefined.

My assumption is that none of the other cula include files are being found. I have included the CULA/include folder within Visual Studio project properties on the C++ page AND on the page for the CUDA rules as an additional place to search for include files.

Clearly I have messed up setting up VS to work with CULA. Can someone please set me straight?

thanks

JM
bzell
CULA Premium
 
Posts: 13
Joined: Mon Dec 06, 2010 7:36 pm

Re: VS 2009 Cant Find CULA

Postby john » Fri Dec 10, 2010 7:23 am

You need to point VS to the CULA include and lib directories. You'll want to set it in the "Additional Include Directories" item in the property pages for either the .cu file itself or in the CUDA rules if you use those (I recommend you do the latter). Or you can do it globally at Tools -> Options -> Projects & Solutions -> VC++ Directories -> Select your platform -> Select "show directories for include files" ... and then finally add the CULA directory. You'll probably want to do the CUDA directories while you're there. The environment variables can be used here for convenience, ie you can set the directory as: $(CULA_INC_PATH).

Don't forget to do the same to the library files directory list.
john
Administrator
 
Posts: 587
Joined: Thu Jul 23, 2009 2:31 pm

Re: VS 2009 Cant Find CULA

Postby bzell » Fri Dec 10, 2010 10:19 am

hi

i had already done the things you suggested. so of course when i booted up this morning the thing compiled fine.

but not completely.

gettng link errors when building: unresolved external symbol _culaStrtri & unresolved external symbol _culaInitialize

i went into the project properties | linker | input
and explicitly added cula.lib; then nothing worked:
LINK : fatal error LNK1104: cannot open file 'cula.lib'

I have entered the CULA directories in tools|options |projects|VC++ directories using the environment vars.

here is the link command:
/OUT:"C:\MSI\V4MH\V4MH\Debug\V4MH.exe" /INCREMENTAL /NOLOGO /LIBPATH:"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\lib\Win32" /LIBPATH:"C:\Program Files\TIFF\lib" /LIBPATH:"C:\Program Files\Vision4ce Ltd\GRIPWorkx\lib" /LIBPATH:"C:\Program Files\CULA\lib" /MANIFEST /MANIFESTFILE:"Debug\V4MH.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\MSI\V4MH\V4MH\Debug\V4MH.pdb" /SUBSYSTEM:CONSOLE /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:PROMPT cudart.lib libtiff.lib V4corelib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

so what should I do?
bzell
CULA Premium
 
Posts: 13
Joined: Mon Dec 06, 2010 7:36 pm

Re: VS 2009 Cant Find CULA

Postby john » Fri Dec 10, 2010 11:25 am

It looks like something is wrong in your compilation. I would try a quick command line compile to make sure everything is up and running.

Start with the minimal .cu file that uses cula:
Code: Select all
#include "cula.h"
int main()
{
    culaStatus st = culaInitialize();
    return 0;
}


Open the VS command line: start->run->Microsoft Visual Studio 2008->Visual Studio Tools->Visual Studio 2008 Command Prompt

Run this command to compile/link:
Code: Select all
nvcc cula.cu -I "c:\Program Files\CULA\include" -L "c:\Program Files\CULA\lib" -m32 -lcula


That should prove that everything is working properly and/or show where the problem is.

It's worth noting that if the linker says it can't open "cula.lib" that it sounds like something is mis-set.
john
Administrator
 
Posts: 587
Joined: Thu Jul 23, 2009 2:31 pm

Re: VS 2009 Cant Find CULA

Postby bzell » Fri Dec 10, 2010 1:59 pm

Your little dos test works -- compiles and links without errors.

so can you point to where in VS am missing the boat?
bzell
CULA Premium
 
Posts: 13
Joined: Mon Dec 06, 2010 7:36 pm

Re: VS 2009 Cant Find CULA

Postby bzell » Fri Dec 10, 2010 2:14 pm

more --

made tiny VS project with your test code.

added include directory and it compiles ok.

added 2 items in Liner: add'l dependencies and additional directories.

now errors in link:

1>Linking...
1>tester.cu.obj : error LNK2019: unresolved external symbol ___cudaUnregisterFatBinary@4 referenced in function "void __cdecl __cudaUnregisterBinaryUtil(void)" (?__cudaUnregisterBinaryUtil@@YAXXZ)
1>tester.cu.obj : error LNK2019: unresolved external symbol ___cudaRegisterFatBinary@4 referenced in function "void __cdecl __sti____cudaRegisterAll_52_tmpxft_00000d68_00000000_8_tester_compute_10_cpp1_ii_b6e08f59(void)" (?__sti____cudaRegisterAll_52_tmpxft_00000d68_00000000_8_tester_compute_10_cpp1_ii_b6e08f59@@YAXXZ)

notice that it does *not* complain about culaInitialize so it must have found that ok?
buts whats with cudaRegister ?????
bzell
CULA Premium
 
Posts: 13
Joined: Mon Dec 06, 2010 7:36 pm

Re: VS 2009 Cant Find CULA

Postby john » Fri Dec 10, 2010 3:22 pm

bzell wrote:more --

made tiny VS project with your test code.

added include directory and it compiles ok.

added 2 items in Liner: add'l dependencies and additional directories.

now errors in link:

1>Linking...
1>tester.cu.obj : error LNK2019: unresolved external symbol ___cudaUnregisterFatBinary@4 referenced in function "void __cdecl __cudaUnregisterBinaryUtil(void)" (?__cudaUnregisterBinaryUtil@@YAXXZ)
1>tester.cu.obj : error LNK2019: unresolved external symbol ___cudaRegisterFatBinary@4 referenced in function "void __cdecl __sti____cudaRegisterAll_52_tmpxft_00000d68_00000000_8_tester_compute_10_cpp1_ii_b6e08f59(void)" (?__sti____cudaRegisterAll_52_tmpxft_00000d68_00000000_8_tester_compute_10_cpp1_ii_b6e08f59@@YAXXZ)

notice that it does *not* complain about culaInitialize so it must have found that ok?
buts whats with cudaRegister ?????

If there is any CUDA code in that file, you will also need to link in the CUDA runtime (cudart.lib)
john
Administrator
 
Posts: 587
Joined: Thu Jul 23, 2009 2:31 pm

Re: VS 2009 Cant Find CULA

Postby bzell » Fri Dec 10, 2010 5:06 pm

well, what I have is EXACTLY your example code. doesnt mention cuda. i guess i will try adding cudart to the mix.
bzell
CULA Premium
 
Posts: 13
Joined: Mon Dec 06, 2010 7:36 pm

Re: VS 2009 Cant Find CULA

Postby john » Mon Dec 13, 2010 10:09 am

I think it must be the NVCC command - can you post your full NVCC command that's being used in VS?

At the same time, you can almost certainly cure it by linking in cudart.lib.
john
Administrator
 
Posts: 587
Joined: Thu Jul 23, 2009 2:31 pm

Re: VS 2009 Cant Find CULA

Postby bzell » Mon Dec 13, 2010 11:24 am

resolved the linking problems by explicitly adding in library dependency for cula.lib

THEN I also had to copy over all the cula dll files to my debug file; whats with that?

Now I have another problem completely:

I am calling cualStritr to invert a 4x4 matrix.

for the first try, i used only idagonals -- off diagonal were zero. get back

"cula runtime error"

now what?

program code is:
s= culaStrtri ( 'U', 'N', 4, C, 4);
bzell
CULA Premium
 
Posts: 13
Joined: Mon Dec 06, 2010 7:36 pm

Re: VS 2009 Cant Find CULA

Postby john » Mon Dec 13, 2010 12:00 pm

Oh, I didn't realize you weren't linking cula.lib - that would explain a lot. This is how libraries tend to work on Windows. You need to link the .lib component and then make sure that the runtime .dll component is visible to your program - either via the PATH environment variable or by putting it in the same directory.

To invert a matrix you will need to call culaSgetrf and then follow it up with culaSgetri. culaStrtri inverts a triangular matrix, not a square - I guess it's basically the same thing here since you only populated the diagonal. You will need to tell me the value of culaGetErrorInfo() - it describes which CUDA Runtime Error was generated during the call.
john
Administrator
 
Posts: 587
Joined: Thu Jul 23, 2009 2:31 pm


Return to Windows Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron