2015-04-17 70 views
1

我試圖運行在以下網址的源代碼: https://code.google.com/p/deep-learning-faces/source/checkoutMakefile中使用CUDA和MATLAB

我運行它在那裏安裝了MATLAB和CUDA 6的服務器上,但是當我做

make all 

它返回以下錯誤:

make: *** No rule to make target `fft2_cuda.mexa64', needed by `all'. Stop. 

這是Makefile中的樣子:

# Define installation location for CUDA and compilation flags compatible 
# with the CUDA include files. 
CUDAHOME = /usr/local/cuda 
INCLUDEDIR = -I$(CUDAHOME)/include 
INCLUDELIB = -L$(CUDAHOME)/lib -lcufft -Wl,-rpath,$(CUDAHOME)/lib 
CFLAGS  = -fPIC -D_GNU_SOURCE -pthread -fexceptions 
COPTIMFLAGS = -O3 -funroll-loops -msse2 

# Define installation location for MATLAB. 
export MATLAB = /usr/local/matlab 
#export MATLAB = /Applications/MATLAB_R2007b 
MEX   = $(MATLAB)/bin/mex 
MEXEXT  = .$(shell $(MATLAB)/bin/mexext) 

# 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 = fft2_cuda.mex  \ 
      fft2_cuda_sp_dp.mex \ 
      ifft2_cuda.mex  \ 
      Szeta.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) 

順便說一句,做

which matlab 

回報

/usr/local/bin/matlab 

所以,我試圖改變MATLAB目錄在Makefile文件,但它也不能工作。

有人能幫我嗎?

+0

您是否在MATLAB中調用'make'?這是[readme說明](https://code.google.com/p/deep-learning-faces/source/browse/trunk/Matlab_Cuda_1.1/README.txt#49)。 –

+0

@ m.s。這是否意味着我必須在執行matlab後調用make?我試着在matlab中調用make,但是它表示未定義的函數。 – ytrewq

+0

執行** unix('make'); ** from MATLAB –

回答

1

fft_cuda.c文件構建?我認爲.SUFFIXES規範中缺少一塊。我認爲它應該工作,以簡化的Makefile有點像這樣:

# Everything up until the .SUFFIXES line is OK, but then: 
.SUFFIXES: .c .cu $(MEXEXT) 

.c$(MEXEXT): 
    $(MEX) CFLAGS='$(CFLAGS)' COPTIMFLAGS='$(COPTIMFLAGS)' $< \ 
     $(INCLUDEDIR) $(INCLUDELIB) 

.cu$(MEXEXT): 
    $(NVMEX) -f nvopts.sh $< $(INCLUDEDIR) $(INCLUDELIB) 
+0

我做了乾淨的,並嘗試建議,但同樣的錯誤:(也許應該有一些修改前,以及後綴? – ytrewq

+1

嗯,我看着源代碼庫 - 我看不到任何' fft_cuda'源文件 - 所以這就是爲什麼Makefile不能編譯的原因。 – Edric

+0

有什麼辦法可以解決嗎?:( – ytrewq