如何在MPI作业中的计算节点上设置环境变量 [英] How to set environment variables on compute nodes in an MPI job

查看:51
本文介绍了如何在MPI作业中的计算节点上设置环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不了解在调度程序下使用MPI运行时如何在计算节点上设置环境.

I don't understand how the environment is set on compute nodes when running with MPI under a scheduler.

我这样做:

mpirun -np 1 --hostfile ./hostfile foo.sh

foo.sh :

#!/usr/bin/env zsh                                                                                                  
echo $LD_LIBRARY_PATH

然后我不恢复在交互式shell中获得的LD_LIBRARY_PATH ...与MPI连接时执行/获取的初始化文件是什么?

Then I do not recover the LD_LIBRARY_PATH I have got in an interactive shell... What are the initialization files that are executed/sourced at connection with MPI?

注意:我在zsh下,我试图将内容放在.zprofile或.zshenv中,而不是.zshrc中,但似乎没有改变...我的LD_LIBRARY_PATH设置在.profile中.由.zshrc来源的.bashrc来源.

note: I am under zsh, and I tried to put things in .zprofile or .zshenv instead of .zshrc, but it doesn't seem to make a change... My LD_LIBRARY_PATH is set in a .profile which is sourced by a .bashrc which is sourced by the .zshrc.

推荐答案

某些MPI实现为此为此mpirun设置了 -x 标志,例如 OpenMPI :

Some MPI implementations have an -x flag for mpirun for this, e.g. OpenMPI:

-x< env>

-x <env>

在执行程序之前,将指定的环境变量导出到远程节点.每个-x选项只能指定一个环境变量.可以指定现有的环境变量,也可以使用相应的值指定新的变量名称.例如:

Export the specified environment variables to the remote nodes before executing the program. Only one environment variable can be specified per -x option. Existing environment variables can be specified or new variable names specified with corresponding values. For example:

%mpirun -x显示-x OFILE =/tmp/out ...

% mpirun -x DISPLAY -x OFILE=/tmp/out ...

-x选项的解析器不是很复杂.它甚至不理解引用的值.建议用户在环境中设置变量,然后使用-x导出(而不是定义)它们.

The parser for the -x option is not very sophisticated; it does not even understand quoted values. Users are advised to set variables in the environment, and then use -x to export (not define) them.

如果没有,则必须在作业脚本中明确设置环境变量,例如

If your's does not, you'll have to explicitly set the environment variables in your job script, e.g.

export LD_LIBRARY_PATH=...

这篇关于如何在MPI作业中的计算节点上设置环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆