Discussion:
Running without mpirun
(too old to reply)
Philipp Kraus
2009-06-12 13:59:58 UTC
Permalink
Hi,

thanks for helping with my last question.
I write some codes with MPI and Boost.
Can I run my executable directly without calling
mpirun. I have 8 Core on one physical machine
and on startup the programm should detect the
physical cores and uses all.

I can write a shell script, okay, but this isn't what
I want

Phil
Michael Hofmann
2009-06-15 07:07:59 UTC
Permalink
Am 12.06.2009, 15:59 Uhr, schrieb Philipp Kraus
Post by Philipp Kraus
Hi,
thanks for helping with my last question.
I write some codes with MPI and Boost.
Can I run my executable directly without calling
mpirun. I have 8 Core on one physical machine
and on startup the programm should detect the
physical cores and uses all.
You have to use the startup mechanism provided by your MPI implementation!
Usually, this is a startup command like mpirun or mpiexec.

After an MPI application has started, you can (try to) start additional
processes (see http://www.mpi-forum.org/docs/mpi21-report-bw/node195.htm).
However, this may be overkill (for your problem).

With OpenMPI, you can use a hostfile to specify the number of "slots" per
node. mpirun starts a process for every slot, if no value for the number
of processes is specified (with "-np"). However, this requires you to
write the hostfile.
Post by Philipp Kraus
I can write a shell script, okay, but this isn't what
I want
This seems to be the easiest way.


Michael
Philipp Kraus
2009-06-15 11:26:08 UTC
Permalink
On 2009-06-15 09:07:59 +0200, "Michael Hofmann"
Post by Michael Hofmann
Post by Philipp Kraus
Hi,
thanks for helping with my last question.
I write some codes with MPI and Boost.
Can I run my executable directly without calling
mpirun. I have 8 Core on one physical machine
and on startup the programm should detect the
physical cores and uses all.
You have to use the startup mechanism provided by your MPI
implementation! Usually, this is a startup command like mpirun or
mpiexec.
After an MPI application has started, you can (try to) start additional
processes (see
http://www.mpi-forum.org/docs/mpi21-report-bw/node195.htm). However,
this may be overkill (for your problem).
Thanks fpr the link, that can be a solution for another probler :-P
Post by Michael Hofmann
With OpenMPI, you can use a hostfile to specify the number of "slots"
per node. mpirun starts a process for every slot, if no value for the
number of processes is specified (with "-np"). However, this requires
you to write the hostfile.
I know, actually I use this option
Post by Michael Hofmann
Post by Philipp Kraus
I can write a shell script, okay, but this isn't what
I want
This seems to be the easiest way.
But there is the Problem, to count the cores in the machine.

I need a mechanism to get the count of cores on the physical machine to
run mpirun -np <core count> <program>.
At the moment I would like to solve it inside my program, like this:
startup program, detect cores count, creates processes to all cores

Thanks

Phil
Michael Hofmann
2009-06-15 13:19:13 UTC
Permalink
Am 15.06.2009, 13:26 Uhr, schrieb Philipp Kraus
Post by Philipp Kraus
Post by Michael Hofmann
This seems to be the easiest way.
But there is the Problem, to count the cores in the machine.
I need a mechanism to get the count of cores on the physical machine to
run mpirun -np <core count> <program>.
mpirun -np `cat /proc/cpuinfo | grep -E "^processor" | wc -l` <program>


Michael
Philipp Kraus
2009-06-15 19:16:48 UTC
Permalink
On 2009-06-15 15:19:13 +0200, "Michael Hofmann"
Post by Michael Hofmann
mpirun -np `cat /proc/cpuinfo | grep -E "^processor" | wc -l` <program>
That is my solution under *nix, but under Windows ?
Okay, see mal next post to compile under Windows

Phil
Michael Hofmann
2009-06-16 07:10:15 UTC
Permalink
Am 15.06.2009, 21:16 Uhr, schrieb Philipp Kraus
Post by Philipp Kraus
On 2009-06-15 15:19:13 +0200, "Michael Hofmann"
Post by Michael Hofmann
mpirun -np `cat /proc/cpuinfo | grep -E "^processor" | wc -l` <program>
That is my solution under *nix, but under Windows ?
AFAIK, there is an environment variable called "NUMBER_OF_PROCESSORS".


Michael
Michael Hofmann
2009-06-15 13:19:13 UTC
Permalink
Am 15.06.2009, 13:26 Uhr, schrieb Philipp Kraus
Post by Philipp Kraus
Post by Michael Hofmann
This seems to be the easiest way.
But there is the Problem, to count the cores in the machine.
I need a mechanism to get the count of cores on the physical machine to
run mpirun -np <core count> <program>.
mpirun -np `cat /proc/cpuinfo | grep -E "^processor" | wc -l` <program>


Michael

Georg Bisseling
2009-06-17 08:12:09 UTC
Permalink
Post by Philipp Kraus
Hi,
thanks for helping with my last question.
I write some codes with MPI and Boost.
Can I run my executable directly without calling
mpirun. I have 8 Core on one physical machine
and on startup the programm should detect the
physical cores and uses all.
I can write a shell script, okay, but this isn't what
I want
Phil
Your plan to hardcode this decision into the binary
might actually be a bad idea at all.
It takes away any user's or administrator's
means to assign a number of cores to your program.

Just one out of many examples: there are machines
so big that your code will not scale to all cores.
--
This signature intentionally left almost blank.
http://www.this-page-intentionally-left-blank.org/
Loading...