nvmex still supported for toolkit 3.2?

Hi all,

Is nvmex still supported for cuda 3.2? I haven’t been able to compile using my makefile that was previously working when I had cuda 2.3 installed now that I upgraded to 3.2. I keep getting the following error when I run my makefile:

./nvmex -f nvopts.sh LDPCGF.cu -I/usr/local/cuda/tk3.2/include -L/usr/local/cuda/tk3.2/lib64 -lcufft -lcudart -Wl,-rpath,/usr/local/cuda/tk3.2/lib64

./nvmex: line 936: -c: command not found

mex: compile of ‘cudacode.cu’ failed.

make: *** [LDPCGF.mexa64] Error 1

I can run the SDK examples so I know my install is fine and the PATH and LD_LIBRARY_PATH environment variables are set correctly.

I’ve pasted my Makefile below, maybe there’s something that I’m missing that I need to change?

# Define installation location for CUDA and compilation flags compatible

# with the CUDA include files.

#CUDAHOME    = /usr/local/cuda

CUDAHOME    = /usr/local/cuda/tk3.2

INCLUDEDIR  = -I$(CUDAHOME)/include

INCLUDELIB  = -L$(CUDAHOME)/lib64 -lcufft -lcudart -Wl,-rpath,$(CUDAHOME)/lib64

CFLAGS      = -fPIC -D_GNU_SOURCE -pthread -fexceptions

COPTIMFLAGS = -O3 -funroll-loops -msse2

# Define installation location for MATLAB.

export MATLAB = /opt/matlab2011a

#export MATLAB = /usr/local/matlab

#export MATLAB = /Applications/MATLAB_R2007b

MEX           = $(MATLAB)/bin/mex

MEXEXT        = .$(shell $(MATLAB)/bin/mexext)

#export PATH=$(PATH):$(CUDAHOME)/bin

#export LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(CUDAHOME)/lib

# nvmex is a modified mex script that knows how to handle CUDA .cu files.

NVMEX = ./nvmex

# List the mex files to be built.  The .mex extension will be replaced with the

# appropriate extension for this installation of MATLAB, e.g. .mexglx or

# .mexa64.

MEXFILES = cudacode.mex

all: $(MEXFILES:.mex=$(MEXEXT))

clean:

	rm -f $(MEXFILES:.mex=$(MEXEXT))

.SUFFIXES: .cu .cu_o .mexglx .mexa64 .mexmaci

.c.mexglx:

	$(MEX) CFLAGS='$(CFLAGS)' COPTIMFLAGS='$(COPTIMFLAGS)' $< \

        $(INCLUDEDIR) $(INCLUDELIB)

.cu.mexglx:

	$(NVMEX) -f nvopts.sh $< $(INCLUDEDIR) $(INCLUDELIB)

.c.mexa64:

	$(MEX) CFLAGS='$(CFLAGS)' COPTIMFLAGS='$(COPTIMFLAGS)' $< \

        $(INCLUDEDIR) $(INCLUDELIB)

.cu.mexa64:

	$(NVMEX) -f nvopts.sh $< $(INCLUDEDIR) $(INCLUDELIB)

.c.mexmaci:

	$(MEX) CFLAGS='$(CFLAGS)' COPTIMFLAGS='$(COPTIMFLAGS)' $< \

        $(INCLUDEDIR) $(INCLUDELIB)

.cu.mexmaci:

	$(NVMEX) -f nvopts.sh $< $(INCLUDEDIR) $(INCLUDELIB)

You can try this other method.

From inside the matlab shell

!nvcc -c myfun.cu -Xcompiler -fPIC -I /usr/local/matlab/extern/include

mex myfun.o -L /usr/local/cuda/lib64 -lcudart -lcufft

Or use cmake : http://forums.nvidia.com/index.php?showtopic=152839

I use this all the time and it works ™

Above fix (!nvcc) works like a charm.