On Apr 10, 2006, at 10:07 AM, François-Xavier Payet wrote:
>> As far as I know, MPI does not officially give you this service
>> since MPI
>> standard deliberately interpose a deep abstraction layer between
>> the application
>> and the hardware it is running on. Said that, if you really need
>> this host list,
>> you can do some tricks like launching "lamnodes" command and
>> capturing the
>> output, using some environmental variables from your batch
>> scheduler which may
>> contain this information (both non portable), or, probably the most
>> portable
>> way, using the gethostname system call on every MPI process and
>> collect the
>> values with a proper MPI statement.
>> Hope it helps, Davide
>>
>
> I was thinking about this last solution, but my MPI processes aren't
> working on every nodes (I often boot MPI on 200+ processors and
> launch 64 processes). I need the name of the different hosts to
> dynamically launch processes on the free nodes. Anyway on the worst
> case I would give the bhost file as a parameter for my app.
Sorry about the slow reply - I'm a little behind due to a recent
developers tutorial on Open MPI.
The first thing to mention is that there is no portable way (across
MPI implementations) to get the information you are looking for. In
LAM, the easiest solution is probably to popen() the lamnodes command
and parse the resulting output. If that isn't appealing, there is a
fairly straight-forward API to get the information you are looking
for without the issues of popen(). You'll have to configure LAM with
--with-devel-headers to build your application, and include a bunch
of LAM-specific code. If this is of any interest to you, have a look
at the source code in <top lam dir>/otb/lamnodes/lamnodes.c.
Hope this helps,
Brian
--
Brian Barrett
LAM/MPI developer and all around nice guy
Have a LAM/MPI day: http://www.lam-mpi.org/
|