# The MPI\_Comm\_f2c() function was called before MPI\_INIT was invoked

**URL:** <https://forum.cmascenter.org/t/the-mpi-comm-f2c-function-was-called-before-mpi-init-was-invoked/3157>\
**Category:** CMAQ\
**Created:** [April 1, 2022, 7:59am UTC](https://forum.cmascenter.org/t/the-mpi-comm-f2c-function-was-called-before-mpi-init-was-invoked/3157 "2022-04-01T07:59:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![farzaneh](https://avatars.discourse-cdn.com/v4/letter/f/67e7ee/32.png) [@farzaneh](https://forum.cmascenter.org/u/farzaneh)\
**Post date:** [April 1, 2022, 7:59am UTC](https://forum.cmascenter.org/t/the-mpi-comm-f2c-function-was-called-before-mpi-init-was-invoked/3157/1 "2022-04-01T07:59:34Z")

</div>

Hi,  
I am trying to run the benchmarks . I went step by step of tutorials and after running run\_cctm\_Bench\_2016\_12SE1.csh I got this error:

\*\*\* The MPI\_Comm\_f2c() function was called before MPI\_INIT was invoked.  
\*\*\* This is disallowed by the MPI standard.  
\*\*\* Your MPI job will now abort.  
Local abort before MPI\_INIT completed completed successfully, but am not able to aggregate error messages, and not able to guarantee that all other processes were killed!

---

<div class="post-metadata">

**Author:** ![wong.david-c](https://avatars.discourse-cdn.com/v4/letter/w/bcef8e/32.png) [@wong.david-c](https://forum.cmascenter.org/u/wong.david-c)\
**Post date:** [April 7, 2022, 1:58pm UTC](https://forum.cmascenter.org/t/the-mpi-comm-f2c-function-was-called-before-mpi-init-was-invoked/3157/2 "2022-04-07T13:58:06Z")

</div>

Hi Farzaneh,

```
I wonder what version of OpenMPI you are using. If it is an older version, I suggest to switch to a newer version. Also make sure you are using the same OpenMPI for referencing mpif.h and in the linking step (you might have multiple copies floating around and you were using them at the same time). One more thing your can try is there is a C program (the only C program within CMAQ), distr_env.c, try not to compile with it (modify your Makefile). If you have additional question, please let me know.

```

Cheers,  
David

---

<div class="post-metadata">

**Author:** ![farzaneh](https://avatars.discourse-cdn.com/v4/letter/f/67e7ee/32.png) [@farzaneh](https://forum.cmascenter.org/u/farzaneh)\
**Post date:** [April 10, 2022, 5:42pm UTC](https://forum.cmascenter.org/t/the-mpi-comm-f2c-function-was-called-before-mpi-init-was-invoked/3157/3 "2022-04-10T17:42:51Z")

</div>

Hi David  
Thank you for answering.  
In which makefile I can find this C program in CMAQ?

---

<div class="post-metadata">

**Author:** ![wong.david-c](https://avatars.discourse-cdn.com/v4/letter/w/bcef8e/32.png) [@wong.david-c](https://forum.cmascenter.org/u/wong.david-c)\
**Post date:** [April 11, 2022, 12:27pm UTC](https://forum.cmascenter.org/t/the-mpi-comm-f2c-function-was-called-before-mpi-init-was-invoked/3157/4 "2022-04-11T12:27:28Z")

</div>

Hi Farzaneh,

```
 Running stand alone CMAQ or WRF-CMAQ, please check Makefile or Makefile.twoway, respectively.

```

Cheers,  
David
