您好,感谢您的帮助!
我试图让emcee在Slurm群集上使用mpi运行,但是当我启动代码时,它在几分钟后返回一个错误,下面描述了一个大错误,似乎围绕着'Invalid communicator '错误。
您知道我可能在做什么错吗?
我正在使用anaconda,所以我尝试重新安装环境,更改使用的软件包并删除所有不必要的内容,但是错误始终相同。
这是我通过sbatch提交的脚本:
#!/bin/bash
#SBATCH --partition=largemem
#SBATCH --ntasks=40
#SBATCH --ntasks-per-node=40
#SBATCH --mem-per-cpu=4000
#SBATCH --mail-user=(my email)
#SBATCH --mail-type=ALL
#SBATCH --output=results/LastOpti.out
#SBATCH --error=results/LastOpti.err
#SBATCH --job-name=gal
source ~/anaconda3/etc/profile.d/conda.sh
conda activate EmceeMPI
cd ~/GalarioFitting
srun -n $SLURM_NTASKS python3 OptimizationGalarioMPI.py --nwalkers 560 --iterations 3000 --suffix _lasttest
conda deactivate
在我的python代码中,我使用schwimmbad的MPIPool。
错误很大:
Traceback (most recent call last):
File "OptimizationGalarioMPI.py", line 303, in <module>
pos, prob, state = sampler.run_mcmc(pos, iterations, progress=True)
File "/home/mbenisty/anaconda3/envs/EmceeMPI/lib/python3.7/site-packages/emcee-3.0rc2-py3.7.egg/emcee/ensemble.py", line 346, in run_mcmc
File "/home/mbenisty/anaconda3/envs/EmceeMPI/lib/python3.7/site-packages/emcee-3.0rc2-py3.7.egg/emcee/ensemble.py", line 305, in sample
File "/home/mbenisty/anaconda3/envs/EmceeMPI/lib/python3.7/site-packages/emcee-3.0rc2-py3.7.egg/emcee/moves/red_blue.py", line 92, in propose
File "/home/mbenisty/anaconda3/envs/EmceeMPI/lib/python3.7/site-packages/emcee-3.0rc2-py3.7.egg/emcee/ensemble.py", line 389, in compute_log_prob
File "/home/mbenisty/anaconda3/envs/EmceeMPI/lib/python3.7/site-packages/schwimmbad/mpi.py", line 168, in map
status=status)
File "mpi4py/MPI/Comm.pyx", line 1173, in mpi4py.MPI.Comm.recv
File "mpi4py/MPI/msgpickle.pxi", line 302, in mpi4py.MPI.PyMPI_recv
File "mpi4py/MPI/msgpickle.pxi", line 261, in mpi4py.MPI.PyMPI_recv_match
mpi4py.MPI.Exception: Invalid communicator, error stack:
PMPI_Mprobe(120): MPI_Mprobe(source=-2, tag=-1, comm=MPI_COMM_WORLD, message=0x7ffed877b790, status=0x7ffed877b7a0)
PMPI_Mprobe(85).: Invalid communicator
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "OptimizationGalarioMPI.py", line 303, in <module>
pos, prob, state = sampler.run_mcmc(pos, iterations, progress=True)
File "/home/mbenisty/anaconda3/envs/EmceeMPI/lib/python3.7/site-packages/schwimmbad/pool.py", line 46, in __exit__
self.close()
File "/home/mbenisty/anaconda3/envs/EmceeMPI/lib/python3.7/site-packages/schwimmbad/mpi.py", line 188, in close
self.comm.send(None, worker, 0)
File "mpi4py/MPI/Comm.pyx", line 1156, in mpi4py.MPI.Comm.send
File "mpi4py/MPI/msgpickle.pxi", line 174, in mpi4py.MPI.PyMPI_send
答案 0 :(得分:0)
可能是Conda附带的MPI实现不包括Slurm支持。如果是这样,则应尝试使用mpirun
而不是srun
启动程序。但是该错误通常表明MPI的几种实现同时处于活动状态。提交作业时,请确保未加载任何环境模块,并且未安装与MPI相关的OS软件包。