mardi 3 avril 2018

How to debug cuda program with multiple threads?

My question seems a continuation to this one. I want to debug a app that uses cuda. When I start it in gdb I get 7 threads created before I hit the main(), same as in the linked question. But then when I step over I keep repeating the same lines multiple times, like if each thread was running an app and I was jumping from one thread to another. See execution:

$ gdb ./ElasticFusion 
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
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-linux-gnu".
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"...
Reading symbols from ./ElasticFusion...done.
(gdb) start
Temporary breakpoint 1 at 0x418540: file /home/martin/develop/thirdparty/drl_elasticfusionpublic/GUI/src/Main.cpp, line 22.
Starting program: /home/martin/develop/thirdparty/drl_elasticfusionpublic/GUI/build/ElasticFusion 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffe078c700 (LWP 3527)]
[New Thread 0x7fffdff8b700 (LWP 3528)]
[New Thread 0x7fffdd78a700 (LWP 3529)]
[New Thread 0x7fffdaf89700 (LWP 3530)]
[New Thread 0x7fffd6788700 (LWP 3531)]
[New Thread 0x7fffd3f87700 (LWP 3532)]
[New Thread 0x7fffd1786700 (LWP 3533)]

Thread 1 "ElasticFusion" hit Temporary breakpoint 1, main (argc=1, argv=0x7fffffffdbb8)
    at /home/martin/develop/thirdparty/drl_elasticfusionpublic/GUI/src/Main.cpp:22
22  {
(gdb) n
23      MainController mainController(argc, argv);
(gdb) n
22  {
(gdb) n
23      MainController mainController(argc, argv);
(gdb) n
22  {
(gdb) n
23      MainController mainController(argc, argv);
(gdb) n
Creating live capture... [New Thread 0x7fffce85c700 (LWP 3535)]

Why do I get the same line repeated? is the main() being executed in multiple threads?? the app hasn't spawned any threads yet that I can see. How do I debug this?

Aucun commentaire:

Enregistrer un commentaire