0

タグ付きのメッセージをブロックプローブするメッセージハンドラーを作成しようとしています:

MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &probe_status);

そして、タグに応じて適切に行動します。

int tag = probe_status.MPI_TAG;
if (tag == 0){
    // The message is of type a
}
else if (tag == 1){
    // The message is of type b
}

ただし、送信者を分離し、タグ 1 を使用しprobe_status.MPI_TAGているのは 1 つだけですが、常に 0 と評価されます。MPI_Isend

編集:実際、

MPI_Probe(0, 1, MPI_COMM_WORLD, &probe_status);

cout << rank << ": a message has been found with the probe, with tag " 
     << probe_status.MPI_TAG << ", source " << probe_status.MPI_SOURCE << " 
     and size " << probe_status.count << endl;

指定: タグ 0、ソース 12、およびサイズ 0。実行中のノードは 2 つだけであり、送信者が削除された場合、プローブはブロックされるため、ノード 0 から送信された「正しい」メッセージが検出されます。

EDIT2:送信者はこれです:

unsigned int rank = MPI::COMM_WORLD.Get_rank();
unsigned int nodes = MPI::COMM_WORLD.Get_size();

for(unsigned int i=0; i<nodes; i++){
// Send the release to all nodes except the current
    if(i != rank){
        int taskid[5];
        convert_task_to_id(task_name,taskid);

    Message* message = get_available_message();
    memcpy(message->taskobject_id,taskid, sizeof(taskid));

    message->available = false;
    MPI_Isend(&(message->taskobject_id), 3, MPI_INT, i, 1, MPI_COMM_WORLD, &(message->request));
}
}

所蔵と利用可能Messageはどこにありますか(終了したときに s を再利用できるように)。この例では、ノード 0 のみが送信し、ノード 1 のみがメッセージを見つけます。MPICH 3.0.4 を使用。structMPI_RequestboolMPI_Request

助けてくれてありがとう。

4

0 に答える 0