# Need help with parallel debugging

**URL:** <https://pyfr.discourse.group/t/need-help-with-parallel-debugging/287>\
**Category:** General\
**Created:** [3 July 2020 15:01 UTC](https://pyfr.discourse.group/t/need-help-with-parallel-debugging/287 "2020-07-03T15:01:47Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kiny\_Wan](https://avatars.discourse-cdn.com/v4/letter/k/c57346/32.png) [@Kiny\_Wan](https://pyfr.discourse.group/u/Kiny_Wan)\
**Post date:** [3 July 2020 15:01 UTC](https://pyfr.discourse.group/t/need-help-with-parallel-debugging/287/1 "2020-07-03T15:01:47Z")

</div>

Dear all,  
Recently, I have many questions about PyFR since I try to read and understand the context of codes. The structure and idea of PyFR is attractive, but difficulities remain exist. I successfully achieve serial debugging with pycharm in ubuntu16, but unfortunately I am failed to debug the code with MPI. The debugging of cuda and opencl might be more difficult. I hope you can provide some experiences in detail about how to **parallel debugging** during studying or developing the PyFR? To my best knowledge, the available tools for C++/fortran parallel debugging is totalview and ddt.  
In my opinion, PyFR has great potential and can be combined with artificial intelligence and future quantum computing. So I hope to learn from and later contribute to this open source.

Regards,  
Kiny

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [3 July 2020 15:26 UTC](https://pyfr.discourse.group/t/need-help-with-parallel-debugging/287/2 "2020-07-03T15:26:05Z")

</div>

PyFR was developed entirely (both in serial and parallel) without the use of any debuggers. In general it is much easier to get it right the first time than faff around with a debugger; this is especially true when one is dealing with GPUs, multiple threads, or anything to do with MPI.

Regards, Freddie.

---

<div class="post-metadata">

**Author:** ![Kiny\_Wan](https://avatars.discourse-cdn.com/v4/letter/k/c57346/32.png) [@Kiny\_Wan](https://pyfr.discourse.group/u/Kiny_Wan)\
**Post date:** [4 July 2020 00:48 UTC](https://pyfr.discourse.group/t/need-help-with-parallel-debugging/287/3 "2020-07-04T00:48:27Z")

</div>

Thank you, Freddie. I will study the code structure with serial debugging and follow your way to learn from the rest.

---

<div class="post-metadata">

**Author:** ![fei](https://avatars.discourse-cdn.com/v4/letter/f/59ef9b/32.png) [@fei](https://pyfr.discourse.group/u/fei)\
**Post date:** [4 June 2022 07:35 UTC](https://pyfr.discourse.group/t/need-help-with-parallel-debugging/287/4 "2022-06-04T07:35:19Z")

</div>

Hello, I want to study the structure of PyFR, but how to achieve serial debugging with pycharm? I copy one case in the pyfr file. Coul you tell me how to do it?

Thanks

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [4 June 2022 13:02 UTC](https://pyfr.discourse.group/t/need-help-with-parallel-debugging/287/5 "2022-06-04T13:02:38Z")

</div>

Debugging should not be any different to debugging any other Python application.

Regards, Freddie.

---

<div class="post-metadata">

**Author:** ![fei](https://avatars.discourse-cdn.com/v4/letter/f/59ef9b/32.png) [@fei](https://pyfr.discourse.group/u/fei)\
**Post date:** [4 June 2022 13:54 UTC](https://pyfr.discourse.group/t/need-help-with-parallel-debugging/287/6 "2022-06-04T13:54:41Z")

</div>

Yes, I run the program, and the error:  
File “/home/ENV3/lib/python3.8/site-packages/pyfr/ **main**.py”, line 8, in   
import mpi4py.rc  
ModuleNotFoundError: No module named ‘mpi4py’

Do you know what happened?

Thanks

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [4 June 2022 14:06 UTC](https://pyfr.discourse.group/t/need-help-with-parallel-debugging/287/7 "2022-06-04T14:06:15Z")

</div>

As noted in the install guide PyFR requires `mpi4py`. Please install this module through the usual channel (site packages, virtual environment, system package manager, …).

Regards, Freddie.

---

<div class="post-metadata">

**Author:** ![fei](https://avatars.discourse-cdn.com/v4/letter/f/59ef9b/32.png) [@fei](https://pyfr.discourse.group/u/fei)\
**Post date:** [4 June 2022 15:09 UTC](https://pyfr.discourse.group/t/need-help-with-parallel-debugging/287/8 "2022-06-04T15:09:20Z")

</div>

Thanks. I click the ‘run’/ ‘debug’ buttom, the error is as follows. And I run in Terminal, it works.

Traceback (most recent call last):  
File “/home/ENV3/lib/python3.8/site-packages/pyfr/ **main**.py”, line 11, in   
from pyfr.backends import BaseBackend, get\_backend  
ModuleNotFoundError: No module named ‘pyfr’

 ![24`P%I1FKXY7U7G)TJHZS](https://global.discourse-cdn.com/free1/uploads/pyfr/original/1X/b5230cbc3e17415812f63ee6d0db7563912a42b7.png)

Shoul I take other steps?

Best regards

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [4 June 2022 15:18 UTC](https://pyfr.discourse.group/t/need-help-with-parallel-debugging/287/9 "2022-06-04T15:18:58Z")

</div>

This appears to be a PyCharm configuration issue rather than a PyFR issue. You will need to see how to set up import paths and the such like in PyCharm.

Regards, Freddie.

---

<div class="post-metadata">

**Author:** ![fei](https://avatars.discourse-cdn.com/v4/letter/f/59ef9b/32.png) [@fei](https://pyfr.discourse.group/u/fei)\
**Post date:** [5 June 2022 15:10 UTC](https://pyfr.discourse.group/t/need-help-with-parallel-debugging/287/10 "2022-06-05T15:10:36Z")

</div>

I change the import parth, but when I debug, the program breaks and the following occurs:

usage: pyfr [-h] [–verbose] {import,partition, export,run,restart} …

positional arguments:  
{import,partition,export,run,restart}  
sub-command help  
import import --help  
partition partition --help  
export export --help  
run run --help  
restart restart --help

optional arguments:  
-h, --help show this help message and exit  
–verbose, -v

Process finished with exit code 0

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [5 June 2022 21:39 UTC](https://pyfr.discourse.group/t/need-help-with-parallel-debugging/287/11 "2022-06-05T21:39:10Z")

</div>

This is consistent with running PyFR without any command line arguments. Your debugger should allow you to specify what arguments you want to provide to the program.

Regards, Freddie.

---

<div class="post-metadata">

**Author:** ![fei](https://avatars.discourse-cdn.com/v4/letter/f/59ef9b/32.png) [@fei](https://pyfr.discourse.group/u/fei)\
**Post date:** [6 June 2022 06:15 UTC](https://pyfr.discourse.group/t/need-help-with-parallel-debugging/287/12 "2022-06-06T06:15:34Z")

</div>

OK，thanks.

I tried again. And I can only step into **main** function, but the **process\_import** , **process\_run** …function can not be stepped into. Can’t PyFR go into **process\_import** , **process\_run** … functions to debug?

Best regards

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [6 June 2022 12:02 UTC](https://pyfr.discourse.group/t/need-help-with-parallel-debugging/287/13 "2022-06-06T12:02:28Z")

</div>

Which functions PyFR will go into depends on the arguments it is passed. If you execute (or debug) PyFR without any command line arguments it will simply print the help text and exit. To get it to go into process\_import you will need to run PyFR as `pyfr import a_mesh.msh a_file.pyfrm`.

Regards, Freddie.
