I am trying to get CUDA working within MATLAB, I seem to be having particularly trouble with CUBLAS’s Memory transfer functions.
When I use cublasalloc or cublassetvector functions, they fail to execute as seen by the exceptions thrown (caught using cublas status)
The functions in the Matlab examples Szeta and fs_turbo both seem to work well, however none of them call any BLAS
Could anyone tell me if there is a way to know if all my libraries are included correctly in the MAKEFILE, so that I can look around more thoroughly in this problem
MATLAB stack trace is below
Register State: eax = 0a9a50f0 ebx = 0a30d15c ecx = 9d8d41d9 edx = 00000000 esi = 00000001 edi = 00000010 ebp = bfa6a648 esp = bfa6a610 eip = a1041d4c flg = 00010212 Stack Trace:  libcudart.so.2:cudaMemcpy~(0x9d8d41d9, 0x09486980, 16, 1) + 124 bytes  Affine_Quadpro_Wrapper.mexglx:0x9d8d4217(0x09486980, 0xb499a368, 0x978e4010, 0)  Affine_Quadpro_Wrapper.mexglx:0x9d8d4b5c(0x97a11010, 0x978e4010, 0x977b7010, 0x9768a010)  Affine_Quadpro_Wrapper.mexglx:mexFunction~(2, 0xbfa6b040, 18, 0xbfa6b0a0) + 1212 bytes  libmex.so:mexRunMexFile(2, 0xbfa6b040, 18, 0xbfa6b0a0) + 109 bytes
A relevant snippet of my Makefile is below
# 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 -lcuda -lcufft -lcublas -lcudart -Wl,-rpath,$(CUDAHOME)/lib CFLAGS = -fPIC -D_GNU_SOURCE -pthread -fexceptions -lcutil COPTIMFLAGS = -O3 -funroll-loops -msse2 # Define installation location for MATLAB. export MATLAB = /usr/local/matlab73 #export MATLAB = /Applications/MATLAB_R2007b MEX = $(MATLAB)/bin/mex MEXEXT = .$(shell $(MATLAB)/bin/mexext)
I am stumped since I moved all my stuff to another machine on Fedora- 64 bit, Just reused the same makefile and everything worked like a dream…
I have done the obvious things like making sure the header files are there as below.
#include "mex.h" #include "cublas.h" #include <time.h> #include <stdlib.h> #include "cuda.h" #include "cufft.h" #include "cuda_runtime.h" #include "driver_types.h"
Could some one please explain what is the non intuitive difference between cuda_runtime and the header files called cuda_runtime_api, driver_types which are only there in ifft2_cuda sample. The documentation mentions the host and device runtimes and doesnt elaborate on what the header files do.