cuda-gdb(v2.2) + MATLAB(64bit) + Ubuntu(8.04 + 64bit)

Has anyone figured out how to get MATLAB to play nice with mex files compiled with the flags (-g -G) and symbols needed for debugging using cuda-gdb?

I get the following message when I try to load the mex file into matlab

[codebox]??? Invalid MEX-file ‘/blah/myfunc.mexa64’:

/blah/myfunc.mexa64: undefined symbol: $gpu_registers.[/codebox]

I am using

CUDA 2.2

MATLAB (v7.7 r2008b + 64bit)

Ubuntu (v8.04 + 64bit)

Create an object file from ptxvars.cu in /usr/local/cuda/bin and add it to the linking stage in your makefile for the mex.

Thanks, one step forward…, now a new problem

[codebox]nvcc /usr/local/cuda/bin/ptxvars.cu -g -G --host-compilation=c -c -D__DEVICE_LAUCH_PARAMETERS_H__ -Xptxas -fext

/usr/local/cuda/bin/ptxvars.cu(13): error: declaration is incompatible with “const uint3 threadIdx”

/usr/local/cuda/bin/…/include/device_launch_parameters.h(53): here

/usr/local/cuda/bin/ptxvars.cu(14): error: declaration is incompatible with “const uint3 blockIdx”

/usr/local/cuda/bin/…/include/device_launch_parameters.h(55): here

/usr/local/cuda/bin/ptxvars.cu(15): error: declaration is incompatible with “const dim3 blockDim”

/usr/local/cuda/bin/…/include/device_launch_parameters.h(57): here

/usr/local/cuda/bin/ptxvars.cu(16): error: declaration is incompatible with “const dim3 gridDim”

/usr/local/cuda/bin/…/include/device_launch_parameters.h(59): here

4 errors detected in the compilation of “/tmp/tmpxft_00003d3a_00000000-7_ptxvars.cpp1.ii”.

make: *** [psi_ez3d_cuda_test.mexa64] Error 255

[/codebox]

One problem typo in ptxvars.cu

DEVICE_LAUCH_PARAMETERS_H should be DEVICE_LAUNCH_PARAMETERS_H

although I still get the same error message, I’ll continue to look.

/*
nvcc ptxvars.cu -g -G --host-compilation=c -c -D__DEVICE_LAUCH_PARAMETERS_H__ -Xptxas -fext
*/

Try:
nvcc -c ptxvars.cu

Same problem, nvcc seems to be getting device_launch_parameters.h from someplace, and has processed it before it gets to processing ptxvars.cu.

[codebox]$ nvcc -c ptxvars.cu

ptxvars.cu(13): error: declaration is incompatible with “const uint3 threadIdx”

/usr/local/cuda/bin/…/include/device_launch_parameters.h(53): here

ptxvars.cu(14): error: declaration is incompatible with “const uint3 blockIdx”

/usr/local/cuda/bin/…/include/device_launch_parameters.h(55): here

ptxvars.cu(15): error: declaration is incompatible with “const dim3 blockDim”

/usr/local/cuda/bin/…/include/device_launch_parameters.h(57): here

ptxvars.cu(16): error: declaration is incompatible with “const dim3 gridDim”

/usr/local/cuda/bin/…/include/device_launch_parameters.h(59): here

4 errors detected in the compilation of “/tmp/tmpxft_00004427_00000000-4_ptxvars.cpp1.ii”.

[/codebox]

Same error with the -v options, results below.

A couple of interesting things

This seem wrong : -D"DEVICE_LAUNCH_PARAMETERS_H"

(BTW --define-macro does the same thing)

And nvcc is adding its own includes, which I think would be okay of the quotes were not put around DEVICE_LAUNCH_PARAMETERS_H

[codebox]nvcc -v -D__DEVICE_LAUNCH_PARAMETERS_H__ -c ptxvars.cu

#$ SPACE=

#$ MODE=DEVICE

#$ HERE=/usr/local/cuda/bin

#$ THERE=/usr/local/cuda/bin

#$ TOP=/usr/local/cuda/bin/…

#$ LD_LIBRARY_PATH=/usr/local/cuda/bin/…/lib:/usr/local/cuda/bin/…/extools/lib:/usr/local/cuda/lib:/home/krys/opts/lib:/usr/local/cuda/cudaprof/bin

#$ PATH=/usr/local/cuda/bin/…/open64/bin:/usr/local/cuda/bin/…/bin:/home/krys/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/cuda/bin:/usr/local/cuda/cudaprof/bin:/usr/local/matlab/bin

#$ INCLUDES="-I/usr/local/cuda/bin/…/include" “-I/usr/local/cuda/bin/…/include/cudart”

#$ LIBRARIES= “-L/usr/local/cuda/bin/…/lib” -lcudart

#$ CUDAFE_FLAGS=

#$ OPENCC_FLAGS=

#$ PTXAS_FLAGS=

#$ gcc -D__CUDA_ARCH__=100 -E -x c++ -DCUDA_NO_SM_12_ATOMIC_INTRINSICS -DCUDA_NO_SM_13_DOUBLE_INTRINSICS -DCUDA_FLOAT_MATH_FUNCTIONS -DCUDA_NO_SM_11_ATOMIC_INTRINSICS “-I/usr/local/cuda/bin/…/include” “-I/usr/local/cuda/bin/…/include/cudart” -I. -D__CUDACC__ -C -D"DEVICE_LAUNCH_PARAMETERS_H" -include “cuda_runtime.h” -m64 -o “/tmp/tmpxft_0000472e_00000000-4_ptxvars.cpp1.ii” “ptxvars.cu”

#$ cudafe --m64 --gnu_version=40204 --diag_error=host_device_limited_call --diag_error=ms_asm_decl_not_allowed -tused --gen_c_file_name “/tmp/tmpxft_0000472e_00000000-1_ptxvars.cudafe1.c” --stub_file_name “/tmp/tmpxft_0000472e_00000000-1_ptxvars.cudafe1.stub.c” --stub_header_file_name “/tmp/tmpxft_0000472e_00000000-1_ptxvars.cudafe1.stub.h” --gen_device_file_name “/tmp/tmpxft_0000472e_00000000-1_ptxvars.cudafe1.gpu” --include_file_name “/tmp/tmpxft_0000472e_00000000-3_ptxvars.fatbin.c” “/tmp/tmpxft_0000472e_00000000-4_ptxvars.cpp1.ii”

#$ gcc -D__CUDA_ARCH__=100 -E -x c -DCUDA_NO_SM_12_ATOMIC_INTRINSICS -DCUDA_NO_SM_13_DOUBLE_INTRINSICS -DCUDA_FLOAT_MATH_FUNCTIONS -DCUDA_NO_SM_11_ATOMIC_INTRINSICS “-I/usr/local/cuda/bin/…/include” “-I/usr/local/cuda/bin/…/include/cudart” -I. -D__CUDACC__ -C -m64 -o “/tmp/tmpxft_0000472e_00000000-5_ptxvars.cpp2.i” “/tmp/tmpxft_0000472e_00000000-1_ptxvars.cudafe1.gpu”

#$ cudafe --m64 --gnu_version=40204 --c --gen_c_file_name “/tmp/tmpxft_0000472e_00000000-6_ptxvars.cudafe2.c” --stub_file_name “/tmp/tmpxft_0000472e_00000000-6_ptxvars.cudafe2.stub.c” --stub_header_file_name “/tmp/tmpxft_0000472e_00000000-6_ptxvars.cudafe2.stub.h” --gen_device_file_name “/tmp/tmpxft_0000472e_00000000-6_ptxvars.cudafe2.gpu” --include_file_name “/tmp/tmpxft_0000472e_00000000-3_ptxvars.fatbin.c” “/tmp/tmpxft_0000472e_00000000-5_ptxvars.cpp2.i”

ptxvars.cu(14): error: declaration is incompatible with “const struct uint3 threadIdx”

/usr/local/cuda/bin/…/include/device_launch_parameters.h(53): here

ptxvars.cu(15): error: declaration is incompatible with “const struct uint3 blockIdx”

/usr/local/cuda/bin/…/include/device_launch_parameters.h(55): here

ptxvars.cu(16): error: declaration is incompatible with “const struct dim3 blockDim”

/usr/local/cuda/bin/…/include/device_launch_parameters.h(57): here

ptxvars.cu(17): error: declaration is incompatible with “const struct dim3 gridDim”

/usr/local/cuda/bin/…/include/device_launch_parameters.h(59): here

4 errors detected in the compilation of “/tmp/tmpxft_0000472e_00000000-5_ptxvars.cpp2.i”.

–error 0x200 –

[/codebox]

One more thing…

-D"DEVICE_LAUNCH_PARAMETERS_H" is not the problem it looks like the quotes are valid.

Still no solution.