Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug MPI with CLion?

How to debug mpi program with Clion?
Executable is set mpirun, that's why I can not debug as usual, I think, so how to do it? Thanks

like image 575
Vadim Romansky Avatar asked Jun 18 '16 20:06

Vadim Romansky


1 Answers

As Zulan already mentioned,

  1. Add these lines before your breakpoint and rebuild your application (from OpenMPI)

     int i = 0;
     while(0==i)
        sleep(5);
    
  2. Launch your program from the terminal with mpirun

$mpirun -np 4 ./Application

  1. Attach LLDB or GDB to a local process

Run-> Attach to Process

  1. Pause Program (the program will pause on sleep(5))

  2. Set i!=0 and Resume Program

  3. Happy debugging

You may need to connect to your other processes to set i!=0 and continue debugging.

like image 178
ilciavo Avatar answered Nov 15 '22 09:11

ilciavo