# Will openMP use all the cores when MPI is also enabled?

**URL:** <https://fortran-lang.discourse.group/t/will-openmp-use-all-the-cores-when-mpi-is-also-enabled/4094>\
**Category:** Uncategorized\
**Created:** [July 30, 2022, 8:25pm UTC](https://fortran-lang.discourse.group/t/will-openmp-use-all-the-cores-when-mpi-is-also-enabled/4094 "2022-07-30T20:25:13Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![whuhn](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/whuhn/32/1887_2.png) [@whuhn](https://fortran-lang.discourse.group/u/whuhn)\
**Post date:** [August 1, 2022, 3:01pm UTC](https://fortran-lang.discourse.group/t/will-openmp-use-all-the-cores-when-mpi-is-also-enabled/4094/2 "2022-08-01T15:01:16Z")

</div>

You should read through [Question about hyper-threading](https://fortran-lang.discourse.group/t/question-about-hyper-threading/4053), as it may answer some of your questions.

> [@CRquantum](#):
>
> Say there is code, and the PC has 10 cpu cores

You should always be specific about whether you’re talking about physical or logical cores when talking about parallelization models.

> [@CRquantum](#):
>
> I mean since step 2 is done by the rank0 core from MPI, if I use openMP, can openMP see all the 10 cores from MPI?

MPI and OpenMP don’t “see” cores, at least on the programmer level, they launch tasks and processes. You can easily launch 17 MPI tasks, each with 33 OpenMP threads, on a single (physical) core CPU if you want. The runtimes trust that you’re doing the right thing, and it’s up to you to set the thread affinity properly.

---

_[View the full topic](https://fortran-lang.discourse.group/t/will-openmp-use-all-the-cores-when-mpi-is-also-enabled/4094)._
