次のコードでランク0のノードでmpi4pyを使用してジョブを実行する(配列を作成する)プログラムを作成しました。次に、ランク1のノードに別の配列を作成し、両方の配列をプロットします。ノード0の配列はノード1にブロードキャストされていますが、コードでは奇妙なエラーが発生します。 私は、次のコマンドを使用:0以外のMPIランクでmatplotlibを使用すると、 "QXcbConnection:ディスプレイに接続できませんでした"
mpiexec -n 2 -f mfile python mpi_test_4.py
などのプログラムが行く:エラーメッセージがある
from mpi4py import MPI
import matplotlib.pyplot as plt
import numpy as np
comm = MPI.COMM_WORLD
rank = comm.rank
x = np.linspace(-2*np.pi,2*np.pi,100)
if (rank == 0):
y1 = np.sin(x)
else:
y1 = None
y1 = comm.bcast(y1,root=0)
if (rank == 1):
y2 = np.cos(x)
fig = plt.figure()
ax = fig.gca()
ax.plot(x,y1)
ax.plot(x,y2)
plt.savefig('test.png')
print(rank)
:
0
QXcbConnection: Could not connect to display
===================================================================================
= BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
= PID 6804 RUNNING AT 192.168.1.106
= EXIT CODE: 134
= CLEANING UP REMAINING PROCESSES
= YOU CAN IGNORE THE BELOW CLEANUP MESSAGES
===================================================================================
[proxy:0:[email protected]] HYD_pmcd_pmip_control_cmd_cb (/home/alankar/mpich3/mpich-3.2/src/pm/hydra/pm/pmiserv/pmip_cb.c:885): assert (!closed) failed
[proxy:0:[email protected]] HYDT_dmxu_poll_wait_for_event (/home/alankar/mpich3/mpich-3.2/src/pm/hydra/tools/demux/demux_poll.c:76): callback returned error status
[proxy:0:[email protected]] main (/home/alankar/mpich3/mpich-3.2/src/pm/hydra/pm/pmiserv/pmip.c:206): demux engine error waiting for event
[[email protected]] HYDT_bscu_wait_for_completion (/home/alankar/mpich3/mpich-3.2/src/pm/hydra/tools/bootstrap/utils/bscu_wait.c:76): one of the processes terminated badly; aborting
[[email protected]] HYDT_bsci_wait_for_completion (/home/alankar/mpich3/mpich-3.2/src/pm/hydra/tools/bootstrap/src/bsci_wait.c:23): launcher returned error waiting for completion
[[email protected]] HYD_pmci_wait_for_completion (/home/alankar/mpich3/mpich-3.2/src/pm/hydra/pm/pmiserv/pmiserv_pmci.c:218): launcher returned error waiting for completion
[[email protected]] main (/home/alankar/mpich3/mpich-3.2/src/pm/hydra/ui/mpich/mpiexec.c:344): process manager error waiting for completion
私は私がノードであるノード0でプロットしかしときmpiexec -n 2 -f mfile python mpi_test_4.pyコードが動作します。例:
from mpi4py import MPI
import matplotlib.pyplot as plt
import numpy as np
comm = MPI.COMM_WORLD
rank = comm.rank
x = np.linspace(-2*np.pi,2*np.pi,100)
if (rank == 1):
y1 = np.sin(x)
else:
y1 = None
y1 = comm.bcast(y1,root=1)
if (rank == 0):
y2 = np.cos(x)
fig = plt.figure()
ax = fig.gca()
ax.plot(x,y1)
ax.plot(x,y2)
plt.savefig('test.png')
print(rank)
あなたは誰が何が起こっているかを説明答えることができる前に、各エラーの原因となるコードを変更する、あなたの質問を編集しておきます。あなたはまだ実際の "奇妙なエラー"を持っているのですか? – Blckknght
@Blckknghtはまだそれを持っている –
こんにちは@ランカがどこから来ているAlankarDutta? –