2017-07-15 1 views
0

ich diese Störung erhalte:MPI_Iprobe: Ungültige Verschiebung Argument in RMA Anruf

[ranks] message 

[0] fatal error 
Fatal error in MPI_Iprobe: Invalid displacement argument in RMA call, error stack: 
MPI_Iprobe(src=MPI_ANY_SOURCE, tag=MPI_ANY_TAG, MPI_COMM_WORLD, flag=0x0000006C0A8FF214, status=0x0000006C0A8FF238) failed 
(unknown)(): Invalid displacement argument in RMA call 

[1] terminated 

Dies ist der Funktionsaufruf ich verwende:

MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, &status); 

Bearbeiten - Eine vollständige Code, der den Fehler erzeugt:

#include<iostream> 
#include "mpi.h" 
#include <omp.h> 
#include <process.h> 

using namespace std; 

int numOfProc, id; 
int *arr = NULL; 
MPI_Status status; 
const static int tag = 1; 
int provided; 

void fun_1(); 
void fun_0(); 


int main(int argc, char *argv[]) 
{ 
    //MPI_Init(&argc, &argv); 
    MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided); 


    MPI_Comm_size(MPI_COMM_WORLD, &numOfProc); 
    MPI_Comm_rank(MPI_COMM_WORLD, &id); 

    cout << "Hello from Process # " << id << '\n'; 

    if (id == 0) 
     fun_0(); 
    else 
     fun_1(); 

    MPI_Finalize(); 
} 



void fun_1() 
{ 
    omp_set_num_threads(2); 
#pragma omp parallel for 
    for (int i = 0; i < 2; i++) 
    { 

     int flag; 
     int recvArr[3]; 
     int sendArr[3]; 

     while (true) 
     { 
      flag = 0; 

      //Wait for a msg 
      while (!flag) 
      { 
       MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, &status); 
      } 

      MPI_Recv(&recvArr, 3, MPI_INT, status.MPI_SOURCE, tag, MPI_COMM_WORLD, &status); 

      sendArr[0] = 1; 
      sendArr[1] = 2; 
      sendArr[2] = 3; 
      int size = 3; 

      MPI_Send(sendArr, size, MPI_INT, status.MPI_SOURCE, tag, MPI_COMM_WORLD); 
     } 
    } 
} 


void fun_0() 
{ 
    omp_set_num_threads(2); 
#pragma omp parallel for 
    for (int i = 0; i < 2; i++) 
    { 
     int num = 1; 
     while (true) 
     { 
      if (num++ % 2 == 0) 
      { 
       int arr[3]; 

       arr[0] = 1; 
       arr[1] = 2; 
       arr[2] = 3; 

       MPI_Send(arr, 3, MPI_INT, 1, tag, MPI_COMM_WORLD); 

       MPI_Status status; 
       int length; 

       MPI_Probe(1, tag, MPI_COMM_WORLD, &status); 

       MPI_Get_count(&status, MPI_INT, &length); 

       // Allocate a buffer to hold the data 
       int* recievedResult = (int*)malloc(sizeof(int) * length); 

       // Now receive 
       MPI_Recv(recievedResult, length, MPI_INT, 1, tag, MPI_COMM_WORLD, MPI_STATUS_IGNORE); 
      } 
     } 
    } 

} 

Was bedeutet dieser Fehler?

+0

Bitte geben Sie eine [mcve] – Zulan

+0

Ich werde jetzt an einem Beispiel arbeiten. – Jack

+0

Ich habe einen Beispielcode hinzugefügt. – Jack

Antwort

0

Es wurde festgestellt, dass MPI_Iprobe nicht mehrere Threads unterstützt.

Verwandte Themen