Intel® MPI Library
Get help with building, analyzing, optimizing, and scaling high-performance computing (HPC) applications.

How to debug under Intel MPI?

linfa
Beginner
2,058 Views
Hi

How to set a breakpoint on a given rank? In the following example, I would like to set a breakpoint on rank0, but not on rank 1 and rank2. how do I do it? How do I switch between different rank? Thanks.

[linfa@ran testrun]$ mpirun -gdb -np 3 ../exec/intelmpitest
WARNING: Can't read mpd.hosts for list of hosts, start only on current
0-2: (gdb)

Thanks.
0 Kudos
4 Replies
Dmitry_K_Intel2
Employee
2,058 Views
Hi linfa,

Using 'z' command you can switch active processes. For example:
[zzz@serv1002 zzz]$
[zzz@serv1002 zzz]$ mpiexec -gdb -n 4 ./test_debug
0-3: (gdb) z 1-3
1-3: (gdb) b 53
1-3: Breakpoint 2 at 0x4009f3: file test.c, line 53.
1-3: (gdb) z
0-3: (gdb) r
0-3: Continuing.
0: Hello world: rank 0 of 4 running on svlmpicl1002
1-3:
2: Breakpoint 2, main (argc=1, argv=0x7fff2a943e58) at test.c:53
3: Breakpoint 2, main (argc=1, argv=0x7fff70c3ba18) at test.c:53
1: Breakpoint 2, main (argc=1, argv=0x7fff53837d48) at test.c:53
1-3: 53 MPI_Send (&namelen, 1, MPI_INT, 0, 1, MPI_COMM_WORLD);
1-3: (gdb) 1-3: (gdb) list
1-3: 48
1-3: 49 } else {
1-3: 50
1-3: 51 MPI_Send (&rank, 1, MPI_INT, 0, 1, MPI_COMM_WORLD);
1-3: 52 MPI_Send (&size, 1, MPI_INT, 0, 1, MPI_COMM_WORLD);
1-3: 53 MPI_Send (&namelen, 1, MPI_INT, 0, 1, MPI_COMM_WORLD);
1-3: 54 MPI_Send (name, namelen + 1, MPI_CHAR, 0, 1, MPI_COMM_WORLD);
1-3: 55
1-3: 56 }
1-3: 57
1-3: (gdb)

Did you ask about this command?

Regards!
Dmitry

0 Kudos
linfa
Beginner
2,058 Views
Hi Dmitry,

Wow! That is exactly what I want! Thanks very much!





Linfa
0 Kudos
Michael_S_13
Beginner
2,058 Views

How would this be done using eclipse?

0 Kudos
Ben_F_3
Beginner
2,058 Views

I'm afraid this doesn't work for me because the code launches immediately and there is no chance to enter commands, and also CTRL-C doesn't work to halt the program. Any advice on how to get around this?

0 Kudos
Reply