# Troubles on getting started with MPI

**URL:** https://fortran-lang.discourse.group/t/troubles-on-getting-started-with-mpi/4329
**Category:** Help
**Created:** [September 15, 2022, 8:19pm UTC](https://fortran-lang.discourse.group/t/troubles-on-getting-started-with-mpi/4329 "2022-09-15T20:19:02Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jorvz](https://avatars.discourse-cdn.com/v4/letter/j/8edcca/32.png) [@jorvz](https://fortran-lang.discourse.group/u/jorvz)
#### Post date: [September 15, 2022, 8:19pm UTC](https://fortran-lang.discourse.group/t/troubles-on-getting-started-with-mpi/4329/1 "2022-09-15T20:19:02Z")

</div>

Hey! I’ve been trying to start on parallel programming with MPI and when i try to compile using mpifort i get the message “line 376: x86\_64-conda\_cos6-linux-gnu-gfortran: command not found”. I’m just starting and trying to compile a pretty simple code:

```auto
program main
    implicit none

    !call mpi_f08
    include 'mpif.h'
    integer :: ierr, my_rank, nprocs

    call mpi_init(ierr)
    call mpi_comm_rank(mpi_comm_world, my_rank, ierr)
    call mpi_comm_size(mpi_comm_world, nprocs, ierr)

    write(*,*) 'Hello world from processor', my_rank, 'out of', nprocs

    call mpi_finalize(ierr)
    stop
end program main

```

Might be the way i installed it, i just used `sudo apt-get install openmpi-bin` and did nothing more. I have a ubuntu system if that helps. Thanks!

---

<div class="post-metadata">

### Author: ![pcosta](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/pcosta/32/5504_2.png) [@pcosta](https://fortran-lang.discourse.group/u/pcosta)
#### Post date: [September 15, 2022, 8:38pm UTC](https://fortran-lang.discourse.group/t/troubles-on-getting-started-with-mpi/4329/2 "2022-09-15T20:38:05Z")

</div>

Hi @jorvz , strange output, hopefully someone here can help.

When you manage to compile it, you will see that you have an easy syntax error to fix in your `write` statement. Also, it is [recommended](https://www.mpi-forum.org/docs/mpi-3.1/mpi31-report/node409.htm) to replace the `include mpif.h` with `use mpi_f08` (before implicit none). Unfortunately I had issues with the `mpi_f08` module (Cray MPICH does not seem to support it as far as I know, and I also had issues with it when trying to profile with ARM MAP on a certain machine, in which case it may be good to just to use the `mpi` module (`use mpi`). There is also no need for the `stop` at the end of the program.

---

<div class="post-metadata">

### Author: ![han190](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/han190/32/7158_2.png) [@han190](https://fortran-lang.discourse.group/u/han190)
#### Post date: [September 15, 2022, 9:49pm UTC](https://fortran-lang.discourse.group/t/troubles-on-getting-started-with-mpi/4329/3 "2022-09-15T21:49:39Z")

</div>

Your `mpifort` is looking for `gfortran` which I guess is a softlink to `x86_64-conda_cos6-linux-gnu-gfortran` (conda version of gfortran). Are you using Conda? If you do, I suggest installing everything through `conda-forge`. Not only will you find `gfortran`, `mpich`/`openmpi`, but also popular tools/libs like `fpm`, `stdlib`, `fortls`, etc. To install `gfortran` :

```auto
conda install -c conda-forge gfortran

```
