user
user

Reputation: 30

mpirun - Use each node's local env variables instead of master node's

I am trying to run mpirun from the master node. If I do the following:

mpirun -np 2 -hostfile /job/hostfile --map-by node --tag-output -bind-to none hostname

The output looks good, two different hosts:

[1,1]<stdout>:azeuscc9800000I
[1,0]<stdout>:azeuscc9800001H

But when I run:

mpirun -np 2 -hostfile /job/hostfile --map-by node --tag-output -bind-to none echo $HOSTNAME

I get the same host printed twice:

[1,1]<stdout>:azeuscc9800001H
[1,0]<stdout>:azeuscc9800001H

It seems the $HOSTNAME variable (and probably other env variables) gets evaluated before mpirun sends the command to the remote node, which defeats the purpose. I have tried using the '-x' parameter unsuccessfully as well (same output, same master hosts printed):

mpirun -np 2 -hostfile /job/hostfile --map-by node --tag-output -bind-to none -x HOSTNAME=$HOSTNAME echo $HOSTNAME

But from what I understand, this parameter is used to export the master env variable to the other nodes, whereas I want the local env variable assignment on each node to be used in the command for each node.

Does anyone know if I am using the mpirun command incorrectly, or if there is something else that needs to be done to achieve this functionality?

Upvotes: 0

Views: 617

Answers (0)

Related Questions