我目前正在研究一些圖論問題的MPI代碼,其中許多節點都可以包含答案和答案的長度。爲了讓所有事情回到主節點,我正在爲MPI_Gather做出答案,並嘗試使用MPI_MINLOC操作來執行MPI_Reduce來確定誰擁有最短的解決方案。現在我的數據類型,存儲長度和節點ID被定義爲(每衆多網站,如http://www.open-mpi.org/doc/v1.4/man3/MPI_Reduce.3.php所示的例子):OpenMPI使用MINLOC減少
struct minType
{
float len;
int index;
};
在我初始化這個結構以下列方式的本地副本的每個節點:
int commRank;
MPI_Comm_rank (MPI_COMM_WORLD, &commRank);
minType solutionLen;
solutionLen.len = 1e37;
solutionLen.index = commRank;
在執行我有一個MPI_Gather調用成功拉動的解決方案了所有的(我已經打印了出來,從內存中,以覈實它們)的結束,以及呼叫:
MPI_Reduce (&solutionLen, &solutionLen, 1, MPI_FLOAT_INT, MPI_MINLOC, 0, MPI_COMM_WORLD);
這是我的理解是,參數應該是:
- 數據源
- 是結果的目標(只有指定的根節點上顯著)
- 通過發送的項目數每個節點
- 數據類型(MPI_FLOAT_INT似乎定義的基於上述鏈路上)
- 操作(MPI_MINLOC似乎被定義爲孔)
- 根指定通信組中的節點ID
- 要等待的通信組。
當我的代碼,使得它在降低運行我得到這個錯誤:
[compute-2-19.local:9754] *** An error occurred in MPI_Reduce
[compute-2-19.local:9754] *** on communicator MPI_COMM_WORLD
[compute-2-19.local:9754] *** MPI_ERR_ARG: invalid argument of some other kind
[compute-2-19.local:9754] *** MPI_ERRORS_ARE_FATAL (your MPI job will now abort)
--------------------------------------------------------------------------
mpirun has exited due to process rank 0 with PID 9754 on
node compute-2-19.local exiting improperly. There are two reasons this could occur:
1. this process did not call "init" before exiting, but others in
the job did. This can cause a job to hang indefinitely while it waits
for all processes to call "init". By rule, if one process calls "init",
then ALL processes must call "init" prior to termination.
2. this process called "init", but exited without calling "finalize".
By rule, all processes that call "init" MUST call "finalize" prior to
exiting or it will be considered an "abnormal termination"
This may have caused other processes in the application to be
terminated by signals sent by mpirun (as reported here).
--------------------------------------------------------------------------
我承認在這個被完全難住了。萬一它很重要我正在基於CentOS 5.5的Rocks羣集上使用OpenMPI 1.5.3(使用gcc 4.4構建)進行編譯。
就是這樣。我一直在做這樣的事情一段時間(使用相同的對象發送和接收),我應該回去,並確保我現在可以合法地做到這一點。感謝您的快速回復。 – jthecie
不錯。 (你應該仔細閱讀文件,但是打開MPI應該給出一個更清楚的錯誤信息) – Walter
我在哪裏拍攝自己的腳,那是回想起能夠在其他所有操作上做到這一點,並做出假設的愚蠢錯誤它也會在這裏工作。現在我知道並且能夠獲得這個代碼並且工作。再次感謝您的快速回復。 – jthecie