cuda-gdb missing from CUDA toolkit 9 on OS X?

I just installed CUDA Toolkit 9, and cuda-gdb is no longer included on Mac OS X.

MacBook-Air:~ admin$ ls /Developer/NVIDIA/CUDA-9.0/bin/
bin2c				nsight_ee_plugins_manage.sh
computeprof			nvcc
crt				nvcc.profile
cuda-install-samples-9.0.sh	nvdisasm
cuda-memcheck			nvlink
cudafe				nvprof
cudafe++			nvprune
cuobjdump			nvvp
fatbinary			ptxas
gpu-library-advisor		uninstall_cuda_9.0.pl
nsight

This prevents remote debugging using Nsight from working. If I reconfigure Nsight to use cuda-gdb from CUDA 8, it complains as follows.

cuda-gdb version (8.0.127) is not compatible with cuda-gdbserver version (8.0.128).\nPlease use the same version of cuda-gdb and cuda-gdbserver.

Why is this occurring? This doesn’t seem to be documented anywhere. What’s the problem?

Just stumbled across this, too. It’s mentioned in the CUDA Toolkit Release Notes:

Chapter 3. Debugger. The cuda-gdb debugger is no longer included in the CUDA Toolkit installer packages for Mac OS.

There’s no mention why and what the alternative is?

That’s extremely disappointing.

I can understand not wanting to support OS X because few people deploy applications on non-Linux based systems.

However, dropping support for cuda-gdb also means that OS X no longer supports remote debugging. My company issues MacBook Pros to all our developers, so that’s what I work on, and I now have to use cuda-gdb on the command line over ssh. Some may prefer that, but I don’t. Big step backwards.

Anyone who managed to compile cuda-gdb from source (“x86_64-apple-darwin”) ? → http://developer.download.nvidia.com/compute/cuda/opensource/9.0.176/cuda-gdb-9.0.176.src.tar.gz

I’ve tried but get compilation errors…

Ok I think I’ve managed to compile the thing and remote debugging seems to work, if anyone is interested in trying it out please let me know →

Linus-MacBook-Pro:bin linus$ ./cuda-gdb 

NVIDIA (R) CUDA Debugger
9.0 release
Portions Copyright (C) 2007-2017 NVIDIA Corporation
GNU gdb (GDB) 7.12
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin16.7.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(cuda-gdb) set sysroot target://
(cuda-gdb) target remote 192.168.0.114:1234
Remote debugging using 192.168.0.114:1234
Reading /home/linus/cuda-workspace/BlackScholes/Debug/BlackScholes from remote target...
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
Reading /home/linus/cuda-workspace/BlackScholes/Debug/BlackScholes from remote target...
Reading symbols from target:/home/linus/cuda-workspace/BlackScholes/Debug/BlackScholes...done.
Reading /lib64/ld-linux-x86-64.so.2 from remote target...
Reading /lib64/ld-linux-x86-64.so.2 from remote target...
Reading symbols from target:/lib64/ld-linux-x86-64.so.2...Reading /lib64/ld-2.23.so from remote target...
warning: the debug information found in "target:/lib64/ld-2.23.so" does not match "target:/lib64/ld-linux-x86-64.so.2" (CRC mismatch).

Reading /lib64/.debug/ld-2.23.so from remote target...
(no debugging symbols found)...done.
(cuda-gdb) continue
Continuing.
Reading /lib/x86_64-linux-gnu/librt.so.1 from remote target...
Reading /lib/x86_64-linux-gnu/libpthread.so.0 from remote target...
Reading /lib/x86_64-linux-gnu/libdl.so.2 from remote target...
Reading /usr/lib/x86_64-linux-gnu/libstdc++.so.6 from remote target...
Reading /lib/x86_64-linux-gnu/libm.so.6 from remote target...
Reading /lib/x86_64-linux-gnu/libgcc_s.so.1 from remote target...
Reading /lib/x86_64-linux-gnu/libc.so.6 from remote target...
Reading /lib/x86_64-linux-gnu/librt-2.23.so from remote target...
Reading /lib/x86_64-linux-gnu/.debug/librt-2.23.so from remote target...
Reading /lib/x86_64-linux-gnu/f189ef8db8c3734c6a678e6ef3cb0b206d58b2.debug from remote target...
Reading /lib/x86_64-linux-gnu/.debug/f189ef8db8c3734c6a678e6ef3cb0b206d58b2.debug from remote target...
Reading /lib/x86_64-linux-gnu/libdl-2.23.so from remote target...
Reading /lib/x86_64-linux-gnu/.debug/libdl-2.23.so from remote target...
Reading /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21 from remote target...
Reading /usr/lib/x86_64-linux-gnu/.debug/libstdc++.so.6.0.21 from remote target...
Reading /lib/x86_64-linux-gnu/libm-2.23.so from remote target...
Reading /lib/x86_64-linux-gnu/.debug/libm-2.23.so from remote target...
Reading /lib/x86_64-linux-gnu/.debug/libgcc_s.so.1 from remote target...
Reading /lib/x86_64-linux-gnu/libc-2.23.so from remote target...
Reading /lib/x86_64-linux-gnu/.debug/libc-2.23.so from remote target...
Reading /usr/lib/x86_64-linux-gnu/libcuda.so.1 from remote target...
Reading /usr/lib/nvidia-384/libnvidia-fatbinaryloader.so.384.90 from remote target...
[Inferior 1 (process 10840) exited normally]
(cuda-gdb)

Hello, I’m trying to compile cuda-gdb on 9.1 toolkit but no success. Any suggestion/library to install/source file to modify?

Thanks,
Fabrizio

Sure thing! Here goes…

As a starting point go with the following ./configure options/flags (paths needs to be updated to fit your environment and CUDA-9.1 libraries):

./configure --program-prefix=cuda- --enable-cuda --enable-targets=x86_64-unknown-linux-gnu,m68k-unknown-linux-gnu CFLAGS='-I/Developer/NVIDIA/CUDA-9.0/include -I/Developer/NVIDIA/CUDA-9.0/extras/Debugger/include' LIBS='-lpthread' LDFLAGS='-lpthread -framework IOKit -framework Security -framework CoreFoundation'

Then I pretty much worked my way from there; make - debug - make clean/distclean - make (again). I can provide the patch set from cuda-gdb-9.0.176, mostly it’s about fixing some pointer casting errors.

Once it builds successfully you will have a ‘gdb’ binary under ./gdb

Good luck!

//Linus

Would you be so kind as to link the patch files required to build this?

Here goes; applicable for <<cuda-gdb-9.0.176.tar.gz>>

diff -r ./cuda-gdb-9.0.176/gdb/cuda-darwin-nat.c ../cuda-gdb-9.0.176/gdb/cuda-darwin-nat.c
143c143,144
<   CFDataRef reg_ref;
---
>   CFTypeRef reg_ref;
>   //CFDataRef reg_ref;
154c155
<   pci_id = ((uint32_t *)CFDataGetBytePtr(reg_ref))[0];
---
>   pci_id = ((uint32_t *)CFDataGetBytePtr((CFDataRef)reg_ref))[0];
diff -r ./cuda-gdb-9.0.176/gdb/cuda-events.c ../cuda-gdb-9.0.176/gdb/cuda-events.c
85,86c85,86
<        !cuda_options_gpu_busy_check () ||
<        !cuda_darwin_cuda_device_used_for_graphics (dev_id))
---
>        !cuda_options_gpu_busy_check () /*||
>        !cuda_darwin_cuda_device_used_for_graphics (dev_id)*/)
diff -r ./cuda-gdb-9.0.176/gdb/cuda-exceptions.c ../cuda-gdb-9.0.176/gdb/cuda-exceptions.c
111c111
<       filename = strrchr (sal.symtab->filename, '/');
---
>       filename = (char *) strrchr (sal.symtab->filename, '/');
diff -r ./cuda-gdb-9.0.176/gdb/cuda-iterator.c ../cuda-gdb-9.0.176/gdb/cuda-iterator.c
298a299,333
> cuda_iterator
> cuda_iterator_create (cuda_iterator_type type, cuda_coords_t *filter, int int_mask)
> {
>   uint32_t i;
>   cuda_iterator itr;
> 
>   itr = (cuda_iterator) xmalloc (sizeof *itr);
>   itr->type         = type;
>   itr->filter       = filter ? *filter: CUDA_INVALID_COORDS;
>   itr->mask         = (cuda_select_t) int_mask;
>   itr->num_elements = 0;
>   itr->num_unique_elements = 0;
>   itr->list_size    = 1024;
>   itr->index        = 0;
>   itr->completed    = false;
>   itr->list         = (cuda_coords_t*) xmalloc (itr->list_size * sizeof (*itr->list));
> 
>   if (filter)
>     itr->filter.valid = true;
>   itr->current.dev = itr->current.sm = itr->current.wp = itr->current.ln = 0;
> 
>   /* Iterators by physical coordinates can be lazy */
>   if ((type & CUDA_ITERATOR_TYPE_MASK_PHYSICAL) != 0)
>     return itr;
> 
>   while (cuda_iterator_step (itr));
>   itr->completed = true;
> 
>   /* sort the list by coordinates */
>   qsort (itr->list, itr->num_elements, sizeof (*itr->list),
>          (int(*)(const void*, const void*))cuda_coords_compare_logical);
> 
>   return itr;
> }
> 
diff -r ./cuda-gdb-9.0.176/gdb/cuda-iterator.h ../cuda-gdb-9.0.176/gdb/cuda-iterator.h
39a40,43
> cuda_iterator cuda_iterator_create  (cuda_iterator_type type,
>                                      cuda_coords_t *filter,
>                                      int int_mask);
> 
diff -r ./cuda-gdb-9.0.176/gdb/cuda-regmap.c ../cuda-gdb-9.0.176/gdb/cuda-regmap.c
672c672
<   tmp = strchr (func_name, '(');
---
>   tmp = (char *) strchr (func_name, '(');
diff -r ./cuda-gdb-9.0.176/gdb/darwin-nat.c ../cuda-gdb-9.0.176/gdb/darwin-nat.c
2204c2204,2208
<       return darwin_xfer_siginfo (ops, object, annex, readbuf, writebuf, offset, len);
---
>       {
>         *xfered_len = (ULONGEST) darwin_xfer_siginfo (ops, object, annex, readbuf, writebuf, offset, len);
>         //return darwin_xfer_siginfo (ops, object, annex, readbuf, writebuf, offset, len);
>         return TARGET_XFER_OK;
>       }

diff -r ./cuda-gdb-9.0.176/gdb/doublest.c ../cuda-gdb-9.0.176/gdb/doublest.c
258c258
<       mant_bits = min (mant_bits_left, 32);
---
>       mant_bits = fmin (mant_bits_left, 32);
568c568
<       mant_bits = min (mant_bits_left, 32);
---
>       mant_bits = fmin (mant_bits_left, 32);
912c912
<       memcpy (to, from, min (TYPE_LENGTH (from_type), TYPE_LENGTH (to_type)));
---
>       memcpy (to, from, fmin (TYPE_LENGTH (from_type), TYPE_LENGTH (to_type)));

diff -r ./cuda-gdb-9.0.176/gdb/libcudbg.c ../cuda-gdb-9.0.176/gdb/libcudbg.c
66c66
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
104c104
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
125c125
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
145c145
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
198c198
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
220c220
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
243c243
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
267c267
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
290c290
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
313c313
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
336c336
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
367c367
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
392c392
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
418c418
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
443c443
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
467c467
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
491c491
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
515c515
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
547c547
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
572c572
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
598c598
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
623c623
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
651c651
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
674c674
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
702c702
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
724c724
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
744c744
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
765c765
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
786c786
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
807c807
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
828c828
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
857c857
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
884c884
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
928c928
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
952c952
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
982c982
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1046c1046
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1069c1069
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1090c1090
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1111c1111
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1149c1149
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1172c1172
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1195c1195
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1219c1219
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1244c1244
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1269c1269
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1297c1297
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1320c1320
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1344c1344
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1371c1371
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1391c1391
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1420c1420
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1441c1441
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1472c1472
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1511c1511
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1534c1534
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1556c1556
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1577c1577
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1597c1597
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1626c1626
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1649c1649
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1672c1672
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1694c1694
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1718c1718
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1742c1742
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1764c1764
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1790c1790
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1816c1816
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1843c1843
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1864c1864
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1887c1887
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1908c1908
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1930c1930
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1951c1951
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
1975c1975
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
2001c2001
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
2021c2021
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
2045c2045
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
2070c2070
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
2091c2091
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);
2115c2115
<     CUDBG_IPC_REQUEST((void *)&ipc_buf);
---
>     CUDBG_IPC_REQUEST((void **)&ipc_buf);

diff -r ./cuda-gdb-9.0.176/gdb/source.c ../cuda-gdb-9.0.176/gdb/source.c
673c673
<       lastsep = strrchr(s->filename, '/');
---
>       lastsep = (char *) strrchr(s->filename, '/');

What about CUDA 9.2?

Haven’t tried out CUDA 9.2 on MacOS High Sierra yet, but I would guess the status remains the same? In that case the above stated patches should apply as well. Checkout → http://developer.download.nvidia.com/compute/cuda/opensource/

Hi, did anyone was able to install cuda-gdb for CUDA 9.2?

I have an error on the make step:

darwin-nat.c:2204:14: error: cannot initialize return object of type
‘enum target_xfer_status’ with an rvalue of type ‘LONGEST’ (aka ‘long’)
…darwin_xfer_siginfo (ops, object, annex, readbuf, writebuf, offset, len);

And how do you automatically apply the changes from the posted patch? (Sorry, I am newbie)

I’ve applied the changes to all these files manually (does anyone know how to do it automatically??)

I was not able to run ./configure with the options listed above.
After the following steps: ./configure → make I got the following error:

ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Same here. We were using version 8 (which included it), but were forced to upgrade deepstream to version 3 and thus nsight with it. However, after using the patches above (quite time consuming), I am getting the same error as mr titan above…

ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It is sad. Not sure the reason for just removing things without so much as a heads up, but it is quite annoying how NVIDIA treats its customers. Thanks for the patch notes above, but no luck sadly.

If anyone knows or has direction, it would be appreciated, not like nvidia is going to help lol

Hi all,

Ok I will have another go at it with a more recent version of CUDA toolkit.

Any version in particular that is of more interest?

Now if just NVIDIA and Apple could get their stories straight… with MacOS 10.14 “Mojave” I no longer have CUDA support; neither for the dGPU 750M nor my external eGPU 1060 GTX.

Haha, yeah. I am not surprised. Too bad all of the things couldn’t play nicer together. But, thank you that would be awesome.

I tried your patches above on cuda version 10.1. Which, ‘seemed’ okay up until it went to do the final compile to make the cuda-gdb file, in which we got the above (still uncertain if its an osx toolchain issue, but been trying to see if i can compile it on ubuntu for darwin)

Although, TBH I’ve never used cuda on OSX, don’t really need to. We just use the OSX Nsight to connect to remote machines (far away) to build, debug, profile code against and the remote server listens, just use cuda-gdb on OSX to connect to that.

Anyway, it seems to be no trivial task so thank you.

Cheers

OK I managed to build the <<cuda-gdb-10.1.105.src.tar>> tarball with the above stated patches:

NVIDIA (R) CUDA Debugger
10.1 release
Portions Copyright (C) 2007-2018 NVIDIA Corporation
GNU gdb (GDB) 7.12
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin18.2.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(cuda-gdb) quit

Note that I had to add CXXFLAGS=‘-I/usr/local/cuda/include’ (since cuda-gdb.c is building with g++ and is now looking for #include “cuda.h” when running ./configure:

./configure --program-prefix=cuda- --enable-cuda --enable-targets=x86_64-unknown-linux-gnu,m68k-unknown-linux-gnu CFLAGS='-I/usr/local/cuda/include -I/usr/local/cuda/extras/Debugger/include' CXXFLAGS='-I/usr/local/cuda/include' LIBS='-lpthread' LDFLAGS='-lpthread -framework IOKit -framework Security -framework CoreFoundation'

Please note that I used XCode_92 while building.

I’ll try to do some actual remote debugging towards a Ubuntu host and will let you know later how it works out!

Success!! Once I compiled the gdb binary I just copied it from the ./gdb src/target directory:

sudo cp ./gdb/gdb /Developer/NVIDIA/CUDA-10.1/bin/cuda-gdb

From there Nsight will be able to resolve the cuda-gdb binary required to do remote debugging:

Process /home/<yours_truly>/cuda-workspace/simpleCUBLAS/Debug/simpleCUBLAS created; pid = 4376
Listening on port 2345
Remote debugging from host 192.168.0.3
GPU Device 0: "GeForce GTX 1060 6GB" with compute capability 6.1

simpleCUBLAS test running..
simpleCUBLAS test passed.

Child exited with status 0
logout

Interesting… not seeing any of Mr linus.bjerstedt.blom comments any longer… oh NVIDIA…

Someone from NVIDIA needs to address this at some point. As it seems customers are being censored and left in the dark as to what is going on here. It is not the way “open-source” things work and extremely disrespectful to customers that use NVIDIA things. There is always another path with or without these things. Cheers.