Is there any way to run mpirun command inside container for multi-host system?

1,593 views
Skip to first unread message

Guohua Li

unread,
Jun 8, 2017, 9:17:30 AM6/8/17
to singularity

For our HPC system, really need run mpirun command inside the container on multi-host. 

How can we fix the issues? 

In my experience, when I build mpi job on multihost, everytime I change the version of MPI inside the container, I have to change the version of MPI on the host. 

Is there any solution for run mpi command inside the container on multi-host system? 




Gregory M. Kurtzer

unread,
Jun 8, 2017, 11:24:49 AM6/8/17
to singu...@lbl.gov
Running a multi-node job from within the container carries many caveats that are difficult to resolve easily. It maybe possible using your resource manager to spin up the contained remote node MPI process daemons (for example ORTE in the case of OMPI), but that would require direct integration with the resource manager.

But with that said, the hybrid mode should work even with different versions. What MPI and versions are you trying to run?

Thanks!

--
You received this message because you are subscribed to the Google Groups "singularity" group.
To unsubscribe from this group and stop receiving emails from it, send an email to singularity+unsubscribe@lbl.gov.



--
--
Gregory M. Kurtzer
CEO, SingularityWare, LLC.
Senior Architect, RStor
Computational Science Advisor, Lawrence Berkeley National Laboratory

Stefan Kombrink

unread,
Jun 10, 2017, 5:07:41 AM6/10/17
to singularity
I've got some experience on running multi node jobs with mpirun inside the containers.
Greg is right that it will be difficult to find an general purpose solution for arbitary HPC systems and software.
I made it work for two heavily used applications on our cluster one of which used IntelMPI and the other OpenMPI 1.6
The main thing was to replace /bin/ssh in order to tweak mpirun to wrap "ssh hostname cmd" to "ssh 'singularity ContainerName exec cmd'
I had to apply some more workarounds to make IB work properly (mainly envvars to configure MPI properly) but essentially the efford was justifiable.

Sorry cant find the link to the ssh wrapper script right now but I can post it later when you are interested in it. It is really just a few lines of bash code.

Stefan

Guohua Li

unread,
Jun 10, 2017, 5:17:04 AM6/10/17
to singu...@lbl.gov
Really thanks for your reply! 

Please post the script when you find it. 

Now I'm testing every MPI version which host installed MPI version can support much MPI versions inside the container! 

Hope your script can solve our problem!


영원히 살 것 처럼 꿈꾸고 내일 죽을 것 처럼 살자!  
This too shall pass away!

※ 이국화 LI GUOHUA
※ 건국대학교 대학원 신기술융합학과 박사과정
 융합 컴퓨팅 연구실 (IC Lab)
※ iIT, Department of Advanced Technology Fusion, Konkuk University
※ Industry-University Cooperation Bldg. 805
※ KonKuk University, Hwayang-dong, Gwangjin-Gu, Seoul 143-701 South Korea
※ Cell Phone: +82) 10-3666-8263

※ E-mail: heavenkong@gmail.com

David Godlove

unread,
Jun 10, 2017, 9:32:40 AM6/10/17
to singu...@lbl.gov
I'd also like to have a look at that script and know more about the env vars you tweaked. Thanks Stefan.

To unsubscribe from this group and stop receiving emails from it, send an email to singularity...@lbl.gov.

Stefan Kombrink

unread,
Jun 12, 2017, 4:38:48 PM6/12/17
to singularity

Here is the wrapper script which replaces ssh: https://pastebin.com/vqXXRzb5


Am Samstag, 10. Juni 2017 11:17:04 UTC+2 schrieb Guohua Li:
Really thanks for your reply! 

Please post the script when you find it. 

Now I'm testing every MPI version which host installed MPI version can support much MPI versions inside the container! 

Hope your script can solve our problem!

영원히 살 것 처럼 꿈꾸고 내일 죽을 것 처럼 살자!  
This too shall pass away!

※ 이국화 LI GUOHUA
※ 건국대학교 대학원 신기술융합학과 박사과정
 융합 컴퓨팅 연구실 (IC Lab)
※ iIT, Department of Advanced Technology Fusion, Konkuk University
※ Industry-University Cooperation Bldg. 805
※ KonKuk University, Hwayang-dong, Gwangjin-Gu, Seoul 143-701 South Korea
※ Cell Phone: +82) 10-3666-8263

※ E-mail: heavenkong...@gmail.com

2017-06-10 18:07 GMT+09:00 'Stefan Kombrink' via singularity <singu...@lbl.gov>:
I've got some experience on running multi node jobs with mpirun inside the containers.
Greg is right that it will be difficult to find an general purpose solution for arbitary HPC systems and software.
I made it work for two heavily used applications on our cluster one of which used IntelMPI and the other OpenMPI 1.6
The main thing was to replace /bin/ssh in order to tweak mpirun to wrap "ssh hostname cmd" to "ssh 'singularity ContainerName exec cmd'
I had to apply some more workarounds to make IB work properly (mainly envvars to configure MPI properly) but essentially the efford was justifiable.

Sorry cant find the link to the ssh wrapper script right now but I can post it later when you are interested in it. It is really just a few lines of bash code.

Stefan


Am Donnerstag, 8. Juni 2017 15:17:30 UTC+2 schrieb Guohua Li:

For our HPC system, really need run mpirun command inside the container on multi-host. 

How can we fix the issues? 

In my experience, when I build mpi job on multihost, everytime I change the version of MPI inside the container, I have to change the version of MPI on the host. 

Is there any solution for run mpi command inside the container on multi-host system? 




--
You received this message because you are subscribed to the Google Groups "singularity" group.
To unsubscribe from this group and stop receiving emails from it, send an email to singularity...@lbl.gov.

Gregory M. Kurtzer

unread,
Jun 13, 2017, 11:38:49 AM6/13/17
to singu...@lbl.gov
Hi Stefan,

This is an interesting idea, and we might be able to easily include this in a container by a bind mount. Would you be willing to submit and maintain this in Singularity itself?

Thanks!

To unsubscribe from this group and stop receiving emails from it, send an email to singularity+unsubscribe@lbl.gov.

Stefan Kombrink

unread,
Jun 14, 2017, 7:50:39 AM6/14/17
to singularity
Hi Greg,

 I thought about it more:
I also had to bind mount /etc/ssh.
There's a caveat I haven't thought about yet: when ssh is wrapped it is possible to break out running containers just by calling

ssh_orig localhost '/tmp/run_this_code.sh'

Then, sudo and all setuid programs are accessible on the host.
In our case it does not really matter, but it is good to have that in mind!

So maybe I'll first write a tutorial. What are your thoughts on this?

Stefan
To unsubscribe from this group and stop receiving emails from it, send an email to singularity...@lbl.gov.

Stefan Kombrink

unread,
Jun 14, 2017, 8:03:52 AM6/14/17
to singularity
And the script works for 2.2.1 only :( - I'll have to see whether I can get the required info to port it to 2.3
SINGULARITY_IMAGE does not exist anymore, is that right?

Stefan Kombrink

unread,
Jun 14, 2017, 8:36:45 AM6/14/17
to singularity
Nope. Still works. I needed to put

SINGULARITYENV_SINGULARITY_IMAGE="$SINGULARITY_IMAGE"
export SINGULARITYENV_SINGULARITY_IMAGE

into /etc/singularity/init

Guohua Li

unread,
Jul 17, 2017, 9:32:36 PM7/17/17
to singu...@lbl.gov
Thank you so much! the wrapper script is working well with small modification! 

Thank you so much! 

영원히 살 것 처럼 꿈꾸고 내일 죽을 것 처럼 살자!  
This too shall pass away!

※ 이국화 LI GUOHUA
※ 건국대학교 대학원 신기술융합학과 박사과정
 융합 컴퓨팅 연구실 (IC Lab)
※ iIT, Department of Advanced Technology Fusion, Konkuk University
※ Industry-University Cooperation Bldg. 805
※ KonKuk University, Hwayang-dong, Gwangjin-Gu, Seoul 143-701 South Korea
※ Cell Phone: +82) 10-3666-8263

※ E-mail: heavenkong@gmail.com

To unsubscribe from this group and stop receiving emails from it, send an email to singularity+unsubscribe@lbl.gov.

Gregory M. Kurtzer

unread,
Jul 28, 2017, 8:06:02 PM7/28/17
to singu...@lbl.gov
We need help with recipes and documentation! Can one of you guys post a PR including how this is done to our website GitHub?

Thanks!

To unsubscribe from this group and stop receiving emails from it, send an email to singularity+unsubscribe@lbl.gov.

vanessa s

unread,
Jul 28, 2017, 10:22:35 PM7/28/17
to singu...@lbl.gov
Or just copy paste into an email here with good description, etc, and I'd be happy to do the docs part.

To unsubscribe from this group and stop receiving emails from it, send an email to singularity...@lbl.gov.



--
Gregory M. Kurtzer
CEO, SingularityWare, LLC.
Senior Architect, RStor
Computational Science Advisor, Lawrence Berkeley National Laboratory

--
You received this message because you are subscribed to the Google Groups "singularity" group.
To unsubscribe from this group and stop receiving emails from it, send an email to singularity+unsubscribe@lbl.gov.



--
Vanessa Villamia Sochat
Stanford University '16

Stefan Kombrink

unread,
Jul 29, 2017, 1:15:25 AM7/29/17
to singularity
Hi Vanessa,

 there's a recipe and you can glance at the code.
Should serve well as starting point for documentation:

https://github.com/katakombi/multinode_sshwrapper

Stefan


Am Samstag, 29. Juli 2017 04:22:35 UTC+2 schrieb vanessa:
Or just copy paste into an email here with good description, etc, and I'd be happy to do the docs part.
On Fri, Jul 28, 2017 at 8:05 PM, Gregory M. Kurtzer <gmku...@gmail.com> wrote:
We need help with recipes and documentation! Can one of you guys post a PR including how this is done to our website GitHub?

Thanks!
On Mon, Jul 17, 2017 at 6:32 PM, Guohua Li <heave...@gmail.com> wrote:
Thank you so much! the wrapper script is working well with small modification! 

Thank you so much! 
영원히 살 것 처럼 꿈꾸고 내일 죽을 것 처럼 살자!  
This too shall pass away!

※ 이국화 LI GUOHUA
※ 건국대학교 대학원 신기술융합학과 박사과정
 융합 컴퓨팅 연구실 (IC Lab)
※ iIT, Department of Advanced Technology Fusion, Konkuk University
※ Industry-University Cooperation Bldg. 805
※ KonKuk University, Hwayang-dong, Gwangjin-Gu, Seoul 143-701 South Korea
※ Cell Phone: +82) 10-3666-8263

※ E-mail: heavenkong...@gmail.com
To unsubscribe from this group and stop receiving emails from it, send an email to singularity...@lbl.gov.

vanessa s

unread,
Jul 29, 2017, 1:21:09 AM7/29/17
to singu...@lbl.gov
ah yes, will do! I know this container well :) Thanks Stefan!

To unsubscribe from this group and stop receiving emails from it, send an email to singularity+unsubscribe@lbl.gov.
Reply all
Reply to author
Forward
0 new messages