Problem: Vista x64, Matlab 2007b & VS2005

System Specs:

CUDA 2.0.

Matlab R2007b (7.5.0).

Visual C++ Express 2005.

Vista x64.

I cannot successfully compile the Szeta example.

I downloaded the nvmexopts.bat and nvmex.pl supplied here in one of the forum threads. When compiling I get the following error:

>> nvmex -f nvmexopts.bat Szeta.cu -IC:\cuda\include -LC:\cuda\lib -lcufft -lcudart

Szeta.cu 

c:\cuda\include\common_functions.h(56): warning: dllexport/dllimport conflict with "clock" 

C:\Program Files (x86)\Microsoft Visual Studio 8\VC\INCLUDE\time.h(176): here; dllimport/dllexport dropped 

tmpxft_00001350_00000000-3_Szeta.cudafe1.gpu 

tmpxft_00001350_00000000-8_Szeta.cudafe2.gpu 

c:\cuda\include\common_functions.h(56): warning: dllexport/dllimport conflict with "clock" 

C:\Program Files (x86)\Microsoft Visual Studio 8\VC\INCLUDE\time.h(176): here; dllimport/dllexport dropped 

tmpxft_00001350_00000000-3_Szeta.cudafe1.cpp 

Microsoft (R) Incremental Linker Version 8.00.50727.42 

Copyright (C) Microsoft Corporation.  All rights reserved. 

Szeta.obj  

LINK : fatal error LNK1181: cannot open input file 'kernel32.lib' 

 C:\PROGRA~1\MATLAB\R2007B\BIN\NVMEX.PL: Error: Link of 'Szeta.mexw64' failed. 

??? Error using ==> nvmex at 206

Unable to complete successfully.

I installed the SDK and defined the MSSDK variable as instructed.

If I try copying the lib files from the x64 MSSDK directory into matlab, I get the following error:

>> nvmex -f nvmexopts.bat Szeta.cu -IC:\cuda\include -LC:\cuda\lib -lcufft -lcudart

Szeta.cu 

c:\cuda\include\common_functions.h(56): warning: dllexport/dllimport conflict with "clock" 

C:\Program Files (x86)\Microsoft Visual Studio 8\VC\INCLUDE\time.h(176): here; dllimport/dllexport dropped 

tmpxft_00000e68_00000000-3_Szeta.cudafe1.gpu 

tmpxft_00000e68_00000000-8_Szeta.cudafe2.gpu 

c:\cuda\include\common_functions.h(56): warning: dllexport/dllimport conflict with "clock" 

C:\Program Files (x86)\Microsoft Visual Studio 8\VC\INCLUDE\time.h(176): here; dllimport/dllexport dropped 

tmpxft_00000e68_00000000-3_Szeta.cudafe1.cpp 

Microsoft (R) Incremental Linker Version 8.00.50727.42 

Copyright (C) Microsoft Corporation.  All rights reserved. 

Szeta.obj  

Szeta.obj : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64' 

 C:\PROGRA~1\MATLAB\R2007B\BIN\NVMEX.PL: Error: Link of 'Szeta.mexw64' failed. 

??? Error using ==> nvmex at 206

Unable to complete successfully.

I don’t know what else to do… Any ideas?

Thanks!

Y.

Turns out it’s not just the nvmex I’ve been having trouble with. I can’t even compile cuda code using simple “mex”.

Here’s what I get:

>> mex fft2_cuda.c -IC:\CUDA\include -LC:\CUDA\lib -lcudart -lcufft

Microsoft (R) Incremental Linker Version 9.00.21022.08 

Copyright (C) Microsoft Corporation.  All rights reserved. 

C:\Users\YOAVMO~1.EKM\AppData\Local\Temp\mex_IMbyxo\fft2_cuda.obj  

   Creating library C:\Users\YOAVMO~1.EKM\AppData\Local\Temp\mex_IMbyxo\templib.x and object C:\Users\YOAVMO~1.EKM\AppData\Local\Temp\mex_IMbyxo\templib.exp 

fft2_cuda.obj : error LNK2019: unresolved external symbol cudaFree referenced in function mexFunction 

fft2_cuda.obj : error LNK2019: unresolved external symbol cufftDestroy referenced in function mexFunction 

fft2_cuda.obj : error LNK2019: unresolved external symbol cufftExecC2C referenced in function mexFunction 

fft2_cuda.obj : error LNK2019: unresolved external symbol cufftPlan2d referenced in function mexFunction 

fft2_cuda.obj : error LNK2019: unresolved external symbol cudaMemcpy referenced in function mexFunction 

fft2_cuda.obj : error LNK2019: unresolved external symbol cudaMalloc referenced in function mexFunction 

fft2_cuda.mexw64 : fatal error LNK1120: 6 unresolved externals 

 C:\PROGRA~1\MATLAB\R2008A\BIN\MEX.PL: Error: Link of 'fft2_cuda.mexw64' failed. 

??? Error using ==> mex at 207

Unable to complete successfully.

I also have Windows XP x32 in Dual Boot and everything works fine there…

Any help would be greatly appreciated.

Y.

I don’t think VC++ Express is going to work since it can’t compile for x64. My (very limited) experiments with nvmex/mex shows that it’s going to compile for the bitness of Matlab only, so on a 64-bit platform you’d need to compile a 64-bit DLL. There’s also a script on the forums somewhere that someone wrote to support 64-bit Matlab 2007/2008–you might want to give that a go, but I really think you’re not going to have any luck until you switch to full VS2005

Works…!

I indeed installed VC2005 Professional and it works… (I had to reinstall the CUDA drivers after that, only then it fully worked…).

Thanks!

Y.

I have the same problem with Vista 32bit(!) + SP1 with an installed VC++ Express 2005 too.

Hm, i think i will also try out VC 2005 professional… If that doesn’t work I have to install my old XP :-/
Hope it works then…

greetings