CUDA with Matlab 2007a to 2008a on Windows XP x64 Failure to compile Szeta.cu with nvmex

Hi All,

I am trying to simply compile and execute Szeta.cu from the CUDA Matlab Toolkit on the following system:

Windows XP x64
Matlab 2007a, 2007b, and 2008a
CUDA 2.0
CUDA Matlab Toolkit
VS 2005 Professional
Dual Quad-Core Xeons @ 2.33 GHz
10 GB of RAM
nVidia GeForce 8800 GTX 786 MB

I would like to be able to use Matlab 2008a, but I gather from a previous post that some files have changed from the 2007 versions and the current CUDA Matlab Toolkit may not work. Consequently I have installed 2007a and 2007b in an attempt to make CUDA work with Matlab to no avail.

In all three versions of Matlab I can compile and execute the following lines from the README.txt successfully:

[font=“Courier”]>> mex fft2_cuda.c -IC:\CUDA\include -LC:\CUDA\lib -lcudart -lcufft

mex fft2_cuda_sp_dp.c -IC:\CUDA\include -LC:\CUDA\lib -lcudart -lcufft
mex ifft2_cuda.c -IC:\CUDA\include -LC:\CUDA\lib -lcudart -lcufft
speed_fft
tic; FS_2Dturb(128,1,1,1); toc;[/font]

However, the following line fails (although slighly differently) in all three versions of Matlab after updating nvmexopts.bat to work with x64:

[font=“Courier”]>> nvmex -f nvmexopts.bat Szeta.cu -IC:\cuda\include -LC:\cuda\lib -lcufft -lcudart[/font]

In Matlab 2008a:
[font=“Courier”]Undefined subroutine &main::uuidgen called at C:\Program Files\MATLAB\R2008a\bin\nvmex.pl line 728.
??? Error using ==> nvmex at 206
Unable to complete successfully.[/font]

In Matlab 2007a and 2007b:
[font=“Courier”]Szeta.cu
c:\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_00003104_00000000-3_Szeta.cudafe1.gpu
tmpxft_00003104_00000000-8_Szeta.cudafe2.gpu
c:\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_00003104_00000000-3_Szeta.cudafe1.cpp
cl : Command line warning D9025 : overriding ‘/EHc-’ with ‘/EHc’
Microsoft ® Incremental Linker Version 8.00.50727.42
Copyright © Microsoft Corporation. All rights reserved.

C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\mex_82019D72-CB7F-4812-E09E-7579B5CBD19E\Szeta.obj
Creating library C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\mex_82019D72-CB7F-4812-E09E-7579B5CBD19E\templib.x and object C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\mex_82019D72-CB7F-4812-E09E-7579B5CBD19E\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\R2007B\BIN\NVMEX.PL: Error: Link of ‘Szeta.mexw64’ failed.

??? Error using ==> nvmex at 206
Unable to complete successfully.[/font]

Is there any way to get CUDA to work with one of the last three versions of Matlab on a Windows XP x64 system?

Thanks ever so much for your help,

Rupert

You should try the new scripts for R2008a:

[url=“http://forums.nvidia.com/index.php?showtopic=66961”]http://forums.nvidia.com/index.php?showtopic=66961[/url]

The files are for Windows XP 32 bit

Does anybody have a fix for the errors encountered with MATLAB R2007a? I’m also getting the same errors with 64 bit vista

Hi there,

I have encountered the same problem yesterday on a xp64/matlab r2008a machine. I solved it by modifying the nvmex.pl and nvmexopt.bat. Please find below the working files.

cheers,
Ali
nvmexopts.bat.txt (3.05 KB)
nvmex.pl.txt (106 KB)

Thanks for your help. I can get the simulations to work if I use the nvmexopts.bat file you posted and the nvmex.pl file I posted at http://forums.nvidia.com/index.php?showtopic=74210.

If I try to use both files you posted I get the error:

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

Can't locate File/Temp.pm in @INC (@INC contains: C:/Program Files/MATLAB/R2007a/sys/perl/win32/lib C:/Program Files/MATLAB/R2007a/sys/perl/win32/site/lib .) at C:\Program Files\MATLAB\R2007a\bin\nvmex.pl line 126. 

BEGIN failed--compilation aborted at C:\Program Files\MATLAB\R2007a\bin\nvmex.pl line 126. 

??? Error using ==> nvmex at 206

Unable to complete successfully.

the nvmex.pl file does indeed not work with matlab 2007a since the perl version has changed in r2008a. I had googled your error some time ago ( I had the same problem ) and it seems that teh temporary files module is missing in the old matlab version.

This may not be the right place to ask but could you or anybody else explain when to use mex and when to use nvmex? For example, why does the plugin compile fft2_cuda.c with mex and Szeta.cu with nvmex? (Other than the file extensions)

mex is for use with pure C code (no device or global functions and no kernel calls as far as I know) as it just calls gcc / whichever compiler you have chosen in matlab.
nvmex is for the other occasions ans calls nvcc.

WARNING: $ARCH (UNKNOWN) not set correctly [win64]

C:\PROGRA~1\MATLAB\R2008B\BIN\NVMEX.PL:
Error: Using options file:
C:\Users\Dima\AppData\Roaming\MathWorks\MATLAB\R2008b\mexopts.bat
You cannot use this file with the UNKNOWN architecture because it enables
a compiler for a different architecture.
Running mex -setup may resolve this problem.

??? Error using ==> nvmex at 206
Unable to complete successfully.

I was training all, I think. Not working.
Vista 64, Matlab 2008a, Visual Studio 2008

mex working ok.

but nvmex not working

Thanks for the contrib Abdelali. These files worked perfectly on my WinXP 64bit with Matlab R2008a and VS2005.

Can you, or anyone else, guide me on what changes I might need to make to get this working on a Vista 64bit with Matlab R2008b and VS2008?

Thanks for the help!

Same interest here, have setup working with Vista 64bit, Matlab R2008a, and VS2005.

Would like to switch to VS2008, what should be updated in the batch file?

I run into problem(s) when I tried to compile the sample codes using VS2008. After some digging, I found out that VS2008 installed a few things in different locations. For example, (for me at least) %VCINSTALLDIR%\PlatformSDK\lib\AMD64 and %VSINSTALLDIR%\SDK\v2.0\lib\AMD64 are either empty or nonexistent.

Usually the libraries can be found in C:\Program Files\Microsoft SDKs\Windows\v6.0A. So if you add this path in the nvmexopts.bat file and replace all the %VCINSTALLDIR%\PlatformSDK with that path, it should work for you.

I have attached both nvmex.pl and nvmexopts.bat files that I use to compile the sample correctly. (The nvmex.pl file is from Abdelali External Media .)

System:

Windows XP Pro x64

Matlab 2009a x64 (CUDA plug in 1.1)

Visual Studio 2008

CUDA version 2.2

Geforce 8800 GT

Enjoy,

I run into problem(s) when I tried to compile the sample codes using VS2008. After some digging, I found out that VS2008 installed a few things in different locations. For example, (for me at least) %VCINSTALLDIR%\PlatformSDK\lib\AMD64 and %VSINSTALLDIR%\SDK\v2.0\lib\AMD64 are either empty or nonexistent.

Usually the libraries can be found in C:\Program Files\Microsoft SDKs\Windows\v6.0A. So if you add this path in the nvmexopts.bat file and replace all the %VCINSTALLDIR%\PlatformSDK with that path, it should work for you.

I have attached both nvmex.pl and nvmexopts.bat files that I use to compile the sample correctly. (The nvmex.pl file is from Abdelali External Media .)

System:

Windows XP Pro x64

Matlab 2009a x64 (CUDA plug in 1.1)

Visual Studio 2008

CUDA version 2.2

Geforce 8800 GT

Enjoy,
nvmexopts.bat.txt (3.06 KB)
nvmex.pl.txt (106 KB)

With the files of mfatica I get an error like DS.Will
with abdelali zahi files I get “nvcc fatal : Cannot find compiler ‘cl.exe’ in PATH”
I edited my VC-Path into PATH, but it wont work… I also tryed VC\bin\AMD64.

My system:
Vista 64bit on Athlon 6000
Matlab 2008a
MS VS 2005 (just upgraded to SP1, but problem persists)
I also can install VS 2008, got booth licenses from university - will this help?

Solution: My MS VS is in another folder
Although old PATH is copied, too this error was thrown…

I am trying to get this to work on my computer but unfortunately, no success so far…
running this example:
nvmex -f nvmexopts.bat Szeta.cu -IC:\cuda\include -LC:\cuda\lib -lcufft -lcudart
gives me this error:
C:\PROGRA~2\MATLAB\R2008B\BIN\NVMEX.PL:
Error: Using options file:
nvmexopts.bat
You cannot use this file with the WIN32 architecture because it enables
a compiler for a different architecture.
Choose a file that is compatible with the WIN32 architecture.

I am running Windows XP x64 and Matlab 2008b x32
(I can’t use Matlab x64 because Mathworks still does not provide a x64 compiler for Excel add-ins…)

Can anybody please help?
Did anyone manage to make this work under a similar environment?

I have Visual Studio C++ 2008 Express Edition and CUDA SDK/Toolkit 2.3 (x64)

I have the same problem on Win7 64bit Matlab R2009a 64bit and CUDA 2.2. helllppppp! anyone find a solution? or where one can get help from nvidia?