# Code that uses MPI.jl does not run on cluster

**URL:** <https://discourse.julialang.org/t/code-that-uses-mpi-jl-does-not-run-on-cluster/118167>\
**Category:** Julia at Scale\
**Tags:** mpi\
**Created:** [August 14, 2024, 8:50am UTC](https://discourse.julialang.org/t/code-that-uses-mpi-jl-does-not-run-on-cluster/118167 "2024-08-14T08:50:54Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [August 15, 2024, 1:11pm UTC](https://discourse.julialang.org/t/code-that-uses-mpi-jl-does-not-run-on-cluster/118167/21 "2024-08-15T13:11:54Z")

</div>

Please do something. Look up hello\_world MPI and copy a simple MPI program in C into your home directory.  
mpicc -o hello hello.c

Ask your system admin where to find the mpicc for the system MPI  
If it is seriously in /usr/bin then I suspect they are using the CentOS distribution package of OpenMPI

I am despairing here - looks like this is out of support CentOS 7 with an old GCC version  
I may be wrong on all counts here, as I dont know the system

rpm -q --whatprovides /usr/bin/mpiexec will tell you the repository which provided it - assuming it isnot compiled from source

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [August 15, 2024, 1:16pm UTC](https://discourse.julialang.org/t/code-that-uses-mpi-jl-does-not-run-on-cluster/118167/22 "2024-08-15T13:16:38Z")

</div>

mpicc-o hello hello.c

salloc -N 2 --ntasks-per-node=1

mpirun hello

---

<div class="post-metadata">

**Author:** ![Uranium238](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/uranium238/32/209706_2.png) [@Uranium238](https://discourse.julialang.org/u/Uranium238)\
**Post date:** [August 16, 2024, 8:15am UTC](https://discourse.julialang.org/t/code-that-uses-mpi-jl-does-not-run-on-cluster/118167/23 "2024-08-16T08:15:03Z")

</div>

> [@johnh](#):
>
> rpm -q --whatprovides /usr/bin/mpiexec will tell you the repository which provided it - assuming it isnot compiled from source

Here is the corresponding output

```julia
[swapanc.uc@login03 anik]$ rpm -q --whatprovides /usr/bin/mpiexec 
slurm-torque-22.05.9-1.el7.x86_64

```

> [@johnh](#):
>
> Ask your system admin where to find the mpicc for the system MPI  
> If it is seriously in /usr/bin then I suspect they are using the CentOS distribution package of OpenMPI

And doing a `whereis mpicc` yields

```julia
[swapanc.uc@login03 mpi_tests]$ whereis mpicc
mpicc: /home/swapanc.uc/software/openmpi-4.1.1/bin/mpicc

```

> [@johnh](#):
>
> mpicc-o hello hello.c
> 
> salloc -N 2 --ntasks-per-node=1
> 
> mpirun hello

I have gotten a simple Hello World MPI C program from the internet, however I am not sure if I am allowed to run these commands. We are only allowed to submit jobs using the [scripts provided](http://www.hpc.iitkgp.ac.in/HPCF/appscrpitexamples).

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [August 18, 2024, 8:24am UTC](https://discourse.julialang.org/t/code-that-uses-mpi-jl-does-not-run-on-cluster/118167/24 "2024-08-18T08:24:43Z")

</div>

### Application Script **Examples**

There is an example MPI-CPU Script  
Cut and paste that script into your home drive. Use it as an **example.**

You then use ‘sbatch mpi-cpu-script.sh’

#list of modules you want to use, for example  
I would advise emailing the cluster administrators and asking what the modules available are

---

<div class="post-metadata">

**Author:** ![Uranium238](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/uranium238/32/209706_2.png) [@Uranium238](https://discourse.julialang.org/u/Uranium238)\
**Post date:** [August 26, 2024, 3:04pm UTC](https://discourse.julialang.org/t/code-that-uses-mpi-jl-does-not-run-on-cluster/118167/25 "2024-08-26T15:04:14Z")

</div>

> [@johnh](#):
>
> I would advise emailing the cluster administrators and asking what the modules available are

My apologies for the extended silence. I have done the same, as of now it does look like an issue specific to the cluster configuration. I will open up a new thread when some more light is shed upon this issue.

[Previous page](https://discourse.julialang.org/t/code-that-uses-mpi-jl-does-not-run-on-cluster/118167.md?page=1)
