# Question about openmp

**URL:** <https://pyfr.discourse.group/t/question-about-openmp/564>\
**Category:** General\
**Created:** [1 March 2022 14:54 UTC](https://pyfr.discourse.group/t/question-about-openmp/564 "2022-03-01T14:54:09Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jian](https://avatars.discourse-cdn.com/v4/letter/j/7ba0ec/32.png) [@jian](https://pyfr.discourse.group/u/jian)\
**Post date:** [1 March 2022 14:54 UTC](https://pyfr.discourse.group/t/question-about-openmp/564/1 "2022-03-01T14:54:10Z")

</div>

Hello everyone.

When I run openmp with “mpiexec -n 2 pyfr run -b openmp -p circle61.pyfrm circle.ini”, it takes about 10hours. But when I use “mpiexec -n 8 pyfr run -b openmp -p circle61.pyfrm circle.ini”, or “mpiexec -n 16 pyfr run -b openmp -p circle61.pyfrm circle.ini” it takes about 403 hours or more.

The platform is the virtual machine with 8\*2 threads.

What’s the reason and how can I use openmp?

 ![OIAZTO5EJ0}7}9YJULJI{1](https://global.discourse-cdn.com/free1/uploads/pyfr/original/1X/a07ea0ec140be51362150650f477a767c8c8eae9.png)  
 ![%YVK`QW8S~T%9NJ42@LBQK4](https://global.discourse-cdn.com/free1/uploads/pyfr/original/1X/610dcdb14bfff1f49319a6afd2ac1c6ebc51017f.png)

Best regards

---

<div class="post-metadata">

**Author:** ![WillT](https://avatars.discourse-cdn.com/v4/letter/w/bc79bd/32.png) [@WillT](https://pyfr.discourse.group/u/WillT)\
**Post date:** [1 March 2022 15:36 UTC](https://pyfr.discourse.group/t/question-about-openmp/564/2 "2022-03-01T15:36:48Z")

</div>

How big is the case you’re using?

---

<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:** [1 March 2022 15:39 UTC](https://pyfr.discourse.group/t/question-about-openmp/564/3 "2022-03-01T15:39:10Z")

</div>

The issue is that when you run with 8 or 16 ranks each of those ranks will try and launch 16 threads which creates massive over-subscription. Please consult the documentation for your MPI library for how to properly run hybrid applications.

I also note that this is clearly described in the performance tuning section of the PyFR documentation.

Regards, Freddie.

---

<div class="post-metadata">

**Author:** ![jian](https://avatars.discourse-cdn.com/v4/letter/j/7ba0ec/32.png) [@jian](https://pyfr.discourse.group/u/jian)\
**Post date:** [2 March 2022 15:14 UTC](https://pyfr.discourse.group/t/question-about-openmp/564/4 "2022-03-02T15:14:24Z")

</div>

No matter how big the case is, the result is the same.

---

<div class="post-metadata">

**Author:** ![WillT](https://avatars.discourse-cdn.com/v4/letter/w/bc79bd/32.png) [@WillT](https://pyfr.discourse.group/u/WillT)\
**Post date:** [2 March 2022 15:54 UTC](https://pyfr.discourse.group/t/question-about-openmp/564/5 "2022-03-02T15:54:45Z")

</div>

Sure, I think you should consider Freddie’s point, I think that’s the issue.

---

<div class="post-metadata">

**Author:** ![jian](https://avatars.discourse-cdn.com/v4/letter/j/7ba0ec/32.png) [@jian](https://pyfr.discourse.group/u/jian)\
**Post date:** [12 March 2022 15:02 UTC](https://pyfr.discourse.group/t/question-about-openmp/564/6 "2022-03-12T15:02:02Z")

</div>

yeah, “on a two socket system it is suggested to run PyFR with two MPI ranks, with each process being bound to a single socket” in the performance tuning section of the PyFR documentation. But my computer only has one socket, could you give me more details about solving this problem?

And in the .ini file, is it set up like this?  
 ![1647097304(1)](https://global.discourse-cdn.com/free1/uploads/pyfr/original/1X/00d948dc09dd77a1b589c0b48866f62ad52715c1.png)

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:** [12 March 2022 15:17 UTC](https://pyfr.discourse.group/t/question-about-openmp/564/7 "2022-03-12T15:17:50Z")

</div>

If your system does indeed only have a single socket then you should not be using `mpiexec` to launch it. Just run `pyfr ...` bare. You can use the `OMP_NUM_THREADS` environment variable to change how many cores are used.

The `.ini` file options you showed are not part of the current version of PyFR; please see the documentation for the OpenMP backend.

Regards, Freddie.

---

<div class="post-metadata">

**Author:** ![jian](https://avatars.discourse-cdn.com/v4/letter/j/7ba0ec/32.png) [@jian](https://pyfr.discourse.group/u/jian)\
**Post date:** [13 March 2022 04:44 UTC](https://pyfr.discourse.group/t/question-about-openmp/564/8 "2022-03-13T04:44:26Z")

</div>

Okey, thanks a lot.

Best regards
