MPI programming: running external program on same processor (Fortran, mpiexec)
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
MPI programming: running external program on same processor (Fortran, mpiexec)
Hello,
The situation is that I have an MPI-parallel fortran program. I run it and it's distributed on N processors, and each of these processes must call an external program.
This external program is also an MPI program, however I want to run it in serial, on the processor that is calling it, as if it were part of the fortran program. The fortran program waits until the external program has completed, and then continues.
The problem is that this external program seems to run on any processor, and not necessarily the (now idle) processor that called it.
Can anyone tell me how I can call the program and ensure it runs only on this processor?
Thanks!
---
Extra information that might be helpful:
If I simply run the external program from the command line (ie, type "/path/myprogram.ex <enter>"), it runs fine. If I run it within the fortran program by calling it via
CALL SYSTEM("/path/myprogram.ex")
it doesn't run at all (doesn't even start) and everything crashes. I don't know why this is.
If I call it using mpiexec:
CALL SYSTEM("mpiexec -n 1 /path/myprogram.ex")
then it does work, but I get the problem that it can go on any node.
Yes, thank you!
It led me, in an indirect way, to the answer.
Using SGE and MVAPICH2, the open-mpi-specified paffinity option that you linked to doesn't seem to exist, however a slight variation on this does, using the "-env MV2_CPU_MAPPING 0:1....." option in mpiexec.
So when calling the external program with mpiexec, I map the called process to the current core rank, and it seems to stay distributed and separated as I want.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.