LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-02-2010, 05:22 PM   #1
zugvogel
LQ Newbie
 
Registered: Sep 2005
Location: Tokyo, Japan
Distribution: Mac, Ubuntu, Debian and Centos
Posts: 28

Rep: Reputation: 16
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.
 
Old 03-02-2010, 11:27 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Sounds like "processor affinity":

http://www.open-mpi.org/faq/?categor...uild-paffinity
http://www.open-mpi.org/faq/?categor...paffinity-defs
http://www.open-mpi.org/faq/?categor...sing-paffinity
 
1 members found this post helpful.
Old 03-03-2010, 06:09 AM   #3
zugvogel
LQ Newbie
 
Registered: Sep 2005
Location: Tokyo, Japan
Distribution: Mac, Ubuntu, Debian and Centos
Posts: 28

Original Poster
Rep: Reputation: 16
Thanks!

Hi paulsm4,

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.

Thanks again for the hint!
 
  


Reply

Tags
fortran, mpi



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
issue system call from running fortran program msander Linux - Newbie 1 04-24-2009 07:49 AM
MPI program running on cluster. ArthurHuang Programming 1 09-24-2007 01:20 AM
Compile Error,..MPI for Fortran ArthurHuang Linux - Software 7 09-10-2007 11:16 AM
How to issue system call from running fortran program swerdna Programming 3 12-27-2006 07:44 AM
Running Mandelbrot mpi program given with mpich installation Dinux Linux - Networking 0 08-04-2003 09:27 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration