在交互式qsub环境中使用mpirun激活虚拟环境

时间:2016-02-26 06:34:37

标签: python virtualenv openmpi hpc qsub

我在项目中使用openmdao 0.13 python模块。该模块仅作为virtualenv提供。当我激活虚拟环境时,它似乎只在一个节点上激活。有什么可以解释这种奇怪的行为?为什么非主节点上的处理器无法加载virtualenv?

$ mpirun --version
mpirun (Open MPI) 1.7.3
$ qsub --version
Version: 5.1.1.2
$ qsub -V -I -l nodes=2:ppn=24
$ cd openmdao-0.10.3.2/
$ . bin/activate
$ mpirun -np 24 python -c "import openmdao"
# no errors
$ mpirun -np 27 python -c "import openmdao"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named openmdao
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named openmdao
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named openmdao

看起来我的所有处理器都正确引用了python

$ mpirun -np 27 which python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python
/home/jquick/here_it_is/openmdao-0.10.3.2/bin/python

我不明白可能导致此导入错误的原因。 bin / activate可能会影响我的主节点但节点但不会影响辅助节点?

1 个答案:

答案 0 :(得分:0)

在启动qsub作业之前激活virtualenv为我修复了这个