nvmex on 64bit vista matlab R2007a

When trying to compile the Szeta.cu file on a computer running 64 bit vista with a Quadro NVS 290, I get the error

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

Szeta.cu 

c:\nvidia\cuda\include\common_functions.h(56): warning: dllexport/dllimport 

          conflict with "clock" (declared at line 176 of "C:/Program Files 

          (x86)/Microsoft Visual Studio 8/VC/bin/..\INCLUDE\time.h"); 

          dllimport/dllexport dropped 

tmpxft_000009e0_00000000-3_Szeta.cudafe1.gpu 

tmpxft_000009e0_00000000-8_Szeta.cudafe2.gpu 

c:\nvidia\cuda\include\common_functions.h(56): warning: dllexport/dllimport 

          conflict with "clock" (declared at line 176 of "C:/Program Files 

          (x86)/Microsoft Visual Studio 8/VC/bin/..\INCLUDE\time.h"); 

          dllimport/dllexport dropped 

tmpxft_000009e0_00000000-3_Szeta.cudafe1.cpp 

cl : Command line warning D9025 : overriding '/EHc-' with '/EHc' 

Microsoft (R) Incremental Linker Version 8.00.50727.42 

Copyright (C) Microsoft Corporation.  All rights reserved. 

C:\Users\oct\AppData\Local\Temp\mex_197DDF2C-6523-4C9F-1C89-2B222619C032\Szeta.obj  

   Creating library C:\Users\oct\AppData\Local\Temp\mex_197DDF2C-6523-4C9F-1C89-2B222619C032\templib.x and object C:\Users\oct\AppData\Local\Temp\mex_197DDF2C-6523-4C9F-1C89-2B222619C032\templib.exp 

Szeta.obj : error LNK2001: unresolved external symbol _fltused 

Szeta.obj : error LNK2001: unresolved external symbol __GSHandlerCheck 

Szeta.obj : error LNK2019: unresolved external symbol __security_cookie referenced in function __device_stub__Z12non_linear_2PfP6float2S1_S1_fi 

Szeta.obj : error LNK2019: unresolved external symbol __security_check_cookie referenced in function __device_stub__Z12non_linear_2PfP6float2S1_S1_fi 

LINK : error LNK2001: unresolved external symbol _DllMainCRTStartup 

Szeta.mexw64 : fatal error LNK1120: 5 unresolved externals 

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

??? Error using ==> nvmex at 206

Unable to complete successfully.

Does anybody know how to solve this? If you want more details of how I got this error you can read on:

I started out having the same problem trying to compile a CUDA mex file as described here: http://forums.nvidia.com/index.php?act=ST&f=70&t=61572.

In short, when I try to compile Szeta.cu I get the error:

$ARCH (UNKNOWN) not set correctly [win64]

So I hard coded the $ARCH variable in the nvmex.pl perl script attached (from C:\Program Files\MATLAB\R2007a\bin) by explicitly setting $ARCH = “win64”; and this seemed to make that error go away.

I then got more errors and ended up changing some of the “32”'s and “86”'s in the nvmexopts.bat file (attached) with “64”'s. (Ex: I changed /Machine:x86 to /Machine:X64 and I left some 32’s such as kernel32.lib since this seemed to work in the 64 bit CUDA template posted by kyzhao at http://forums.nvidia.com/index.php?act=ST&…t=0#entry390252 )

At one point I also got the error:

nvcc fatal : nvcc cannot find a supported cl version. Only MSVC 7.1 and MSVC 8.0 are supported

since I am using the MSVC compiler from MATLAB but I ended up fixing that by adding the -ccbin switch under “Compiler Parameters” in the nvmexopts.bat file
nvmexopts.bat.txt (2.97 KB)
nvmex.pl.txt (104 KB)

I have faced the same problem today with a xp64 machine. I have solved the problem and will be posting the configuration files tomorrow. the problem lies in the nvmex options. it it made for 32-bit so all you need to do is to change the directories in the LIB variable to point to their AMD64 counterparts (example : %VCINSTALLDIR/LIB/AMD64).

as I said I will be posting the configuration files once I go back to the office tomorrow.

/Ali

Two workarounds for MATLAB r2008a and r2007a (Thanks to abdelali zahi for their help)

For r2008a use nvmex.pl and nvmexopts.bat from:

http://forums.nvidia.com/index.php?showtop…ndpost&p=421552


For r2007a use nvmexopts.bat from:
http://forums.nvidia.com/index.php?showtop…ndpost&p=421552

and nvmex.pl from
http://forums.nvidia.com/index.php?showtop…ndpost&p=421130

My system Vista x64, MCVS2008, MATLAB2008a.

i had problem like this;

after
ARCH (UNKNOWN) not set correctly [win64]

So I hard coded the $ARCH variable in the nvmex.pl perl script attached (from C:\Program Files\MATLAB\R2007a\bin) by explicitly setting $ARCH = “win64”; and this seemed to make that error go away.

I then got more errors and ended up changing some of the “32”'s and “86”'s in the nvmexopts.bat file (attached) with “64”'s. (Ex: I changed /Machine:x86 to /Machine:X64 and I left some 32’s such as kernel32.lib since this seemed to work in the 64 bit CUDA template posted by kyzhao at http://forums.nvidia.com/index.php?act=ST&…t=0#entry390252 )

problems gone. but =((((
next problems

nvmex -f nvmexoptions.bat x2.cu

nvcc fatal : Unknown option ‘oC:\Users\Dima\AppData\Local\Temp\mex_gQQ31w\x2.obj’

C:\PROGRA~1\MATLAB\R2008B\BIN\NVMEX.PL: Error: Compile of ‘x2.cu’ failed.

Hi there,

I am having trouble getting nvmex to work with the following:

  • Matlab 7.5.0 (2007b)

  • Vista 64 bit

  • Microsoft Visual Studio 9.0 (2008)

The latest standard ‘nvmexopts.bat’ and ‘nvmex.pl’ files did not work (as could be expected in this case), so I tried the ones linked here by wedgeproduct (for 2007a).

The only entries in these files I found to change were in ‘nvmexopts.bat’, i.e. replacing

“set VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 8”

with

“set VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 9.0”

When I try to compile the Szeta.cu in Matlab with the following command:

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

I get the following error:

"nvcc fatal : Visual Studio configuration file ‘(null)’ could not be found for installation at ‘C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN/…/…’

C:\PROGRA~4\MATLAB\R2007B\BIN\NVMEX.PL: Error: Compile of ‘Szeta.cu’ failed.

??? Error using ==> nvmex at 206

Unable to complete successfully."

Can anyone suggest what i still need to do to get this to work?

Many thanks, MT

(P.S. I also replaced the line

“set VS80COMNTOOLS=%VS80COMNTOOLS%”

with

“set VS90COMNTOOLS=%VS90COMNTOOLS%”

but this did not change the error above…)

Hi again,

I forgot to mention that I am using Visual C++ 2008 Express Edition, with the extra SDK installed to achieve 64-bit compilation.

Looking around for non-Matlab specific CUDA posts, I found others sharing similar problems, e.g.

http://forums.nvidia.com/lofiversion/index.php?t72719.html
http://forums.nvidia.com/index.php?act=ST&…t=0#entry450970

In my case I have the file ‘vcvars64.bat’ in the directory ‘C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin’, so that’s one issue others have discussed that doesn’t seem to apply here.

In any case, these other posts seem to imply that Express 2008 + SDK can fail for 64 bit compilation whereas the standard VC++2008 works fine…

I am tempted to uninstall the 64 bit CUDA Toolkit/SDK and try installing/using the 32 bit versions … but I have the feeling this might not function on my 64 bit system…

Any words of wisdom would be greatly appreciated.

Regards, MT

Hi,

I finally came across the following post:
http://forums.nvidia.com/index.php?showtopic=98319

so I guess my problem was already solved.

Regards, MT