Normally MPI will just pick up the host list from Slurm itself.
You just need to build MPI against Slurm and it will just grab it.
Typically this is transparent to the user. Normally you shouldn't
need to pass a host list at all. See:
https://slurm.schedmd.com/mpi_guide.html
The canonical way to do it if you need to would be the scontrol
show hostnames command against the $SLURM_JOB_NODELIST
(https://slurm.schedmd.com/scontrol.html#OPT_hostnames). That will
give you the list of hosts your job is set to run on.
-Paul Edmon-
Thanks! I admit I'm not that experienced in Bash. I will give this a whirl as a test.
In the meantime, let ask, what is the "canonical" way to create the host list? It would be nice to have this in the Slurm FAQ somewhere.
Thanks!
Jeff
On Fri, Aug 9, 2024 at 1:32 PM Hermann Schwärzler via slurm-users <slurm-users@lists.schedmd.com> wrote:
Hi Paul,
On 8/9/24 18:45, Paul Edmon via slurm-users wrote:
> As I recall I think OpenMPI needs a list that has an entry on each line,
> rather than one seperated by a space. See:
>
> [root@holy7c26401 ~]# echo $SLURM_JOB_NODELIST
> holy7c[26401-26405]
> [root@holy7c26401 ~]# scontrol show hostnames $SLURM_JOB_NODELIST
> holy7c26401
> holy7c26402
> holy7c26403
> holy7c26404
> holy7c26405
>
> [root@holy7c26401 ~]# list=$(scontrol show hostname $SLURM_NODELIST)
> [root@holy7c26401 ~]# echo $list
> holy7c26401 holy7c26402 holy7c26403 holy7c26404 holy7c26405
proper quoting does wonders here (please consult the man-page of bash).
If you try
echo "$list"
you will see that you will get
holy7c26401
holy7c26402
holy7c26403
holy7c26404
holy7c26405
So you *can* pass this around in a variable if you use "$variable"
whenever you provide it to a utility.
Regards,
Hermann
--
slurm-users mailing list -- slurm-users@lists.schedmd.com
To unsubscribe send an email to slurm-users-leave@lists.schedmd.com