Back to index

salome-med  6.5.0
Public Member Functions | Private Member Functions
MPIAccessTest Class Reference

#include <MPIAccessTest.hxx>

Inheritance diagram for MPIAccessTest:
Inheritance graph
[legend]
Collaboration diagram for MPIAccessTest:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 MPIAccessTest ()
 ~MPIAccessTest ()
void setUp ()
void tearDown ()
void test_MPI_Access_Send_Recv ()
void test_MPI_Access_Cyclic_Send_Recv ()
void test_MPI_Access_SendRecv ()
void test_MPI_Access_ISend_IRecv ()
void test_MPI_Access_Cyclic_ISend_IRecv ()
void test_MPI_Access_ISendRecv ()
void test_MPI_Access_Probe ()
void test_MPI_Access_IProbe ()
void test_MPI_Access_Cancel ()
void test_MPI_Access_Send_Recv_Length ()
void test_MPI_Access_ISend_IRecv_Length ()
void test_MPI_Access_ISend_IRecv_Length_1 ()
void test_MPI_Access_Time ()
void test_MPI_Access_Time_0 ()
void test_MPI_Access_ISend_IRecv_BottleNeck ()

Private Member Functions

 CPPUNIT_TEST_SUITE (MPIAccessTest)
 CPPUNIT_TEST (test_MPI_Access_Send_Recv)
 CPPUNIT_TEST (test_MPI_Access_Cyclic_Send_Recv)
 CPPUNIT_TEST (test_MPI_Access_SendRecv)
 CPPUNIT_TEST (test_MPI_Access_ISend_IRecv)
 CPPUNIT_TEST (test_MPI_Access_Cyclic_ISend_IRecv)
 CPPUNIT_TEST (test_MPI_Access_ISendRecv)
 CPPUNIT_TEST (test_MPI_Access_Probe)
 CPPUNIT_TEST (test_MPI_Access_IProbe)
 CPPUNIT_TEST (test_MPI_Access_Cancel)
 CPPUNIT_TEST (test_MPI_Access_Send_Recv_Length)
 CPPUNIT_TEST (test_MPI_Access_ISend_IRecv_Length)
 CPPUNIT_TEST (test_MPI_Access_ISend_IRecv_Length_1)
 CPPUNIT_TEST (test_MPI_Access_Time)
 CPPUNIT_TEST (test_MPI_Access_Time_0)
 CPPUNIT_TEST (test_MPI_Access_ISend_IRecv_BottleNeck)
 CPPUNIT_TEST_SUITE_END ()

Detailed Description

Definition at line 31 of file MPIAccessTest.hxx.


Constructor & Destructor Documentation

Definition at line 54 of file MPIAccessTest.hxx.

:CppUnit::TestFixture(){}

Definition at line 55 of file MPIAccessTest.hxx.

{}  

Member Function Documentation

void MPIAccessTest::setUp ( ) [inline]

Definition at line 56 of file MPIAccessTest.hxx.

{}
void MPIAccessTest::tearDown ( ) [inline]

Definition at line 57 of file MPIAccessTest.hxx.

{}

Definition at line 44 of file test_MPI_Access_Cancel.cxx.

                                           {

  cout << "test_MPI_Access_Cancel" << endl ;

//  MPI_Init(&argc, &argv) ; 

  int size ;
  int myrank ;
  MPI_Comm_size(MPI_COMM_WORLD,&size) ;
  MPI_Comm_rank(MPI_COMM_WORLD,&myrank) ;

  if ( size < 2 ) {
    ostringstream strstream ;
    strstream << "test_MPI_Access_Cancel must be runned with 2 procs" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }

  cout << "test_MPI_Access_Cancel" << myrank << endl ;

  ParaMEDMEM::CommInterface interface ;

  ParaMEDMEM::MPIProcessorGroup* group = new ParaMEDMEM::MPIProcessorGroup(interface) ;

  ParaMEDMEM::MPIAccess mpi_access( group ) ;

  if ( myrank >= 2 ) {
    mpi_access.barrier() ;
    delete group ;
    return ;
  }

  int target = 1 - myrank ;
  int intsendbuf[5] ;
  double doublesendbuf[10] ;
  int RequestId[10] ;
  int sts ;
  int i , j ;
  for ( j = 0 ; j < 3 ; j++ ) {
     for ( i = 0 ; i < 10 ; i++ ) {
        cout << "test" << myrank << " ============================ i " << i
             << "============================" << endl ;
        if ( myrank == 0 ) {
          if ( i < 5 ) {
            intsendbuf[i] = i ;
            sts = mpi_access.ISend(&intsendbuf[i],1,MPI_INT,target, RequestId[i]) ;
            cout << "test" << myrank << " Send MPI_INT RequestId " << RequestId[i]
                 << endl ;
          }
          else {
            doublesendbuf[i] = i ;
            sts = mpi_access.ISend(&doublesendbuf[i],1,MPI_DOUBLE,target,
                                   RequestId[i]) ;
            cout << "test" << myrank << " Send MPI_DOUBLE RequestId " << RequestId[i]
                 << endl ;
          }
        }
        else {
          int flag = false ;
          while ( !flag ) {
               int source, tag, outcount ;
               MPI_Datatype datatype ;
               sts = mpi_access.IProbe(target, source, tag, datatype, outcount,
                                       flag ) ;
               if ( flag ) {
                 cout << "test" << myrank << " " << i << " IProbe target " << target
                      << " source " << source << " tag " << tag
                      << " outcount " << outcount << " flag " << flag << endl ;
               }
               else {
                 cout << "test" << myrank << " flag " << flag << endl ;
                 sleep( 1 ) ;
               }
               if ( flag ) {
                 int recvbuf ;
                 sts = mpi_access.IRecv(&recvbuf,outcount,MPI_INT,source,
                                        RequestId[i] ) ;
                 if ( datatype == MPI_INT ) {
                   int source, tag, error, outcount ;
                   mpi_access.wait( RequestId[i] ) ;
                   mpi_access.status( RequestId[i], source, tag, error, outcount,
                                      true ) ;
                   if ( (outcount != 1) | (recvbuf != i) ) {
                     ostringstream strstream ;
                     strstream << "======================================================"
                               << endl << "test" << myrank << " outcount " << outcount
                               << " recvbuf " << recvbuf << " KO" << endl
                               << "======================================================"
                               << endl ;
                     cout << strstream.str() << endl ;
                     CPPUNIT_FAIL( strstream.str() ) ;
                   }
                   cout << "========================================================"
                        << endl << "test" << myrank << " outcount " << outcount
                        << " recvbuf " << recvbuf << " OK" << endl
                        << "========================================================"
                        << endl ;
                 }
               }
          }
        }
        char msgerr[MPI_MAX_ERROR_STRING] ;
        int lenerr ;
        mpi_access.errorString(sts, msgerr, &lenerr) ;
        cout << "test" << myrank << " lenerr " << lenerr << " "
             << msgerr << endl ;
        if ( sts != MPI_SUCCESS ) {
          ostringstream strstream ;
          strstream << "==========================================================="
                    << endl << "test" << myrank << " KO"
                    << "==========================================================="
                    << endl ;
          cout << strstream.str() << endl ;
          CPPUNIT_FAIL( strstream.str() ) ;
        }
        mpi_access.check() ;
     }

     if ( myrank != 0 ) {
       int iprobe ;
       for ( iprobe = 5 ; iprobe < 10 ; iprobe++ ) {
          cout << "test" << myrank << " ============================ iprobe "
               << iprobe << "============================" << endl ;
          int source, tag, outcount ;
          MPI_Datatype datatype ;
          int probeflag = false ;
          while ( !probeflag ) {
               sts = mpi_access.IProbe( target, source, tag, datatype, outcount,
                                        probeflag ) ;
               char msgerr[MPI_MAX_ERROR_STRING] ;
               int lenerr ;
               mpi_access.errorString(sts, msgerr, &lenerr) ;
               cout << "test" << myrank << " IProbe iprobe " << iprobe
                    << " target " << target << " probeflag " << probeflag
                    << " tag " << tag << " outcount " << outcount << " datatype "
                    << datatype << " lenerr " << lenerr << " " << msgerr << endl ;
               if ( sts != MPI_SUCCESS ) {
                 ostringstream strstream ;
                 strstream << "=========================================================="
                           << endl << "test" << myrank << " IProbe KO iprobe " << iprobe
                           << endl
                           << "=========================================================="
                           << endl ;
                 cout << strstream.str() << endl ;
                 CPPUNIT_FAIL( strstream.str() ) ;
               }
               if ( !probeflag ) {
                 //cout << "========================================================"
                 //     << endl << "test" << myrank << " IProbe KO(OK) iprobe " << iprobe
                 //     << " probeflag " << probeflag << endl
                 //     << "========================================================"
                 //     << endl ;
               }
               else {
                 cout << "test" << myrank << " " << iprobe << " IProbe target "
                      << target << " source " << source << " tag " << tag
                      << " outcount " << outcount << " probeflag " << probeflag
                      << endl ;
                 if ( datatype != MPI_DOUBLE ) {
                   ostringstream strstream ;
                   strstream << "========================================================"
                             << endl << "test" << myrank << " MPI_DOUBLE KO" << endl
                             << "========================================================"
                             << endl ;
                   cout << strstream.str() << endl ;
                   CPPUNIT_FAIL( strstream.str() ) ;
                 }
                 else {
                   int flag ;
                   sts = mpi_access.cancel( source, tag, datatype, outcount, flag ) ;
                   if ( sts != MPI_SUCCESS || !flag ) {
                     mpi_access.errorString(sts, msgerr, &lenerr) ;
                     cout << "======================================================"
                          << endl << "test" << myrank << " lenerr " << lenerr << " "
                          << msgerr << endl << "test" << myrank
                          << " Cancel PendingIrecv KO flag " << flag << " iprobe "
                          << iprobe << " Irecv completed" << endl
                          << "======================================================"
                          << endl ;
                     //return 1 ;
                   }
                   else {
                     cout << "======================================================"
                          << endl << "test" << myrank
                          << " Cancel PendingIrecv OK RequestId " << " flag "
                          << flag << " iprobe " << iprobe << endl
                          << "======================================================"
                          << endl ;
                   }
                 }
                 int Reqtarget, Reqtag, Reqerror, Reqoutcount ;
                 mpi_access.status( RequestId[iprobe], Reqtarget, Reqtag, Reqerror,
                                    Reqoutcount, true ) ;
                 cout << "test" << myrank << " Status Reqtarget "<< Reqtarget
                      << " Reqtag " << Reqtag << " Reqoutcount " << Reqoutcount
                      << endl ;
                 int Reqflag ;
                 sts = mpi_access.cancel( RequestId[iprobe] , Reqflag ) ;
                 cout << "test" << myrank << " " << iprobe
                      << " Cancel Irecv done Reqtarget " << Reqtarget
                      << " Reqtag " << Reqtag << " Reqoutcount " << Reqoutcount
                      << " Reqflag " << Reqflag << endl ;
                 if ( sts != MPI_SUCCESS || !Reqflag ) {
                   mpi_access.errorString(sts, msgerr, &lenerr) ;
                   ostringstream strstream ;
                   strstream << "========================================================"
                             << endl << "test" << myrank << " lenerr " << lenerr << " "
                             << msgerr << endl << "test" << myrank
                             << " Cancel Irecv KO Reqflag " << Reqflag << " iprobe "
                             << iprobe << endl
                             << "========================================================"
                             << endl ;
                   cout << strstream.str() << endl ;
                   CPPUNIT_FAIL( strstream.str() ) ;
                 }
                 else {
                   cout << "========================================================"
                        << endl << "test" << myrank
                        << " Cancel Irecv OK RequestId " << RequestId[iprobe]
                        << " Reqflag " << Reqflag << " iprobe " << iprobe << endl
                        << "========================================================"
                        << endl ;
                   probeflag = Reqflag ;
                 }
               }
          }
       }
     }
     mpi_access.waitAll(10,RequestId) ;
     mpi_access.deleteRequests(10,RequestId) ;
  }

  int source, tag, outcount, flag ;
  MPI_Datatype datatype ;
  sts = mpi_access.IProbe(target, source, tag, datatype, outcount, flag ) ;
  char msgerr[MPI_MAX_ERROR_STRING] ;
  int lenerr ;
  mpi_access.errorString(sts, msgerr, &lenerr) ;
  cout << "test" << myrank << " lenerr " << lenerr << " "
       << msgerr << endl ;
  if ( sts != MPI_SUCCESS || flag ) {
    ostringstream strstream ;
    strstream << "==========================================================="
              << endl << "test" << myrank << " IProbe KO flag " << flag
              << " remaining unread/cancelled message :" << endl
              << " source " << source << " tag " << tag << endl
              << "==========================================================="
              << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }

  mpi_access.testAll(10,RequestId,flag) ;
  mpi_access.waitAll(10,RequestId) ;
  mpi_access.deleteRequests(10,RequestId) ;
  mpi_access.testAll(10,RequestId,flag) ;
  if ( !flag ) {
    ostringstream strstream ;
    strstream << "test" << myrank << " flag " << flag << " KO" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }
  mpi_access.check() ;

  mpi_access.barrier() ;

  delete group ;

//  MPI_Finalize();

  cout << "test" << myrank << " OK" << endl ;

  return ;
}

Here is the call graph for this function:

Definition at line 43 of file test_MPI_Access_Cyclic_ISend_IRecv.cxx.

                                                       {

  cout << "test_MPI_Access_Cyclic_ISend_IRecv" << endl ;

//  MPI_Init(&argc, &argv) ; 

  int size ;
  int myrank ;
  MPI_Comm_size(MPI_COMM_WORLD,&size) ;
  MPI_Comm_rank(MPI_COMM_WORLD,&myrank) ;

  if ( size < 3 ) {
    cout << "test_MPI_Access_Cyclic_ISend_IRecv must be runned with 3 procs" << endl ;
    CPPUNIT_FAIL("test_MPI_Access_Cyclic_ISend_IRecv must be runned with 3 procs") ;
  }

  cout << "test_MPI_Access_Cyclic_ISend_IRecv" << myrank << endl ;

  ParaMEDMEM::CommInterface interface ;

  ParaMEDMEM::MPIProcessorGroup* group = new ParaMEDMEM::MPIProcessorGroup(interface) ;

  ParaMEDMEM::MPIAccess mpi_access( group ) ;

#define maxsend 100

  if ( myrank >= 3 ) {
    mpi_access.barrier() ;
    delete group ;
    return ;
  }

  int alltarget[3] = {1 , 2 , 0 } ;
  int allsource[3] = {2 , 0 , 1 } ;
  int SendRequestId[maxsend] ;
  int RecvRequestId[maxsend] ;
  int sendbuf[maxsend] ;
  int recvbuf[maxsend] ;
  int sts ;
  int i = 0 ;
  if ( myrank == 0 ) {
    sendbuf[i] = i ;
    sts = mpi_access.ISend(&sendbuf[i],1,MPI_INT,alltarget[myrank],
                           SendRequestId[i]) ;
    cout << "test" << myrank << " Send RequestId " << SendRequestId[i]
         << " tag " << mpi_access.sendMPITag(alltarget[myrank]) << endl ;
  }
  for ( i = 0 ; i < maxsend ; i++ ) {
     recvbuf[i] = -1 ;
     sts = mpi_access.IRecv(&recvbuf[i],1,MPI_INT,allsource[myrank],
                            RecvRequestId[i]) ;
     cout << "test" << myrank << " Recv RequestId " << RecvRequestId[i]
          << " tag " << mpi_access.recvMPITag(allsource[myrank]) << endl ;
     char msgerr[MPI_MAX_ERROR_STRING] ;
     int lenerr ;
     mpi_access.errorString(sts, msgerr, &lenerr) ;
     cout << "test" << myrank << " lenerr " << lenerr
          << " " << msgerr << endl ;

     if ( sts != MPI_SUCCESS ) {
       ostringstream strstream ;
       strstream << "==========================================================="
                 << "test" << myrank << " KO"
                 << "==========================================================="
                 << endl ;
       cout << strstream.str() << endl ;
       CPPUNIT_FAIL( strstream.str() ) ;
     }
     int j ;
     for (j = 0 ; j <= i ; j++) {
        int flag ;
        if ( j < i ) {
          cout << "test" << myrank << " " << j << " -> Test-Send("<< SendRequestId[j]
               << ")" << endl ;
          mpi_access.test( SendRequestId[j], flag ) ;
          if ( flag ) {
            int target, tag, error, outcount ;
            mpi_access.status( SendRequestId[j], target, tag, error, outcount,
                               true ) ;
            cout << "test" << myrank << " Send RequestId " << SendRequestId[j]
                 << " target " << target << " tag " << tag << " error " << error
                 << endl ;
            mpi_access.deleteRequest( SendRequestId[j] ) ;
          }
        }
        cout << "test" << myrank << " " << j << " -> Test-Recv("<< SendRequestId[j]
             << ")" << endl ;
        mpi_access.test( RecvRequestId[j], flag ) ;
        if ( flag ) {
          int source, tag, error, outcount ;
          mpi_access.status( RecvRequestId[j], source, tag, error, outcount,
                             true ) ;
          cout << "test" << myrank << " Recv RequestId" << j << " "
               << RecvRequestId[j] << " source " << source << " tag " << tag
               << " error " << error << " outcount " << outcount << endl ;
          if ( (outcount != 1) | (recvbuf[j] != j) ) {
            ostringstream strstream ;
            strstream << "====================================================="
                      << endl << "test" << myrank << " outcount "
                      << outcount << " recvbuf[ " << j << " ] " << recvbuf[j] << " KO"
                      << endl << "====================================================="
                      << endl ;
            cout << strstream.str() << endl ;
            CPPUNIT_FAIL( strstream.str() ) ;
          }
        }
     }
     if ( myrank == 0 ) {
       if ( i != maxsend-1 ) {
         sendbuf[i+1] = i + 1 ;
         sts = mpi_access.ISend(&sendbuf[i+1],1,MPI_INT,alltarget[myrank],
                                SendRequestId[i+1]) ;
         cout << "test" << myrank << " Send RequestId " << SendRequestId[i+1]
              << " tag " << mpi_access.sendMPITag(alltarget[myrank]) << endl ;
       }
     }
     else {
       sendbuf[i] = i ;
       sts = mpi_access.ISend(&sendbuf[i],1,MPI_INT,alltarget[myrank],
                              SendRequestId[i]) ;
       cout << "test" << myrank << " Send RequestId " << SendRequestId[i]
            << " tag " << mpi_access.sendMPITag(alltarget[myrank]) << endl ;
     }
     mpi_access.errorString(sts, msgerr, &lenerr) ;
     cout << "test" << myrank << " lenerr " << lenerr
          << " " << msgerr << endl ;

     if ( sts != MPI_SUCCESS ) {
       ostringstream strstream ;
       strstream << "==========================================================="
                 << "test" << myrank << " KO"
                 << "==========================================================="
                 << endl ;
       cout << strstream.str() << endl ;
       CPPUNIT_FAIL( strstream.str() ) ;
     }
     mpi_access.check() ;
  }

  int flag ;
  mpi_access.testAll(maxsend,SendRequestId,flag) ;
  mpi_access.testAll(maxsend,RecvRequestId,flag) ;
  mpi_access.waitAll(maxsend,SendRequestId) ;
  mpi_access.deleteRequests(maxsend,SendRequestId) ;
  mpi_access.waitAll(maxsend,RecvRequestId) ;
  mpi_access.deleteRequests(maxsend,RecvRequestId) ;
  mpi_access.check() ;
  mpi_access.testAll(maxsend,SendRequestId,flag) ;
  if ( !flag ) {
    ostringstream strstream ;
    strstream << "=========================================================" << endl
              << "test" << myrank << " TestAllSendflag " << flag << " KO" << endl
              << "=========================================================" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }
  else {
    cout << "=========================================================" << endl
         << "test" << myrank << " TestAllSendflag " << flag << " OK" << endl
         << "=========================================================" << endl ;
  }
  mpi_access.testAll(maxsend,RecvRequestId,flag) ;
  if ( !flag ) {
    ostringstream strstream ;
    strstream << "=========================================================" << endl
              << "test" << myrank << " TestAllRecvflag " << flag << " KO" << endl
              << "=========================================================" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }
  else {
    cout << "=========================================================" << endl
         << "test" << myrank << " TestAllRecvflag " << flag << " OK" << endl
         << "=========================================================" << endl ;
  }

  int sendrequests[maxsend] ;
  int sendreqsize = mpi_access.sendRequestIds( alltarget[myrank] , maxsend ,
                                               sendrequests ) ;
  if ( sendreqsize != 0 ) {
    ostringstream strstream ;
    strstream << "=========================================================" << endl
              << "test" << myrank << " sendreqsize " << sendreqsize << " KO" << endl
              << "=========================================================" << endl ;
    cout << strstream.str() << endl ;
    int source, tag, error, outcount ;
    mpi_access.status(sendrequests[0], source, tag, error, outcount, true) ;
    cout << "test" << myrank << " RequestId " << sendrequests[0]
         << " source " << source << " tag " << tag << " error " << error
         << " outcount " << outcount << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }
  else {
    cout << "=========================================================" << endl
         << "test" << myrank << " sendreqsize " << sendreqsize << " OK" << endl
         << "=========================================================" << endl ;
  }
  int recvrequests[maxsend] ;
  int recvreqsize = mpi_access.sendRequestIds( allsource[myrank] , maxsend ,
                                               recvrequests ) ;
  if ( recvreqsize != 0 ) {
    ostringstream strstream ;
    strstream << "=========================================================" << endl
              << "test" << myrank << " recvreqsize " << recvreqsize << " KO" << endl
              << "=========================================================" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }
  else {
    cout << "=========================================================" << endl
         << "test" << myrank << " recvreqsize " << recvreqsize << " OK" << endl
         << "=========================================================" << endl ;
  }

  mpi_access.barrier() ;

  delete group ;

//  MPI_Finalize();

  cout << "test" << myrank << " OK" << endl ;

  return ;
}

Here is the call graph for this function:

Definition at line 42 of file test_MPI_Access_Cyclic_Send_Recv.cxx.

                                                     {

  cout << "test_MPI_Access_Cyclic_Send_Recv" << endl ;

//  MPI_Init(&argc, &argv) ; 

  int size ;
  int myrank ;
  MPI_Comm_size(MPI_COMM_WORLD,&size) ;
  MPI_Comm_rank(MPI_COMM_WORLD,&myrank) ;

  if ( size < 3 ) {
    cout << "test_MPI_Access_Send_Recv must be runned with 3 procs" << endl ;
    CPPUNIT_FAIL("test_MPI_Access_Send_Recv must be runned with 3 procs") ;
  }

  cout << "test_MPI_Access_Cyclic_Send_Recv" << myrank << endl ;

  ParaMEDMEM::CommInterface interface ;

  ParaMEDMEM::MPIProcessorGroup* group = new ParaMEDMEM::MPIProcessorGroup(interface) ;

  ParaMEDMEM::MPIAccess mpi_access( group ) ;

  if ( myrank >= 3 ) {
    mpi_access.barrier() ;
    delete group ;
    return ;
  }

  int alltarget[3] = {1 , 2 , 0 } ;
  int allsource[3] = {2 , 0 , 1 } ;
  int RequestId[10] ;
  int sts ;
  int i = 0 ;
  if ( myrank == 0 ) {
    sts = mpi_access.send(&i,1,MPI_INT,alltarget[myrank], RequestId[i]) ;
    cout << "test" << myrank << " Send RequestId " << RequestId[i]
         << " tag " << mpi_access.sendMPITag(alltarget[myrank]) << endl ;
  }
  for ( i = 0 ; i < 10 ; i++ ) {
     int recvbuf ;
     int outcount ;
     if ( i & 1 ) {
       outcount = 0 ;
       sts = mpi_access.recv(&recvbuf,1,MPI_INT,allsource[myrank], RequestId[i],
                             &outcount) ;
     }
     else {
       sts = mpi_access.recv(&recvbuf,1,MPI_INT,allsource[myrank], RequestId[i]) ;
       outcount = 1 ;
     }
     //int source, tag, error, outcount ;
     //mpi_access.Status( RequestId[i], source, tag, error, outcount, true) ;
     cout << "test" << myrank << " Recv RequestId " << RequestId[i]
          << " tag " << mpi_access.recvMPITag(allsource[myrank])
          << " outcount " << outcount << endl ;
     if ( (outcount != 1) | (recvbuf != i) ) {
       ostringstream strstream ;
       strstream << "==========================================================="
                 << "test" << myrank << " outcount "
                 << outcount << " recvbuf " << recvbuf << " KO"
                 << "==========================================================="
                 << endl ;
       cout << strstream.str() << endl ;
       CPPUNIT_FAIL( strstream.str() ) ;
     }
     if ( myrank == 0 ) {
       if ( i != 9 ) {
         int ii = i + 1 ;
         sts = mpi_access.send(&ii,1,MPI_INT,alltarget[myrank], RequestId[i]) ;
         cout << "test" << myrank << " Send RequestId " << RequestId[i]
              << " tag " << mpi_access.sendMPITag(alltarget[myrank]) << endl ;
       }
     }
     else {
       sts = mpi_access.send(&i,1,MPI_INT,alltarget[myrank], RequestId[i]) ;
       cout << "test" << myrank << " Send RequestId " << RequestId[i]
            << " tag " << mpi_access.sendMPITag(alltarget[myrank]) << endl ;
     }
     char msgerr[MPI_MAX_ERROR_STRING] ;
     int lenerr ;
     mpi_access.errorString(sts, msgerr, &lenerr) ;
     cout << "test" << myrank << " lenerr " << lenerr
          << " " << msgerr << endl ;

     if ( sts != MPI_SUCCESS ) {
       ostringstream strstream ;
       strstream << "==========================================================="
                 << "test" << myrank << " KO"
                 << "==========================================================="
                 << endl ;
       cout << strstream.str() << endl ;
       CPPUNIT_FAIL( strstream.str() ) ;
     }
     mpi_access.check() ;
  }

  int flag ;
  mpi_access.testAll(10,RequestId,flag) ;
  if ( !flag ) {
    ostringstream strstream ;
    strstream << "test" << myrank << " flag " << flag << " KO" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }
  mpi_access.waitAll(10,RequestId) ;
  mpi_access.check() ;

  int sendrequests[10] ;
  int sendreqsize = mpi_access.sendRequestIds( alltarget[myrank] , 10 ,
                                               sendrequests ) ;
  if ( sendreqsize != 0 ) {
    ostringstream strstream ;
    strstream << "=========================================================" << endl
              << "test" << myrank << " sendreqsize " << sendreqsize << " KO" << endl
              << "=========================================================" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }
  int recvrequests[10] ;
  int recvreqsize = mpi_access.sendRequestIds( allsource[myrank] , 10 ,
                                               recvrequests ) ;
  if ( recvreqsize != 0 ) {
    ostringstream strstream ;
    strstream << "=========================================================" << endl
              << "test" << myrank << " recvreqsize " << recvreqsize << " KO" << endl
              << "=========================================================" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }

  mpi_access.barrier() ;

  delete group ;

//  MPI_Finalize();

  cout << "test" << myrank << " OK" << endl ;

  return ;
}

Here is the call graph for this function:

Definition at line 44 of file test_MPI_Access_IProbe.cxx.

                                           {

  cout << "test_MPI_Access_IProbe" << endl ;

//  MPI_Init(&argc, &argv) ; 

  int size ;
  int myrank ;
  MPI_Comm_size(MPI_COMM_WORLD,&size) ;
  MPI_Comm_rank(MPI_COMM_WORLD,&myrank) ;

  if ( size < 2 ) {
    ostringstream strstream ;
    strstream << "test_MPI_Access_IProbe must be runned with 2 procs" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }

  cout << "test_MPI_Access_IProbe" << myrank << endl ;

  ParaMEDMEM::CommInterface interface ;

  ParaMEDMEM::MPIProcessorGroup* group = new ParaMEDMEM::MPIProcessorGroup(interface) ;

  ParaMEDMEM::MPIAccess mpi_access( group ) ;

  if ( myrank >= 2 ) {
    mpi_access.barrier() ;
    delete group ;
    return ;
  }

  int target = 1 - myrank ;
  int sendbuf[10] ;
  int RequestId[10] ;
  int sts ;
  int i ;
  for ( i = 0 ; i < 10 ; i++ ) {
     if ( myrank == 0 ) {
       sendbuf[i] = i ;
       sts = mpi_access.ISend(&sendbuf[i],1,MPI_INT,target, RequestId[i]) ;
       cout << "test" << myrank << " Send RequestId " << RequestId[i]
            << endl ;
     }
     else {
       int flag = false ;
       while ( !flag ) {
            int source, tag, outcount ;
            MPI_Datatype datatype ;
            sts = mpi_access.IProbe(target, source, tag, datatype, outcount, flag ) ;
            if ( flag ) {
              cout << "test" << myrank << " " << i << " IProbe target " << target
                   << " source " << source << " tag " << tag
                   << " outcount " << outcount << " flag " << flag << endl ;
            }
            else {
              cout << "test" << myrank << " IProbe flag " << flag << endl ;
              sleep( 1 ) ;
            }
            if ( flag ) {
              int recvbuf ;
              sts = mpi_access.recv(&recvbuf,outcount,datatype,source, RequestId[i],
                                    &outcount) ;
              if ( (outcount != 1) | (recvbuf != i) ) {
                ostringstream strstream ;
                strstream << "==========================================================="
                          << endl << "test" << myrank << " outcount " << outcount
                          << " recvbuf " << recvbuf << " KO" << endl
                          << "==========================================================="
                          << endl ;
                cout << strstream.str() << endl ;
                CPPUNIT_FAIL( strstream.str() ) ;
              }
              cout << "==========================================================="
                   << endl << "test" << myrank << " outcount " << outcount
                   << " recvbuf " << recvbuf << " OK" << endl
                   << "==========================================================="
                   << endl ;
            }
       }
     }
     char msgerr[MPI_MAX_ERROR_STRING] ;
     int lenerr ;
     mpi_access.errorString(sts, msgerr, &lenerr) ;
     cout << "test" << myrank << " lenerr " << lenerr << " "
          << msgerr << endl ;

     if ( sts != MPI_SUCCESS ) {
       ostringstream strstream ;
       strstream << "==========================================================="
                 << "test" << myrank << " KO"
                 << "==========================================================="
                 << endl ;
       cout << strstream.str() << endl ;
       CPPUNIT_FAIL( strstream.str() ) ;
     }
     mpi_access.check() ;
  }
  int flag ;
  mpi_access.testAll(10,RequestId,flag) ;
  mpi_access.waitAll(10,RequestId) ;
  mpi_access.deleteRequests(10,RequestId) ;
  mpi_access.testAll(10,RequestId,flag) ;
  if ( !flag ) {
    ostringstream strstream ;
    strstream << "test" << myrank << " flag " << flag << " KO" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }
  mpi_access.check() ;

  mpi_access.barrier() ;

  delete group ;

//  MPI_Finalize();

  cout << "test" << myrank << " OK" << endl ;

  return ;
}

Here is the call graph for this function:

Definition at line 43 of file test_MPI_Access_ISend_IRecv.cxx.

                                                {

  cout << "test_MPI_Access_ISend_IRecv" << endl ;

  //  MPI_Init(&argc, &argv) ; 

  int size ;
  int myrank ;
  MPI_Comm_size(MPI_COMM_WORLD,&size) ;
  MPI_Comm_rank(MPI_COMM_WORLD,&myrank) ;

  if ( size < 2 ) {
    cout << "test_MPI_Access_ISend_IRecv must be runned with 2 procs" << endl ;
    CPPUNIT_FAIL("test_MPI_Access_ISend_IRecv must be runned with 2 procs") ;
  }

  cout << "test_MPI_Access_ISend_IRecv" << myrank << endl ;

  ParaMEDMEM::CommInterface interface ;

  ParaMEDMEM::MPIProcessorGroup* group = new ParaMEDMEM::MPIProcessorGroup(interface) ;

  ParaMEDMEM::MPIAccess mpi_access( group ) ;

#define maxreq 100

  if ( myrank >= 2 ) {
    mpi_access.barrier() ;
    delete group ;
    return ;
  }

  int target = 1 - myrank ;
  int SendRequestId[maxreq] ;
  int RecvRequestId[maxreq] ;
  int sts ;
  int sendbuf[maxreq] ;
  int recvbuf[maxreq] ;
  int i ;
  for ( i = 0 ; i < maxreq ; i++ ) {
    if ( myrank == 0 ) {
      sendbuf[i] = i ;
      sts = mpi_access.ISend(&sendbuf[i],1,MPI_INT,target, SendRequestId[i]) ;
      cout << "test" << myrank << " ISend RequestId " << SendRequestId[i]
           << " tag " << mpi_access.sendMPITag(target) << endl ;
    }
    else {
      sts = mpi_access.IRecv(&recvbuf[i],1,MPI_INT,target, RecvRequestId[i]) ;
      cout << "test" << myrank << " IRecv RequestId " << RecvRequestId[i]
           << " tag " << mpi_access.recvMPITag(target) << endl ;
    }
    int j ;
    for (j = 0 ; j <= i ; j++) {
      int flag ;
      if ( myrank == 0 ) {
        mpi_access.test( SendRequestId[j], flag ) ;
      }
      else {
        mpi_access.test( RecvRequestId[j], flag ) ;
      }
      if ( flag ) {
        int target,source, tag, error, outcount ;
        if ( myrank == 0 ) {
          mpi_access.status( SendRequestId[j], target, tag, error, outcount,
                             true ) ;
          cout << "test" << myrank << " Test(Send RequestId " << SendRequestId[j]
               << ") : target " << target << " tag " << tag << " error " << error
               << " flag " << flag << endl ;
        }
        else {
          mpi_access.status( RecvRequestId[j], source, tag, error, outcount,
                             true ) ;
          cout << "test" << myrank << " Test(Recv RequestId "
               << RecvRequestId[j] << ") : source " << source << " tag " << tag
               << " error " << error << " outcount " << outcount
               << " flag " << flag << endl ;
          if ( (outcount != 1) | (recvbuf[j] != j) ) {
            ostringstream strstream ;
            strstream << "==========================================================="
                      << endl << "test" << myrank << " outcount "
                      << outcount << " recvbuf " << recvbuf[j] << " KO" << endl
                      << "==========================================================="
                      << endl ;
            cout << strstream.str() << endl ;
            CPPUNIT_FAIL( strstream.str() ) ;
          }
          //else {
          //  cout << "==========================================================="
          //       << endl << "test" << myrank << " outcount " << outcount
          //       << " RequestId " << RecvRequestId[j] << " recvbuf "
          //       << recvbuf[j] << " OK" << endl
          //       << "==========================================================="
          //       << endl ;
          //}
        }
      }
    }
    char msgerr[MPI_MAX_ERROR_STRING] ;
    int lenerr ;
    mpi_access.errorString(sts, msgerr, &lenerr) ;
    cout << "test" << myrank << " lenerr " << lenerr << " "
         << msgerr << endl ;

    if ( sts != MPI_SUCCESS ) {
      ostringstream strstream ;
      strstream << "==========================================================="
                << "test" << myrank << " KO"
                << "==========================================================="
                << endl ;
      cout << strstream.str() << endl ;
      CPPUNIT_FAIL( strstream.str() ) ;
    }
  }

  mpi_access.check() ;
  if ( myrank == 0 ) {
    mpi_access.waitAll(maxreq, SendRequestId) ;
    mpi_access.deleteRequests(maxreq, SendRequestId) ;
  }
  else {
    mpi_access.waitAll(maxreq, RecvRequestId) ;
    mpi_access.deleteRequests(maxreq, RecvRequestId) ;
  }
  mpi_access.check() ;

  if ( myrank == 0 ) {
    int sendrequests[maxreq] ;
    int sendreqsize = mpi_access.sendRequestIds( target , maxreq , sendrequests ) ;
    int i ;
    if ( sendreqsize != 0 ) {
      ostringstream strstream ;
      strstream << "=========================================================" << endl
                << "test" << myrank << " sendreqsize " << sendreqsize << " KO" << endl
                << "=========================================================" << endl ;
      cout << strstream.str() << endl ;
      for ( i = 0 ; i < sendreqsize ; i++ ) {
        cout << "test" << myrank << " sendrequests[ " << i << " ] = "
             << sendrequests[i] << endl ;
      }
      CPPUNIT_FAIL( strstream.str() ) ;
    }
    else {
      cout << "=========================================================" << endl
           << "test" << myrank << " sendreqsize " << sendreqsize << " OK" << endl
           << "=========================================================" << endl ;
    }
  }
  else {
    int recvrequests[maxreq] ;
    int recvreqsize = mpi_access.sendRequestIds( target , maxreq , recvrequests ) ;
    if ( recvreqsize != 0 ) {
      ostringstream strstream ;
      strstream << "=========================================================" << endl
                << "test" << myrank << " recvreqsize " << recvreqsize << " KO" << endl
                << "=========================================================" << endl ;
      cout << strstream.str() << endl ;
      CPPUNIT_FAIL( strstream.str() ) ;
    }
    else {
      cout << "=========================================================" << endl
           << "test" << myrank << " recvreqsize " << recvreqsize << " OK" << endl
           << "=========================================================" << endl ;
    }
  }

  mpi_access.barrier() ;

  delete group ;

  //  MPI_Finalize();

  cout << "test" << myrank << " OK" << endl ;

  return ;
}

Here is the call graph for this function:

Definition at line 44 of file test_MPI_Access_ISend_IRecv_BottleNeck.cxx.

                                                           {

  cout << "test_MPI_Access_ISend_IRecv_BottleNeck" << endl ;

//  MPI_Init(&argc, &argv) ; 

  int size ;
  int myrank ;
  MPI_Comm_size(MPI_COMM_WORLD,&size) ;
  MPI_Comm_rank(MPI_COMM_WORLD,&myrank) ;

  if ( size < 2 ) {
    ostringstream strstream ;
    strstream << "test_MPI_Access_ISend_IRecv_BottleNeck must be runned with 2 procs"
              << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }

  cout << "test_MPI_Access_ISend_IRecv_BottleNeck" << myrank << endl ;

  ParaMEDMEM::CommInterface interface ;

  ParaMEDMEM::MPIProcessorGroup* group = new ParaMEDMEM::MPIProcessorGroup(interface) ;

  ParaMEDMEM::MPIAccess mpi_access( group ) ;

#define maxreq 10000

  if ( myrank >= 2 ) {
    mpi_access.barrier() ;
    delete group ;
    return ;
  }

  int target = 1 - myrank ;
  int SendRequestId[maxreq] ;
  int RecvRequestId[maxreq] ;
  int sts ;
  int sendbuf[maxreq] ;
  int recvbuf[maxreq] ;
  int i ;
  for ( i = 0 ; i < maxreq ; i++ ) {
     if ( myrank == 0 ) {
       sendbuf[i] = i ;
       sts = mpi_access.ISend(sendbuf,i,MPI_INT,target, SendRequestId[i]) ;
       cout << "test" << myrank << " ISend RequestId " << SendRequestId[i]
            << " tag " << mpi_access.sendMPITag(target) << endl ;
     }
     else {
       //sleep( 1 ) ;
       sts = mpi_access.IRecv(recvbuf,i,MPI_INT,target, RecvRequestId[i]) ;
       cout << "test" << myrank << " IRecv RequestId " << RecvRequestId[i]
            << " tag " << mpi_access.recvMPITag(target) << endl ;
       int recvreqsize = mpi_access.recvRequestIdsSize() ;
       int * recvrequests = new int[ recvreqsize ] ;
       recvreqsize = mpi_access.recvRequestIds( target , recvreqsize , recvrequests ) ;
       int j ;
       for (j = 0 ; j < recvreqsize ; j++) {
          int flag ;
          mpi_access.test( recvrequests[j], flag ) ;
          if ( flag ) {
            int source, tag, error, outcount ;
            mpi_access.status( recvrequests[j], source, tag, error, outcount,
                               true ) ;
            cout << "test" << myrank << " Test(Recv RequestId "
                 << recvrequests[j] << ") : source " << source << " tag " << tag
                 << " error " << error << " outcount " << outcount
                 << " flag " << flag << " : DeleteRequest" << endl ;
            mpi_access.deleteRequest( recvrequests[j] ) ;
          }
          else {
//            cout << "test" << myrank << " Test(Recv RequestId "
//                 << recvrequests[j] << ") flag " << flag << endl ;
          }
       }
       delete [] recvrequests ;
     }
     if ( sts != MPI_SUCCESS ) {
       char msgerr[MPI_MAX_ERROR_STRING] ;
       int lenerr ;
       mpi_access.errorString(sts, msgerr, &lenerr) ;
       cout << "test" << myrank << " lenerr " << lenerr << " "
            << msgerr << endl ;
     }

     if ( sts != MPI_SUCCESS ) {
       ostringstream strstream ;
       strstream << "==========================================================="
                 << "test" << myrank << " KO"
                 << "==========================================================="
                 << endl ;
       cout << strstream.str() << endl ;
       CPPUNIT_FAIL( strstream.str() ) ;
     }
  }

  mpi_access.check() ;
  if ( myrank == 0 ) {
    int size = mpi_access.sendRequestIdsSize() ;
    cout << "test" << myrank << " before WaitAll sendreqsize " << size << endl ;
    mpi_access.waitAll(maxreq, SendRequestId) ;
    size = mpi_access.sendRequestIdsSize() ;
    cout << "test" << myrank << " after WaitAll sendreqsize " << size << endl ;
    int * ArrayOfSendRequests = new int[ size ] ;
    int nSendRequest = mpi_access.sendRequestIds( size , ArrayOfSendRequests ) ;
    int i ;
    for ( i = 0 ; i < nSendRequest ; i++ ) {
       mpi_access.deleteRequest( ArrayOfSendRequests[i] ) ;
    }
    delete [] ArrayOfSendRequests ;
  }
  else {
    int size = mpi_access.recvRequestIdsSize() ;
    cout << "test" << myrank << " before WaitAll recvreqsize " << size << endl ;
    mpi_access.waitAll(maxreq, RecvRequestId) ;
    size = mpi_access.recvRequestIdsSize() ;
    cout << "test" << myrank << " after WaitAll recvreqsize " << size << endl ;
    int * ArrayOfRecvRequests = new int[ size ] ;
    int nRecvRequest = mpi_access.recvRequestIds( size , ArrayOfRecvRequests ) ;
    int i ;
    for ( i = 0 ; i < nRecvRequest ; i++ ) {
       mpi_access.deleteRequest( ArrayOfRecvRequests[i] ) ;
    }
    delete [] ArrayOfRecvRequests ;
  }
  mpi_access.check() ;

  if ( myrank == 0 ) {
    int sendrequests[maxreq] ;
    int sendreqsize = mpi_access.sendRequestIds( target , maxreq , sendrequests ) ;
    int i ;
    if ( sendreqsize != 0 ) {
      ostringstream strstream ;
      strstream << "=========================================================" << endl
                << "test" << myrank << " sendreqsize " << sendreqsize << " KO" << endl
                << "=========================================================" << endl ;
      cout << strstream.str() << endl ;
      for ( i = 0 ; i < sendreqsize ; i++ ) {
         cout << "test" << myrank << " sendrequests[ " << i << " ] = "
              << sendrequests[i] << endl ;
      }
      CPPUNIT_FAIL( strstream.str() ) ;
    }
    else {
      cout << "=========================================================" << endl
           << "test" << myrank << " sendreqsize " << sendreqsize << " OK" << endl
           << "=========================================================" << endl ;
    }
  }
  else {
    int recvrequests[maxreq] ;
    int recvreqsize = mpi_access.recvRequestIds( target , maxreq , recvrequests ) ;
    if ( recvreqsize != 0 ) {
      ostringstream strstream ;
      strstream << "=========================================================" << endl
                << "test" << myrank << " recvreqsize " << recvreqsize << " KO" << endl
                << "=========================================================" << endl ;
      cout << strstream.str() << endl ;
      CPPUNIT_FAIL( strstream.str() ) ;
    }
    else {
      cout << "=========================================================" << endl
           << "test" << myrank << " recvreqsize " << recvreqsize << " OK" << endl
           << "=========================================================" << endl ;
    }
  }

  mpi_access.barrier() ;

  delete group ;

//  MPI_Finalize();

  cout << "test" << myrank << " OK" << endl ;

  return ;
}

Here is the call graph for this function:

Definition at line 43 of file test_MPI_Access_ISend_IRecv_Length.cxx.

                                                       {

  cout << "test_MPI_Access_ISend_IRecv_Length" << endl ;

  //  MPI_Init(&argc, &argv) ; 

  int size ;
  int myrank ;
  MPI_Comm_size(MPI_COMM_WORLD,&size) ;
  MPI_Comm_rank(MPI_COMM_WORLD,&myrank) ;

  if ( size < 2 ) {
    ostringstream strstream ;
    strstream << "test_MPI_Access_ISend_IRecv_Length must be runned with 2 procs" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }

  cout << "test_MPI_Access_ISend_IRecv_Length" << myrank << endl ;

  ParaMEDMEM::CommInterface interface ;

  ParaMEDMEM::MPIProcessorGroup* group = new ParaMEDMEM::MPIProcessorGroup(interface) ;

  ParaMEDMEM::MPIAccess mpi_access( group ) ;

#define maxreq 10

  if ( myrank >= 2 ) {
    mpi_access.barrier() ;
    delete group ;
    return ;
  }

  int target = 1 - myrank ;
  int SendRequestId[maxreq] ;
  int RecvRequestId[maxreq] ;
  int sts ;
  int sendbuf[1000*(maxreq-1)] ;
  int recvbuf[maxreq-1][1000*(maxreq-1)] ;
  int i ;
  for ( i = 0 ; i < 1000*(maxreq-1) ; i++ ) {
    sendbuf[i] = i ;
  }
  for ( i = 0 ; i < maxreq ; i++ ) {
    if ( myrank == 0 ) {
      sts = mpi_access.ISend( sendbuf, 1000*i, MPI_INT, target, SendRequestId[i] ) ;
      cout << "test" << myrank << " ISend RequestId " << SendRequestId[i]
           << " tag " << mpi_access.sendMPITag(target) << endl ;
    }
    else {
      sts = mpi_access.IRecv( recvbuf[i], 1000*i, MPI_INT, target,
                              RecvRequestId[i] ) ;
      cout << "test" << myrank << " IRecv RequestId " << RecvRequestId[i]
           << " tag " << mpi_access.recvMPITag(target) << endl ;
    }
    int j ;
    for (j = 0 ; j <= i ; j++) {
      int flag ;
      if ( myrank == 0 ) {
        mpi_access.test( SendRequestId[j], flag ) ;
      }
      else {
        mpi_access.test( RecvRequestId[j], flag ) ;
      }
      if ( flag ) {
        int target,source, tag, error, outcount ;
        if ( myrank == 0 ) {
          mpi_access.status( SendRequestId[j], target, tag, error, outcount,
                             true ) ;
          cout << "test" << myrank << " Test(Send RequestId " << SendRequestId[j]
               << ") : target " << target << " tag " << tag << " error " << error
               << " flag " << flag << endl ;
        }
        else {
          mpi_access.status( RecvRequestId[j], source, tag, error, outcount,
                             true ) ;
          cout << "test" << myrank << " Test(Recv RequestId "
               << RecvRequestId[j] << ") : source " << source << " tag " << tag
               << " error " << error << " outcount " << outcount
               << " flag " << flag << endl ;
          if ( outcount != 0 ) {
            if ( (outcount != 1000*j) |
                 (recvbuf[j][outcount-1] != (outcount-1)) ) {
              ostringstream strstream ;
              strstream << "==========================================================="
                        << endl << "test" << myrank << " outcount "
                        << outcount << " recvbuf " << recvbuf[j][outcount-1] << " KO"
                        << endl
                        << "==========================================================="
                        << endl ;
              cout << strstream.str() << endl ;
              CPPUNIT_FAIL( strstream.str() ) ;
            }
            else {
              cout << "==========================================================="
                   << endl << "test" << myrank << " outcount " << outcount
                   << " RequestId " << RecvRequestId[j] << " recvbuf "
                   << recvbuf[j][outcount-1] << " OK" << endl
                   << "==========================================================="
                   << endl ;
            }
          }
          else {
            cout << "==========================================================="
                 << endl << "test" << myrank << " outcount " << outcount
                 << " RequestId " << RecvRequestId[j] << " OK" << endl
                 << "==========================================================="
                 << endl ;
          }
        }
      }
    }
    char msgerr[MPI_MAX_ERROR_STRING] ;
    int lenerr ;
    mpi_access.errorString(sts, msgerr, &lenerr) ;
    cout << "test" << myrank << " lenerr " << lenerr << " "
         << msgerr << endl ;

    if ( sts != MPI_SUCCESS ) {
      ostringstream strstream ;
      strstream << "==========================================================="
                << "test" << myrank << " KO"
                << "==========================================================="
                << endl ;
      cout << strstream.str() << endl ;
      CPPUNIT_FAIL( strstream.str() ) ;
    }
  }

  mpi_access.check() ;
  cout << "test" << myrank << " WaitAll" << endl ;
  if ( myrank == 0 ) {
    mpi_access.waitAll(maxreq, SendRequestId) ;
    mpi_access.deleteRequests(maxreq, SendRequestId) ;
  }
  else {
    mpi_access.waitAll(maxreq, RecvRequestId) ;
    mpi_access.deleteRequests(maxreq, RecvRequestId) ;
  }
  mpi_access.check() ;

  if ( myrank == 0 ) {
    int sendrequests[maxreq] ;
    int sendreqsize = mpi_access.sendRequestIds( target , maxreq , sendrequests ) ;
    sendreqsize = mpi_access.sendRequestIds( target , maxreq , sendrequests ) ;
    if ( sendreqsize != 0 ) {
      ostringstream strstream ;
      strstream << "=========================================================" << endl
                << "test" << myrank << " sendreqsize " << sendreqsize << " KO" << endl
                << "=========================================================" << endl ;
      cout << strstream.str() << endl ;
      CPPUNIT_FAIL( strstream.str() ) ;
    }
    else {
      cout << "=========================================================" << endl
           << "test" << myrank << " sendreqsize " << sendreqsize << " OK" << endl
           << "=========================================================" << endl ;
    }
  }
  else {
    int recvrequests[maxreq] ;
    int recvreqsize = mpi_access.sendRequestIds( target , maxreq , recvrequests ) ;
    if ( recvreqsize != 0 ) {
      ostringstream strstream ;
      strstream << "=========================================================" << endl
                << "test" << myrank << " recvreqsize " << recvreqsize << " KO" << endl
                << "=========================================================" << endl ;
      cout << strstream.str() << endl ;
      CPPUNIT_FAIL( strstream.str() ) ;
    }
    else {
      cout << "=========================================================" << endl
           << "test" << myrank << " recvreqsize " << recvreqsize << " OK" << endl
           << "=========================================================" << endl ;
    }
  }

  mpi_access.barrier() ;

  delete group ;

  //  MPI_Finalize();

  cout << "test" << myrank << " OK" << endl ;

  return ;
}

Here is the call graph for this function:

Definition at line 43 of file test_MPI_Access_ISend_IRecv_Length_1.cxx.

                                                         {

  //  MPI_Init(&argc, &argv) ; 

  int size ;
  int myrank ;
  MPI_Comm_size(MPI_COMM_WORLD,&size) ;
  MPI_Comm_rank(MPI_COMM_WORLD,&myrank) ;

  if ( size < 2 ) {
    ostringstream strstream ;
    strstream << "test_MPI_Access_ISend_IRecv_Length_1 must be runned with 2 procs" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }

  cout << "test_MPI_Access_ISend_IRecv_Length_1" << myrank << endl ;

  ParaMEDMEM::CommInterface interface ;

  ParaMEDMEM::MPIProcessorGroup* group = new ParaMEDMEM::MPIProcessorGroup(interface) ;

  ParaMEDMEM::MPIAccess mpi_access( group ) ;

#define maxreq 10

  if ( myrank >= 2 ) {
    mpi_access.barrier() ;
    delete group ;
    return ;
  }

  int target = 1 - myrank ;
  int SendRequestId[maxreq] ;
  int RecvRequestId[maxreq] ;
  int sts ;
  int sendbuf[1000*(maxreq-1)] ;
  int recvbuf[maxreq-1][1000*(maxreq-1)] ;
  int maxirecv = 1 ;
  int i ;
  RecvRequestId[0] = -1 ;
  for ( i = 0 ; i < 1000*(maxreq-1) ; i++ ) {
    sendbuf[i] = i ;
  }
  for ( i = 0 ; i < maxreq ; i++ ) {
    sts = MPI_SUCCESS ;
    if ( myrank == 0 ) {
      sts = mpi_access.ISend( sendbuf, 1000*i, MPI_INT, target, SendRequestId[i] ) ;
      cout << "test" << myrank << " ISend RequestId " << SendRequestId[i]
           << " tag " << mpi_access.sendMPITag(target) << endl ;
    }
    int j ;
    for (j = 1 ; j <= i ; j++) {
      int source ;
      MPI_Datatype datatype ;
      int outcount ;
      int flag ;
      if ( myrank == 0 ) {
        mpi_access.test( SendRequestId[j], flag ) ;
      }
      else {
        int MPITag ;
        sts = mpi_access.IProbe( target , source, MPITag, datatype,
                                 outcount, flag) ;
        char msgerr[MPI_MAX_ERROR_STRING] ;
        int lenerr ;
        mpi_access.errorString(sts, msgerr, &lenerr) ;
        cout << "test" << myrank << " IProbe lenerr " << lenerr << " "
             << msgerr << endl ;
        if ( sts != MPI_SUCCESS ) {
          ostringstream strstream ;
          strstream << "==========================================================="
                    << "test" << myrank << " IProbe KO"
                    << "==========================================================="
                    << endl ;
          cout << strstream.str() << endl ;
          CPPUNIT_FAIL( strstream.str() ) ;
        }
        cout << "test" << myrank << " IProbe i/j " << i << "/" << j
             << " MPITag " << MPITag << " datatype " << datatype
             << " outcount " << outcount << " flag " << flag << endl ;
      }
      if ( flag ) {
        if ( myrank == 0 ) {
          int target, tag, error, outcount ;
          mpi_access.status( SendRequestId[j], target, tag, error, outcount,
                             true ) ;
          cout << "test" << myrank << " Test(Send RequestId " << SendRequestId[j]
               << ") : target " << target << " tag " << tag << " error " << error
               << " flag " << flag << endl ;
        }
        else {
          sts = mpi_access.IRecv( recvbuf[maxirecv], outcount, datatype, source,
                                  RecvRequestId[maxirecv] ) ;
          cout << "test" << myrank << " maxirecv " << maxirecv << " IRecv RequestId "
               << RecvRequestId[maxirecv] << " source " << source
               << " outcount " << outcount << " tag "
               << mpi_access.recvMPITag(target) << endl ;
          maxirecv = maxirecv + 1 ;
        }
      }
      else if ( myrank == 1 && i == maxreq-1 && j >= maxirecv ) {
        sts = mpi_access.IRecv( recvbuf[j], 1000*j, MPI_INT, target,
                                RecvRequestId[j] ) ;
        cout << "test" << myrank << " maxirecv " << maxirecv << " IRecv RequestId "
             << RecvRequestId[j] << " target " << target << " length " << 1000*j
             << " tag " << mpi_access.recvMPITag(target) << endl ;
        maxirecv = maxirecv + 1 ;
      }
    }
    char msgerr[MPI_MAX_ERROR_STRING] ;
    int lenerr ;
    mpi_access.errorString(sts, msgerr, &lenerr) ;
    cout << "test" << myrank << " lenerr " << lenerr << " "
         << msgerr << endl ;

    if ( sts != MPI_SUCCESS ) {
      ostringstream strstream ;
      strstream << "==========================================================="
                << endl << "test" << myrank << " KO" << endl 
                << "==========================================================="
                << endl ;
      cout << strstream.str() << endl ;
      CPPUNIT_FAIL( strstream.str() ) ;
    }
  }

  mpi_access.check() ;
  int flag ;
  if ( myrank == 0 ) {
    mpi_access.testAll( maxreq, SendRequestId, flag ) ;
    cout << "test" << myrank << " TestAll SendRequest flag " << flag << endl ;
  }
  else {
    int i ;
    int source ;
    int outcount ;
    int flag ;
    if ( maxirecv != maxreq ) {
      ostringstream strstream ;
      strstream << "==========================================================="
                << endl << "test" << myrank << " KO" << " maxirecv " << maxirecv
                << " != maxreq " << maxreq << endl 
                << "==========================================================="
                << endl ;
      cout << strstream.str() << endl ;
      CPPUNIT_FAIL( strstream.str() ) ;
    }
    while ( maxirecv > 0 ) {
      for ( i = 1 ; i < maxreq ; i++ ) {
        cout << "test" << myrank << " IProbe : " << endl ;
        sts = mpi_access.test( RecvRequestId[i] , flag ) ;
        char msgerr[MPI_MAX_ERROR_STRING] ;
        int lenerr ;
        mpi_access.errorString(sts, msgerr, &lenerr) ;
        cout << "test" << myrank << " flag " << flag << " lenerr "
             << lenerr << " " << msgerr << " maxirecv " << maxirecv << endl ;
        if ( sts != MPI_SUCCESS ) {
          ostringstream strstream ;
          strstream << "==========================================================="
                    << "test" << myrank << " KO"
                    << "==========================================================="
                    << endl ;
          cout << strstream.str() << endl ;
          CPPUNIT_FAIL( strstream.str() ) ;
        }
        cout << "test" << myrank << " Test flag " << flag << endl ;
        if ( flag ) {
          int tag, error ;
          mpi_access.status( RecvRequestId[i] , source , tag , error ,
                             outcount ) ;
          if ( i != 0 ) {
            if ( outcount != 1000*i |
                 (recvbuf[i][outcount-1] != (outcount-1)) ) {
              ostringstream strstream ;
              strstream << "========================================================"
                        << endl << "test" << myrank << " outcount " << outcount
                        << " KO" << " i " << i
                        << " recvbuf " << recvbuf[i][outcount-1] << endl
                        << "========================================================"
                        << endl ;
              cout << strstream.str() << endl ;
              CPPUNIT_FAIL( strstream.str() ) ;
            }
          }
          else if ( outcount != 0 ) {
            ostringstream strstream ;
            strstream << "========================================================"
                      << endl << "test" << myrank << " outcount " << outcount
                      << " KO" << " i " << i << endl
                      << "========================================================"
                      << endl ;
            cout << strstream.str() << endl ;
            CPPUNIT_FAIL( strstream.str() ) ;
          }
          maxirecv = maxirecv - 1 ;
        }
      }
    }
    mpi_access.testAll( maxreq, RecvRequestId, flag ) ;
    cout << "test" << myrank << " TestAll RecvRequest flag " << flag << endl ;
  }
  mpi_access.check() ;
  cout << "test" << myrank << " WaitAll :" << endl ;
  if ( myrank == 0 ) {
    mpi_access.waitAll( maxreq, SendRequestId ) ;
    mpi_access.deleteRequests( maxreq, SendRequestId ) ;
  }
  else {
    mpi_access.waitAll( maxreq, RecvRequestId ) ;
    mpi_access.deleteRequests( maxreq, RecvRequestId ) ;
  }

  if ( myrank == 0 ) {
    int sendrequests[maxreq] ;
    int sendreqsize = mpi_access.sendRequestIds( target , maxreq , sendrequests ) ;
    sendreqsize = mpi_access.sendRequestIds( target , maxreq , sendrequests ) ;
    if ( sendreqsize != 0 ) {
      ostringstream strstream ;
      strstream << "=========================================================" << endl
                << "test" << myrank << " sendreqsize " << sendreqsize << " KO" << endl
                << "=========================================================" << endl ;
      cout << strstream.str() << endl ;
      CPPUNIT_FAIL( strstream.str() ) ;
    }
    else {
      cout << "=========================================================" << endl
           << "test" << myrank << " sendreqsize " << sendreqsize << " OK" << endl
           << "=========================================================" << endl ;
    }
  }
  else {
    int recvrequests[maxreq] ;
    int recvreqsize = mpi_access.sendRequestIds( target , maxreq , recvrequests ) ;
    if ( recvreqsize != 0 ) {
      ostringstream strstream ;
      strstream << "=========================================================" << endl
                << "test" << myrank << " recvreqsize " << recvreqsize << " KO" << endl
                << "=========================================================" << endl ;
      cout << strstream.str() << endl ;
      CPPUNIT_FAIL( strstream.str() ) ;
    }
    else {
      cout << "=========================================================" << endl
           << "test" << myrank << " recvreqsize " << recvreqsize << " OK" << endl
           << "=========================================================" << endl ;
    }
  }

  mpi_access.barrier() ;

  delete group ;

  //  MPI_Finalize();

  cout << "test" << myrank << " OK" << endl ;

  return ;
}

Here is the call graph for this function:

Definition at line 43 of file test_MPI_Access_ISendRecv.cxx.

                                              {

  cout << "test_MPI_Access_ISendRecv" << endl ;

//  MPI_Init(&argc, &argv) ; 

  int size ;
  int myrank ;
  MPI_Comm_size(MPI_COMM_WORLD,&size) ;
  MPI_Comm_rank(MPI_COMM_WORLD,&myrank) ;

  if ( size < 2 ) {
    cout << "test_MPI_Access_ISendRecv must be runned with 2 procs" << endl ;
    CPPUNIT_FAIL("test_MPI_Access_ISendRecv must be runned with 2 procs") ;
  }

  cout << "test_MPI_Access_ISendRecv" << myrank << endl ;

  ParaMEDMEM::CommInterface interface ;

  ParaMEDMEM::MPIProcessorGroup* group = new ParaMEDMEM::MPIProcessorGroup(interface) ;

  ParaMEDMEM::MPIAccess mpi_access( group ) ;

  if ( myrank >= 2 ) {
    mpi_access.barrier() ;
    delete group ;
    return ;
  }

  int target = 1 - myrank ;
  int SendRequestId[10] ;
  int RecvRequestId[10] ;
  int sendbuf[10] ;
  int recvbuf[10] ;
  int sts ;
  int i ;
  for ( i = 0 ; i < 10 ; i++ ) {
     sendbuf[i] = i ;
     sts = mpi_access.ISendRecv(&sendbuf[i],1,MPI_INT,target, SendRequestId[i],
                                &recvbuf[i],1,MPI_INT,target, RecvRequestId[i]) ;
     cout << "test" << myrank << " Send sendRequestId " << SendRequestId[i]
          << " tag " << mpi_access.sendMPITag(target)
          << " recvRequestId " << RecvRequestId[i]
          << " tag " << mpi_access.recvMPITag(target) << endl ;
     char msgerr[MPI_MAX_ERROR_STRING] ;
     int lenerr ;
     mpi_access.errorString(sts, msgerr, &lenerr) ;
     cout << "test" << myrank << " lenerr " << lenerr
          << " " << msgerr << endl ;

     if ( sts != MPI_SUCCESS ) {
       ostringstream strstream ;
       strstream << "==========================================================="
                 << "test" << myrank << " KO"
                 << "==========================================================="
                 << endl ;
       cout << strstream.str() << endl ;
       CPPUNIT_FAIL( strstream.str() ) ;
     }
     int j ;
     for (j = 0 ; j <= i ; j++) {
        int flag ;
        if ( j < i ) {
          cout << "test" << myrank << " " << j << " -> Test-Send("<< SendRequestId[j]
               << ")" << endl ;
          mpi_access.test( SendRequestId[j], flag ) ;
          if ( flag ) {
            int target, tag, error, outcount ;
              mpi_access.status( SendRequestId[j], target, tag, error, outcount,
                                 true ) ;
              cout << "test" << myrank << " Send RequestId " << SendRequestId[j]
                   << " target " << target << " tag " << tag << " error " << error
                   << endl ;
            mpi_access.deleteRequest( SendRequestId[j] ) ;
          }
        }
        cout << "test" << myrank << " " << j << " -> Test-Recv("<< SendRequestId[j]
             << ")" << endl ;
        mpi_access.test( RecvRequestId[j], flag ) ;
        if ( flag ) {
          int source, tag, error, outcount ;
          mpi_access.status( RecvRequestId[j], source, tag, error, outcount,
                             true ) ;
          cout << "test" << myrank << " Recv RequestId" << j << " "
               << RecvRequestId[j] << " source " << source << " tag " << tag
               << " error " << error << " outcount " << outcount << endl ;
          if ( (outcount != 1) | (recvbuf[j] != j) ) {
             ostringstream strstream ;
             strstream << "==========================================================="
                       << "test" << myrank << " outcount "
                       << outcount << " recvbuf[ " << j << " ] " << recvbuf[j] << " KO"
                       << "==========================================================="
                       << endl ;
            cout << strstream.str() << endl ;
            CPPUNIT_FAIL( strstream.str() ) ;
          }
        }
     }
     mpi_access.errorString(sts, msgerr, &lenerr) ;
     cout << "test" << myrank << " lenerr " << lenerr << " "
          << msgerr << endl ;
     mpi_access.check() ;
  }

  int flag ;
  mpi_access.testAll(10,SendRequestId,flag) ;
  mpi_access.waitAll(10,SendRequestId) ;
  mpi_access.deleteRequests(10,SendRequestId) ;
  mpi_access.testAll(10,SendRequestId,flag) ;
  if ( !flag ) {
    ostringstream strstream ;
    strstream << "test" << myrank << " flag " << flag << " KO" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }

  mpi_access.testAll(10,RecvRequestId,flag) ;
  mpi_access.waitAll(10,RecvRequestId) ;
  mpi_access.deleteRequests(10,RecvRequestId) ;
  mpi_access.testAll(10,RecvRequestId,flag) ;
  if ( !flag ) {
    ostringstream strstream ;
    strstream << "test" << myrank << " flag " << flag << " KO" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }
  mpi_access.check() ;

  int sendrequests[10] ;
  int sendreqsize = mpi_access.sendRequestIds( target , 10 , sendrequests ) ;
  if ( sendreqsize != 0 ) {
    ostringstream strstream ;
    strstream << "=========================================================" << endl
              << "test" << myrank << " sendreqsize " << sendreqsize << " KO" << endl
              << "=========================================================" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }
  else {
    cout << "=========================================================" << endl
         << "test" << myrank << " sendreqsize " << sendreqsize << " OK" << endl
         << "=========================================================" << endl ;
  }
  int recvrequests[10] ;
  int recvreqsize = mpi_access.sendRequestIds( target , 10 , recvrequests ) ;
  if ( recvreqsize != 0 ) {
    ostringstream strstream ;
    strstream << "=========================================================" << endl
              << "test" << myrank << " recvreqsize " << recvreqsize << " KO" << endl
              << "=========================================================" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }
  else {
    cout << "=========================================================" << endl
         << "test" << myrank << " recvreqsize " << recvreqsize << " OK" << endl
         << "=========================================================" << endl ;
  }

  mpi_access.barrier() ;

  delete group ;

//  MPI_Finalize();

  cout << "test" << myrank << " OK" << endl ;

  return ;
}

Here is the call graph for this function:

Definition at line 43 of file test_MPI_Access_Probe.cxx.

                                          {

  cout << "test_MPI_Access_Probe" << endl ;

//  MPI_Init(&argc, &argv) ; 

  int size ;
  int myrank ;
  MPI_Comm_size(MPI_COMM_WORLD,&size) ;
  MPI_Comm_rank(MPI_COMM_WORLD,&myrank) ;

  if ( size < 2 ) {
    cout << "test_MPI_Access_Probe must be runned with 2 procs" << endl ;
    CPPUNIT_FAIL("test_MPI_Access_Probe must be runned with 2 procs") ;
  }

  cout << "test_MPI_Access_Probe" << myrank << endl ;

  ParaMEDMEM::CommInterface interface ;

  ParaMEDMEM::MPIProcessorGroup* group = new ParaMEDMEM::MPIProcessorGroup(interface) ;

  ParaMEDMEM::MPIAccess mpi_access( group ) ;

  if ( myrank >= 2 ) {
    mpi_access.barrier() ;
    delete group ;
    return ;
  }

  int target = 1 - myrank ;
  int RequestId[10] ;
  int sts ;
  int i ;
  for ( i = 0 ; i < 10 ; i++ ) {
     if ( myrank == 0 ) {
       sts = mpi_access.send(&i,1,MPI_INT,target, RequestId[i]) ;
       cout << "test" << myrank << " Send RequestId " << RequestId[i]
            << endl ;
     }
     else {
       int source, tag, outcount ;
       MPI_Datatype datatype ;
       sts = mpi_access.probe(target, source, tag, datatype, outcount ) ;
       cout << "test" << myrank << " Probe target " << target << " source " << source
            << " tag " << tag << " outcount " << outcount << endl ;
       int recvbuf ;
       sts = mpi_access.recv(&recvbuf,outcount,datatype,source, RequestId[i],
                             &outcount) ;
       if ( (outcount != 1) | (recvbuf != i) ) {
         ostringstream strstream ;
         strstream << "==========================================================="
                   << "test" << myrank << " outcount " << outcount
                   << " recvbuf " << recvbuf << " KO"
                   << "==========================================================="
                   << endl ;
         cout << strstream.str() << endl ;
         CPPUNIT_FAIL( strstream.str() ) ;
       }
     }
     char msgerr[MPI_MAX_ERROR_STRING] ;
     int lenerr ;
     mpi_access.errorString(sts, msgerr, &lenerr) ;
     cout << "test" << myrank << " lenerr " << lenerr << " "
          << msgerr << endl ;

     if ( sts != MPI_SUCCESS ) {
       ostringstream strstream ;
       strstream << "==========================================================="
                 << "test" << myrank << " KO"
                 << "==========================================================="
                 << endl ;
       cout << strstream.str() << endl ;
       CPPUNIT_FAIL( strstream.str() ) ;
     }
     mpi_access.check() ;
  }
  int flag ;
  mpi_access.testAll(10,RequestId,flag) ;
  if ( !flag ) {
    ostringstream strstream ;
    strstream << "test" << myrank << " flag " << flag << " KO" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }
  mpi_access.waitAll(10,RequestId) ;
  mpi_access.check() ;

  mpi_access.barrier() ;

  delete group ;

//  MPI_Finalize();

  cout << "test" << myrank << " OK" << endl ;

  return ;
}

Here is the call graph for this function:

Definition at line 43 of file test_MPI_Access_Send_Recv.cxx.

                                              {

  cout << "test_MPI_Access_Send_Recv" << endl ;

  int size ;
  int myrank ;
  MPI_Comm_size(MPI_COMM_WORLD,&size) ;
  MPI_Comm_rank(MPI_COMM_WORLD,&myrank) ;

  if ( size < 2 ) {
    cout << "test_MPI_Access_Send_Recv must be runned with 2 procs" << endl ;
    CPPUNIT_FAIL("test_MPI_Access_Send_Recv must be runned with 2 procs") ;
  }

  cout << "test_MPI_Access_Send_Recv" << myrank << endl ;

  ParaMEDMEM::CommInterface interface ;

  ParaMEDMEM::MPIProcessorGroup* group = new ParaMEDMEM::MPIProcessorGroup(interface) ;

  ParaMEDMEM::MPIAccess mpi_access( group ) ;

  if ( myrank >= 2 ) {
    mpi_access.barrier() ;
    delete group ;
    return ;
  }

  int target = 1 - myrank ;
  int RequestId[10] ;
  int sts ;
  int i ;
  for ( i = 0 ; i < 10 ; i++ ) {
     if ( myrank == 0 ) {
       sts = mpi_access.send(&i,1,MPI_INT,target, RequestId[i]) ;
       cout << "test" << myrank << " Send RequestId " << RequestId[i]
            << " tag " << mpi_access.sendMPITag(target) << endl ;
     }
     else {
       int recvbuf ;
       int outcount ;
       sts = mpi_access.recv(&recvbuf,1,MPI_INT,target, RequestId[i],&outcount) ;
       //int source, tag, error, outcount ;
       //mpi_access.Status( RequestId[i], source, tag, error, outcount, true) ;
       cout << "test" << myrank << " Recv RequestId " << RequestId[i]
            << " tag " << mpi_access.recvMPITag(target)
            << " outcount " << outcount << endl ;
       if ( (outcount != 1) | (recvbuf != i) ) {
         ostringstream strstream ;
         strstream << "==========================================================="
                   << "test" << myrank << " outcount " << outcount
                   << " recvbuf " << recvbuf << " KO"
                   << "==========================================================="
                   << endl ;
         cout << strstream.str() << endl ;
         CPPUNIT_FAIL( strstream.str() ) ;
       }
     }
     char msgerr[MPI_MAX_ERROR_STRING] ;
     int lenerr ;
     mpi_access.errorString(sts, msgerr, &lenerr) ;
     cout << "test" << myrank << " lenerr " << lenerr << " "
          << msgerr << endl ;

     if ( sts != MPI_SUCCESS ) {
       ostringstream strstream ;
       strstream << "==========================================================="
                 << "test" << myrank << " KO"
                 << "==========================================================="
                 << endl ;
       CPPUNIT_FAIL( strstream.str() ) ;
     }
     mpi_access.check() ;
  }
  int flag ;
  mpi_access.testAll(10,RequestId,flag) ;
  if ( !flag ) {
    ostringstream strstream ;
    strstream << "test" << myrank << " flag " << flag << " KO" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }
  mpi_access.waitAll(10,RequestId) ;
  mpi_access.check() ;

  if ( myrank == 0 ) {
    int sendrequests[10] ;
    int sendreqsize = mpi_access.sendRequestIds( target , 10 , sendrequests ) ;
    if ( sendreqsize != 0 ) {
      ostringstream strstream ;
      strstream << "=========================================================" << endl
                << "test" << myrank << " sendreqsize " << sendreqsize << " KO" << endl
                << "=========================================================" << endl ;
      cout << strstream.str() << endl ;
      CPPUNIT_FAIL( strstream.str() ) ;
    }
  }
  else {
    int recvrequests[10] ;
    int recvreqsize = mpi_access.sendRequestIds( target , 10 , recvrequests ) ;
    if ( recvreqsize != 0 ) {
      ostringstream strstream ;
      strstream << "=========================================================" << endl
                << "test" << myrank << " recvreqsize " << recvreqsize << " KO" << endl
                << "=========================================================" << endl ;
      cout << strstream.str() << endl ;
      CPPUNIT_FAIL( strstream.str() ) ;
    }
  }

  mpi_access.barrier() ;

  delete group ;

//  MPI_Finalize();

  cout << "test" << myrank << " OK" << endl ;

  return ;
}

Here is the call graph for this function:

Definition at line 43 of file test_MPI_Access_Send_Recv_Length.cxx.

                                                     {

  cout << "test_MPI_Access_Send_Recv_Length" << endl ;

//  MPI_Init(&argc, &argv) ; 

  int size ;
  int myrank ;
  MPI_Comm_size(MPI_COMM_WORLD,&size) ;
  MPI_Comm_rank(MPI_COMM_WORLD,&myrank) ;

  if ( size < 2 ) {
    ostringstream strstream ;
    strstream << "test_MPI_Access_Send_Recv_Length must be runned with 2 procs" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }

  cout << "test_MPI_Access_Send_Recv_Length" << myrank << endl ;

  ParaMEDMEM::CommInterface interface ;

  ParaMEDMEM::MPIProcessorGroup* group = new ParaMEDMEM::MPIProcessorGroup(interface) ;

  ParaMEDMEM::MPIAccess mpi_access( group ) ;

  if ( myrank >= 2 ) {
    mpi_access.barrier() ;
    delete group ;
    return ;
  }

  int target = 1 - myrank ;
  int RequestId[10] ;
  int sendbuf[9000] ;
  int recvbuf[9000] ;
  bool recvbufok ;
  int sts ;
  int i , j ;
  for ( i = 0 ; i < 9000 ; i++ ) {
     sendbuf[i] = i ;
  }
  for ( i = 0 ; i < 10 ; i++ ) {
     if ( myrank == 0 ) {
       sts = mpi_access.send( sendbuf, 1000*i, MPI_INT, target, RequestId[i] ) ;
       cout << "test" << myrank << " Send RequestId " << RequestId[i]
            << " tag " << mpi_access.sendMPITag(target) << endl ;
     }
     else {
       sts = MPI_SUCCESS ;
       RequestId[i] = -1 ;
       int outcount = 0 ;
       if ( i != 0 ) {
         sts = mpi_access.recv( recvbuf,1000*i+1,MPI_INT,target, RequestId[i],
                                &outcount ) ;
       }
       //int source, tag, error, outcount ;
       //mpi_access.Status( RequestId[i], source, tag, error, outcount, true) ;
       cout << "test" << myrank << " Recv RequestId " << RequestId[i]
            << " tag " << mpi_access.recvMPITag(target)
            << " outcount " << outcount << endl ;
       recvbufok = true ;
       for ( j = 0 ; j < outcount ; j++ ) {
          if ( recvbuf[j] != j ) {
            cout << "test" << myrank << " recvbuf[ " << j << " ] = " << recvbuf[j]
                 << endl ;
            recvbufok = false ;
            break ;
          }
       }
       if ( (outcount != 1000*i) | !recvbufok ) {
         ostringstream strstream ;
         strstream << "==========================================================="
                   << endl << "test" << myrank << " outcount " << outcount
                   << " recvbuf " << recvbuf << " KO"
                   << "==========================================================="
                   << endl ;
         cout << strstream.str() << endl ;
         CPPUNIT_FAIL( strstream.str() ) ;
       }
     }
     char msgerr[MPI_MAX_ERROR_STRING] ;
     int lenerr ;
     mpi_access.errorString(sts, msgerr, &lenerr) ;
     cout << "test" << myrank << " lenerr " << lenerr << " "
          << msgerr << endl ;

     if ( sts != MPI_SUCCESS ) {
       ostringstream strstream ;
       strstream << "==========================================================="
                 << "test" << myrank << " KO"
                 << "==========================================================="
                 << endl ;
       cout << strstream.str() << endl ;
       CPPUNIT_FAIL( strstream.str() ) ;
     }
     mpi_access.check() ;
  }
  int flag ;
  mpi_access.testAll(10,RequestId,flag) ;
  if ( !flag ) {
    ostringstream strstream ;
    strstream << "test" << myrank << " flag " << flag << " KO" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }
  mpi_access.waitAll(10,RequestId) ;
  mpi_access.check() ;

  if ( myrank == 0 ) {
    int sendrequests[10] ;
    int sendreqsize = mpi_access.sendRequestIds( target , 10 , sendrequests ) ;
    if ( sendreqsize != 0 ) {
      ostringstream strstream ;
      strstream << "=========================================================" << endl
                << "test" << myrank << " sendreqsize " << sendreqsize << " KO" << endl
                << "=========================================================" << endl ;
      cout << strstream.str() << endl ;
      CPPUNIT_FAIL( strstream.str() ) ;
    }
  }
  else {
    int recvrequests[10] ;
    int recvreqsize = mpi_access.sendRequestIds( target , 10 , recvrequests ) ;
    if ( recvreqsize != 0 ) {
      ostringstream strstream ;
      strstream << "=========================================================" << endl
                << "test" << myrank << " recvreqsize " << recvreqsize << " KO" << endl
                << "=========================================================" << endl ;
      cout << strstream.str() << endl ;
      CPPUNIT_FAIL( strstream.str() ) ;
    }
  }

  mpi_access.barrier() ;

  delete group ;

//  MPI_Finalize();

  cout << "test" << myrank << " OK" << endl ;

  return ;
}

Here is the call graph for this function:

Definition at line 43 of file test_MPI_Access_SendRecv.cxx.

                                             {

  cout << "MPIAccessTest::test_MPI_Access_SendRecv" << endl ;

//  MPI_Init(&argc, &argv) ; 

  int size ;
  int myrank ;
  MPI_Comm_size(MPI_COMM_WORLD,&size) ;
  MPI_Comm_rank(MPI_COMM_WORLD,&myrank) ;

  if ( size < 2 ) {
    cout << "MPIAccessTest::test_MPI_Access_SendRecv must be runned with 2 procs" << endl ;
    CPPUNIT_FAIL("test_MPI_Access_SendRecv must be runned with 2 procs") ;
  }

  cout << "MPIAccessTest::test_MPI_Access_SendRecv" << myrank << endl ;

  ParaMEDMEM::CommInterface interface ;

  ParaMEDMEM::MPIProcessorGroup* group = new ParaMEDMEM::MPIProcessorGroup(interface) ;

  ParaMEDMEM::MPIAccess mpi_access( group ) ;

  if ( myrank >= 2 ) {
    mpi_access.barrier() ;
    delete group ;
    return ;
  }

  int target = 1 - myrank ;
  int sendRequestId[10] ;
  int recvRequestId[10] ;
  int sts ;
  int i ;
  for ( i = 0 ; i < 10 ; i++ ) {
     int recvbuf ;
     int outcount ;
     if ( i & 1 ) {
       outcount = -1 ;
       sts = mpi_access.sendRecv(&i,1,MPI_INT,target, sendRequestId[i],
                                 &recvbuf,1,MPI_INT,target, recvRequestId[i],
                                 &outcount) ;
     }
     else {
       sts = mpi_access.sendRecv(&i,1,MPI_INT,target, sendRequestId[i],
                                 &recvbuf,1,MPI_INT,target, recvRequestId[i]) ;
//       outcount = mpi_access.MPIOutCount( recvRequestId[i] ) ;
       outcount = 1 ;
     }
     cout << "test" << myrank << " Send sendRequestId " << sendRequestId[i]
          << " tag " << mpi_access.sendMPITag(target)
          << " recvRequestId " << recvRequestId[i]
          << " tag " << mpi_access.recvMPITag(target)
          << " outcount " << outcount << " MPIOutCount "
          << mpi_access.MPIOutCount( recvRequestId[i] ) << endl ;
     if ( (outcount != 1) | (recvbuf != i) ) {
       ostringstream strstream ;
       strstream << "==========================================================="
                 << "test" << myrank << " outcount " << outcount
                 << " recvbuf " << recvbuf << " KO"
                 << "==========================================================="
                 << endl ;
       cout << strstream.str() << endl ;
       CPPUNIT_FAIL( strstream.str() ) ;
     }
     char msgerr[MPI_MAX_ERROR_STRING] ;
     int lenerr ;
     mpi_access.errorString(sts, msgerr, &lenerr) ;
     cout << "test" << myrank << " lenerr " << lenerr << " "
          << msgerr << endl ;

     if ( sts != MPI_SUCCESS ) {
       ostringstream strstream ;
       strstream << "==========================================================="
                 << "test" << myrank << " KO"
                 << "==========================================================="
                 << endl ;
       cout << strstream.str() << endl ;
       CPPUNIT_FAIL( strstream.str() ) ;
     }
     mpi_access.check() ;
  }

  int flag ;
  mpi_access.testAll(10,sendRequestId,flag) ;
  if ( !flag ) {
    ostringstream strstream ;
    strstream << "test" << myrank << " flag " << flag << " KO" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }
  mpi_access.waitAll(10,sendRequestId) ;
  mpi_access.testAll(10,recvRequestId,flag) ;
  if ( !flag ) {
    ostringstream strstream ;
    strstream << "test" << myrank << " flag " << flag << " KO" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }
  mpi_access.waitAll(10,recvRequestId) ;
  mpi_access.check() ;

  int sendrequests[10] ;
  int sendreqsize = mpi_access.sendRequestIds( target , 10 , sendrequests ) ;
  if ( sendreqsize != 0 ) {
    ostringstream strstream ;
    strstream << "=========================================================" << endl
              << "test" << myrank << " sendreqsize " << sendreqsize << " KO" << endl
              << "=========================================================" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }
  int recvrequests[10] ;
  int recvreqsize = mpi_access.sendRequestIds( target , 10 , recvrequests ) ;
  if ( recvreqsize != 0 ) {
    ostringstream strstream ;
    strstream << "=========================================================" << endl
              << "test" << myrank << " recvreqsize " << recvreqsize << " KO" << endl
              << "=========================================================" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }

  mpi_access.barrier() ;

  delete group ;

//  MPI_Finalize();

  cout << "test" << myrank << " OK" << endl ;

  return ;
}

Here is the call graph for this function:

Definition at line 43 of file test_MPI_Access_Time.cxx.

                                         {

  cout << "test_MPI_Access_Time" << endl ;

  //  MPI_Init(&argc, &argv) ; 

  int size ;
  int myrank ;
  MPI_Comm_size(MPI_COMM_WORLD,&size) ;
  MPI_Comm_rank(MPI_COMM_WORLD,&myrank) ;

  if ( size < 2 ) {
    ostringstream strstream ;
    strstream << "test_MPI_Access_Time must be runned with 2 procs" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }

  cout << "test_MPI_Access_Time" << myrank << endl ;

  ParaMEDMEM::CommInterface interface ;

  ParaMEDMEM::MPIProcessorGroup* group = new ParaMEDMEM::MPIProcessorGroup(interface) ;

  ParaMEDMEM::MPIAccess mpi_access( group ) ;

#define maxreq 10

  if ( myrank >= 2 ) {
    cout << "test_MPI_Access_Time_0 rank" << myrank << " --> mpi_access->Barrier" << endl ;
    mpi_access.barrier() ;
    cout << "test_MPI_Access_Time_0 rank" << myrank << " <-- mpi_access->Barrier" << endl ;
    delete group ;
    cout << "test_MPI_Access_Time" << myrank << " OK" << endl ;
    return ;
  }

  int target = 1 - myrank ;
  int SendTimeRequestId[maxreq] ;
  int RecvTimeRequestId[maxreq] ;
  int SendRequestId[maxreq] ;
  int RecvRequestId[maxreq] ;
  int sts ;
  int sendbuf[maxreq] ;
  int recvbuf[maxreq] ;
  int i = 0 ;
  ParaMEDMEM::TimeMessage aSendTimeMsg[maxreq] ;
  ParaMEDMEM::TimeMessage aRecvTimeMsg[maxreq] ;
  double t ;
  double dt = 1. ;
  double maxt = 10. ;
  for ( t = 0 ; t < maxt ; t = t+dt ) {
    if ( myrank == 0 ) {
      aSendTimeMsg[i].time = t ;
      aSendTimeMsg[i].deltatime = dt ;
      //aSendTimeMsg[i].maxtime = maxt ;
      //sts = mpi_access.ISend( &aSendTimeMsg , mpi_access.timeExtent() ,
      sts = mpi_access.ISend( &aSendTimeMsg[i] , 1 ,
                              mpi_access.timeType() , target ,
                              SendTimeRequestId[i]) ;
      cout << "test" << myrank << " ISend RequestId " << SendTimeRequestId[i]
           << " tag " << mpi_access.sendMPITag(target) << endl ;
      sendbuf[i] = i ;
      sts = mpi_access.ISend(&sendbuf[i],1,MPI_INT,target, SendRequestId[i]) ;
      cout << "test" << myrank << " ISend RequestId " << SendRequestId[i]
           << " tag " << mpi_access.sendMPITag(target) << endl ;
    }
    else {
      //sts = mpi_access.IRecv( &aRecvTimeMsg , mpi_access.timeExtent() ,
      sts = mpi_access.IRecv( &aRecvTimeMsg[i] , 1 ,
                              mpi_access.timeType() , target ,
                              RecvTimeRequestId[i]) ;
      cout << "test" << myrank << " IRecv RequestId " << RecvTimeRequestId[i]
           << " tag " << mpi_access.recvMPITag(target) << endl ;
      sts = mpi_access.IRecv(&recvbuf[i],1,MPI_INT,target, RecvRequestId[i]) ;
      cout << "test" << myrank << " IRecv RequestId " << RecvRequestId[i]
           << " tag " << mpi_access.recvMPITag(target) << endl ;
    }
    int j ;
    for (j = 0 ; j <= i ; j++) {
      int flag ;
      if ( myrank == 0 ) {
        mpi_access.test( SendTimeRequestId[j], flag ) ;
      }
      else {
        mpi_access.test( RecvTimeRequestId[j], flag ) ;
      }
      if ( flag ) {
        int target,source, tag, error, outcount ;
        if ( myrank == 0 ) {
          mpi_access.status( SendTimeRequestId[j], target, tag, error, outcount,
                             true ) ;
          cout << "test" << myrank << " Test(Send TimeRequestId " << SendTimeRequestId[j]
               << ") : target " << target << " tag " << tag << " error " << error
               << " flag " << flag << aSendTimeMsg[j] << endl ;
        }
        else {
          mpi_access.status( RecvTimeRequestId[j], source, tag, error, outcount,
                             true ) ;
          cout << "test" << myrank << " Test(Recv TimeRequestId "
               << RecvTimeRequestId[j] << ") : source " << source << " tag " << tag
               << " error " << error << " outcount " << outcount
               << " flag " << flag << aRecvTimeMsg[j] << endl ;
          if ( (outcount != 1) | (aRecvTimeMsg[j].time != j) ) {
            ostringstream strstream ;
            strstream << "==========================================================="
                      << endl << "test" << myrank << " outcount " << outcount << " KO"
                      << " RecvTimeRequestId " << RecvTimeRequestId[j] << endl
                      << "==========================================================="
                      << endl ;
            cout << strstream.str() << endl ;
            CPPUNIT_FAIL( strstream.str() ) ;
          }
          else {
            cout << "==========================================================="
                 << endl << "test" << myrank << " outcount " << outcount
                 << " RecvTimeRequestId " << RecvTimeRequestId[j] << " OK" << endl
                 << "==========================================================="
                 << endl ;
          }
        }
      }
      if ( myrank == 0 ) {
        mpi_access.test( SendRequestId[j], flag ) ;
      }
      else {
        mpi_access.test( RecvRequestId[j], flag ) ;
      }
      if ( flag ) {
        int target,source, tag, error, outcount ;
        if ( myrank == 0 ) {
          mpi_access.status( SendRequestId[j], target, tag, error, outcount,
                             true ) ;
          cout << "test" << myrank << " Test(Send RequestId " << SendRequestId[j]
               << ") : target " << target << " tag " << tag << " error " << error
               << " flag " << flag << endl ;
        }
        else {
          mpi_access.status( RecvRequestId[j], source, tag, error, outcount,
                             true ) ;
          cout << "test" << myrank << " Test(Recv RequestId "
               << RecvRequestId[j] << ") : source " << source << " tag " << tag
               << " error " << error << " outcount " << outcount
               << " flag " << flag << endl ;
          if ( (outcount != 1) | (recvbuf[j] != j) ) {
            ostringstream strstream ;
            strstream << "==========================================================="
                      << endl << "test" << myrank << " outcount "
                      << outcount << " recvbuf " << recvbuf[j] << " KO" << endl
                      << "==========================================================="
                      << endl ;
            cout << strstream.str() << endl ;
            CPPUNIT_FAIL( strstream.str() ) ;
          }
          else {
            cout << "==========================================================="
                 << endl << "test" << myrank << " outcount " << outcount
                 << " RequestId " << RecvRequestId[j] << " OK" << endl
                 << "==========================================================="
                 << endl ;
          }
        }
      }
    }
    char msgerr[MPI_MAX_ERROR_STRING] ;
    int lenerr ;
    mpi_access.errorString(sts, msgerr, &lenerr) ;
    cout << "test" << myrank << " lenerr " << lenerr << " "
         << msgerr << endl ;

    if ( sts != MPI_SUCCESS ) {
      ostringstream strstream ;
      strstream << "==========================================================="
                << "test" << myrank << " KO"
                << "==========================================================="
                << endl ;
      cout << strstream.str() << endl ;
      CPPUNIT_FAIL( strstream.str() ) ;
    }
    i = i + 1 ;
  }

  mpi_access.check() ;
  if ( myrank == 0 ) {
    mpi_access.waitAll(maxreq, SendTimeRequestId) ;
    mpi_access.deleteRequests(maxreq, SendTimeRequestId) ;
    mpi_access.waitAll(maxreq, SendRequestId) ;
    mpi_access.deleteRequests(maxreq, SendRequestId) ;
  }
  else {
    mpi_access.waitAll(maxreq, RecvTimeRequestId) ;
    mpi_access.deleteRequests(maxreq, RecvTimeRequestId) ;
    mpi_access.waitAll(maxreq, RecvRequestId) ;
    mpi_access.deleteRequests(maxreq, RecvRequestId) ;
  }
  mpi_access.check() ;

  if ( myrank == 0 ) {
    int sendrequests[2*maxreq] ;
    int sendreqsize = mpi_access.sendRequestIds( target , 2*maxreq , sendrequests ) ;
    if ( sendreqsize != 0 ) {
      ostringstream strstream ;
      strstream << "=========================================================" << endl
                << "test" << myrank << " sendreqsize " << sendreqsize << " KO" << endl
                << "=========================================================" << endl ;
      cout << strstream.str() << endl ;
      CPPUNIT_FAIL( strstream.str() ) ;
    }
    else {
      cout << "=========================================================" << endl
           << "test" << myrank << " sendreqsize " << sendreqsize << " OK" << endl
           << "=========================================================" << endl ;
    }
  }
  else {
    int recvrequests[2*maxreq] ;
    int recvreqsize = mpi_access.sendRequestIds( target , 2*maxreq , recvrequests ) ;
    if ( recvreqsize != 0 ) {
      ostringstream strstream ;
      strstream << "=========================================================" << endl
                << "test" << myrank << " recvreqsize " << recvreqsize << " KO" << endl
                << "=========================================================" << endl ;
      cout << strstream.str() << endl ;
      CPPUNIT_FAIL( strstream.str() ) ;
    }
    else {
      cout << "=========================================================" << endl
           << "test" << myrank << " recvreqsize " << recvreqsize << " OK" << endl
           << "=========================================================" << endl ;
    }
  }

  cout << "test_MPI_Access_Time_0 rank" << myrank << " --> mpi_access->Barrier" << endl ;
  mpi_access.barrier() ;
  cout << "test_MPI_Access_Time_0 rank" << myrank << " <-- mpi_access->Barrier" << endl ;

  delete group ;

  //  MPI_Finalize();

  cout << "test_MPI_Access_Time" << myrank << " OK" << endl ;

  return ;
}

Here is the call graph for this function:

Definition at line 61 of file test_MPI_Access_Time_0.cxx.

                                           {

  cout << "test_MPI_Access_Time_0" << endl ;

//  MPI_Init(&argc, &argv) ; 

  int size ;
  int myrank ;
  MPI_Comm_size(MPI_COMM_WORLD,&size) ;
  MPI_Comm_rank(MPI_COMM_WORLD,&myrank) ;

  if ( size < 2 ) {
    ostringstream strstream ;
    strstream << "usage :" << endl
              << "mpirun -np <nbprocs> test_MPI_Access_Time_0" <<endl
              << " nbprocs =2" << endl
              << "test must be runned with 2 procs" << endl ;
    cout << strstream.str() << endl ;
    CPPUNIT_FAIL( strstream.str() ) ;
  }

#define maxreq 100

  double t ;
  double dt[2] = {2., 1.} ;
  double maxt = maxreq/dt[myrank] ;

  cout << "test_MPI_Access_Time_0 rank" << myrank << endl ;

  ParaMEDMEM::CommInterface interface ;

  ParaMEDMEM::MPIProcessorGroup* group = new ParaMEDMEM::MPIProcessorGroup(interface) ;

  ParaMEDMEM::MPIAccess * mpi_access = new ParaMEDMEM::MPIAccess( group ) ;

  if ( myrank >= 2 ) {
    cout << "test_MPI_Access_Time_0 rank" << myrank << " --> mpi_access->barrier" << endl ;
    mpi_access->barrier() ;
    cout << "test_MPI_Access_Time_0 rank" << myrank << " <-- mpi_access->barrier" << endl ;
    cout << "test_MPI_Access_Time_0 rank" << myrank << " --> mpi_access->barrier" << endl ;
    mpi_access->barrier() ;
    cout << "test_MPI_Access_Time_0 rank" << myrank << " <-- mpi_access->barrier" << endl ;
    delete group ;
    delete mpi_access ;
    cout << "test_MPI_Access_Time" << myrank << " OK" << endl ;
    return ;
  }

  int target = 1 - myrank ;
  int SendTimeRequestId[maxreq] ;
  int RecvTimeRequestId[maxreq] ;
  int SendRequestId[maxreq] ;
  int RecvRequestId[maxreq] ;
  int sts ;
  int sendbuf[maxreq] ;
  int recvbuf[maxreq] ;
  ParaMEDMEM::TimeMessage aSendTimeMsg[maxreq] ;
  int lasttime = -1 ;
  ParaMEDMEM::TimeMessage RecvTimeMessages[maxreq+1] ;
  ParaMEDMEM::TimeMessage *aRecvTimeMsg = &RecvTimeMessages[1] ;
//  mpi_access->Trace() ;
  int istep = 0 ;
  for ( t = 0 ; t < maxt ; t = t+dt[myrank] ) {
     cout << "test" << myrank << " ==========================TIME " << t
          << " ==========================" << endl ;
     if ( myrank == 0 ) {
       aSendTimeMsg[istep].time = t ;
       aSendTimeMsg[istep].deltatime = dt[myrank] ;
       //aSendTimeMsg[istep].maxtime = maxt ;
       if ( t+dt[myrank] >= maxt ) {
         aSendTimeMsg[istep].deltatime = 0 ;
       }
       sts = mpi_access->ISend( &aSendTimeMsg[istep] , 1 ,
                               mpi_access->timeType() , target ,
                               SendTimeRequestId[istep]) ;
       cout << "test" << myrank << " ISend TimeRequestId " << SendTimeRequestId[istep]
            << " tag " << mpi_access->MPITag(SendTimeRequestId[istep]) << endl ;
       chksts( sts , myrank , mpi_access ) ;
       sendbuf[istep] = istep ;
       sts = mpi_access->ISend(&sendbuf[istep],1,MPI_INT,target, SendRequestId[istep]) ;
       cout << "test" << myrank << " ISend Data RequestId " << SendRequestId[istep]
            << " tag " << mpi_access->MPITag(SendRequestId[istep]) << endl ;
       chksts( sts , myrank , mpi_access ) ;
//CheckSent
//=========
       int sendrequests[2*maxreq] ;
       int sendreqsize = mpi_access->sendRequestIds( target , 2*maxreq ,
                                                    sendrequests ) ;
       int j , flag ;
       for ( j = 0 ; j < sendreqsize ; j++ ) {
          sts = mpi_access->test( sendrequests[j] , flag ) ;
          chksts( sts , myrank , mpi_access ) ;
          if ( flag ) {
            mpi_access->deleteRequest( sendrequests[j] ) ;
            cout << "test" << myrank << " " << j << ". " << sendrequests[j]
                 << " sendrequest deleted" << endl ;
          }
       }
     }
     else {
//InitRecv
//========
       if ( t == 0 ) {
         aRecvTimeMsg[lasttime].time = 0 ;
         sts = mpi_access->IRecv( &aRecvTimeMsg[lasttime+1] , 1 ,
                                 mpi_access->timeType() ,
                                 target , RecvTimeRequestId[lasttime+1]) ;
         cout << "test" << myrank << " t == 0 IRecv TimeRequestId "
              << RecvTimeRequestId[lasttime+1]
              << " MPITag " << mpi_access->MPITag( RecvTimeRequestId[lasttime+1] )
              << " MPICompleted "
              << mpi_access->MPICompleted( RecvTimeRequestId[lasttime+1] ) << endl ;
         chksts( sts , myrank , mpi_access ) ;
       }
       else {
         cout << "test" << myrank << " t # 0 lasttime " << lasttime << endl ;
//InitialOutTime
//==============
         bool outtime = false ;
         if ( lasttime != -1 ) {
           if ( t <= aRecvTimeMsg[lasttime-1].time ) {
             ostringstream strstream ;
             strstream << "==========================================================="
                       << endl << "test" << myrank << " t " << t << " <= "
                       << "aRecvTimeMsg[ " << lasttime << "-1 ].time "
                       << aRecvTimeMsg[lasttime-1].time << " KO" << endl
                       << "==========================================================="
                       << endl ;
             cout << strstream.str() << endl ;
             CPPUNIT_FAIL( strstream.str() ) ;
           }
           else {
             cout << "==========================================================="
                  << endl << "test" << myrank << " t " << t << " > "
                  << "aRecvTimeMsg[ " << lasttime << "-1 ].time "
                  << aRecvTimeMsg[lasttime-1].time << " OK" << endl
                  << "==========================================================="
                  << endl ;
           }
           //outtime = ((aRecvTimeMsg[lasttime].time +
           //            aRecvTimeMsg[lasttime].deltatime) >=
           //           aRecvTimeMsg[lasttime].maxtime) ;
           outtime = aRecvTimeMsg[lasttime].deltatime == 0 ;
         }
// CheckRecv - CheckTime
// On a lasttime tel que :
// aRecvTimeMsg[ lasttime-1 ].time < T(i-1) <= aRecvTimeMsg[ lasttime ].time
// On cherche lasttime tel que :
// aRecvTimeMsg[ lasttime-1 ].time < T(i) <= aRecvTimeMsg[ lasttime ].time
         if ( t <= aRecvTimeMsg[lasttime].time ) {
           outtime = false ;
         }
         cout << "test" << myrank << " while outtime( " << outtime << " && t " << t
              << " > aRecvTimeMsg[ " << lasttime << " ] "
              << aRecvTimeMsg[lasttime].time << " )" << endl ;
         while ( !outtime && (t > aRecvTimeMsg[lasttime].time) ) {
              lasttime += 1 ;
//TimeMessage
//===========
              sts = mpi_access->wait( RecvTimeRequestId[lasttime] ) ;
              chksts( sts , myrank , mpi_access ) ;
              cout << "test" << myrank << " Wait done RecvTimeRequestId "
                   << RecvTimeRequestId[lasttime] << " lasttime " << lasttime
                   << " tag " << mpi_access->MPITag(RecvTimeRequestId[lasttime])
                   << aRecvTimeMsg[lasttime] << endl ;
              if ( lasttime == 0 ) {
                aRecvTimeMsg[lasttime-1] = aRecvTimeMsg[lasttime] ;
              }
              mpi_access->deleteRequest( RecvTimeRequestId[lasttime] ) ;

              double deltatime = aRecvTimeMsg[lasttime].deltatime ;
              //double maxtime = aRecvTimeMsg[lasttime].maxtime ;
              double nexttime = aRecvTimeMsg[lasttime].time + deltatime ;
              cout << "test" << myrank << " t " << t << " lasttime " << lasttime
                   << " deltatime " << deltatime
                   << " nexttime " << nexttime << endl ;
              //if ( nexttime < maxtime && t > nexttime ) {
              if ( deltatime != 0 && t > nexttime ) {
//CheckRecv :
//=========   
                //while ( nexttime < maxtime && t > nexttime ) {
                while ( deltatime != 0 && t > nexttime ) {
                     int source, MPITag, outcount ;
                     MPI_Datatype datatype ;
                     sts = mpi_access->probe( target , source, MPITag, datatype,
                                             outcount ) ;
                     chksts( sts , myrank , mpi_access ) ;
// Cancel DataMessages jusqu'a un TimeMessage
                     int cancelflag ;
                     while ( !mpi_access->isTimeMessage( MPITag ) ) {
                          sts = mpi_access->cancel( source, MPITag, datatype, outcount ,
                          //sts = mpi_access->cancel( source, datatype, outcount ,
                                                   //RecvRequestId[lasttime] ,
                                                   cancelflag ) ;
                          cout << "test" << myrank << " Recv TO CANCEL RequestId "
                               << RecvRequestId[lasttime]
                               << " tag " << mpi_access->recvMPITag( target )
                               << " cancelflag " << cancelflag << endl ;
                          chksts( sts , myrank , mpi_access ) ;
                          sts = mpi_access->probe( target , source, MPITag, datatype,
                                                  outcount ) ;
                          chksts( sts , myrank , mpi_access ) ;
                     }
//On peut avancer en temps
                     nexttime += deltatime ;
                     //if ( nexttime < maxtime && t > nexttime ) {
                     if ( deltatime != 0 && t > nexttime ) {
// Cancel du TimeMessage
                       sts = mpi_access->cancel( source, MPITag, datatype, outcount ,
                       //sts = mpi_access->cancel( source, datatype, outcount ,
                                                //RecvRequestId[lasttime] ,
                                                cancelflag ) ;
                       cout << "test" << myrank << " Time TO CANCEL RequestId "
                            << RecvRequestId[lasttime]
                            << " tag " << mpi_access->recvMPITag( target )
                            << " cancelflag " << cancelflag << endl ;
                       chksts( sts , myrank , mpi_access ) ;
                     }
                }
              }
              else {
//DoRecv
//======
                cout << "test" << myrank << " Recv target " << target
                     << " lasttime " << lasttime
                     << " lasttime-1 " << aRecvTimeMsg[lasttime-1]
                     << " lasttime " << aRecvTimeMsg[lasttime]
                     << endl ;
                sts = mpi_access->recv(&recvbuf[lasttime],1,MPI_INT,target,
                                       RecvRequestId[lasttime]) ;
                cout << "test" << myrank << " Recv RequestId "
                     << RecvRequestId[lasttime]
                     << " tag " << mpi_access->recvMPITag( target )
                     << endl ;
                chksts( sts , myrank , mpi_access ) ;
              }
              //outtime = ((aRecvTimeMsg[lasttime].time +
              //            aRecvTimeMsg[lasttime].deltatime) >=
              //           aRecvTimeMsg[lasttime].maxtime) ;
              outtime = aRecvTimeMsg[lasttime].deltatime == 0 ;
              if ( !outtime ) {
// Une lecture asynchrone d'un message temps a l'avance
                sts = mpi_access->IRecv( &aRecvTimeMsg[lasttime+1] , 1 ,
                                        mpi_access->timeType() , target ,
                                        RecvTimeRequestId[lasttime+1]) ;
                cout << "test" << myrank << " IRecv TimeRequestId "
                     << RecvTimeRequestId[lasttime+1] << " MPITag "
                     << mpi_access->MPITag( RecvTimeRequestId[lasttime+1] )
                     << " MPICompleted "
                     << mpi_access->MPICompleted( RecvTimeRequestId[lasttime+1] )
                     << endl ;
                chksts( sts , myrank , mpi_access ) ;
              }
              else if ( t <= aRecvTimeMsg[lasttime].time ) {
                outtime = false ;
              }
         }
         
         //printf("DEBUG t %.15f Msg[lasttime-1] %.15f Msg[lasttime] %.15f \n",t,
         //       aRecvTimeMsg[lasttime-1].time,aRecvTimeMsg[lasttime].time) ;
         if ( ((t <= aRecvTimeMsg[lasttime-1].time) ||
               (t > aRecvTimeMsg[lasttime].time)) && !outtime ) {
           ostringstream strstream ;
           strstream << "==========================================================="
                     << endl << "test" << myrank << " t " << t << " <= "
                     << "aRecvTimeMsg[ " << lasttime << "-1 ].time "
                     << aRecvTimeMsg[lasttime-1].time << " ou t " << t << " > "
                     << "aRecvTimeMsg[ " << lasttime << " ].time "
                     << aRecvTimeMsg[lasttime].time << endl
                     << " ou bien outtime " << outtime << " KO RequestTimeIds "
                     << RecvTimeRequestId[lasttime-1] << " " << RecvTimeRequestId[lasttime]
                     << " RequestIds "
                     << RecvRequestId[lasttime-1] << " " << RecvRequestId[lasttime] << endl
                     << "==========================================================="
                     << endl ;
           cout << strstream.str() << endl ;
           CPPUNIT_FAIL( strstream.str() ) ;
         }
         else {
           cout << "==========================================================="
                << endl << "test" << myrank 
                << " aRecvTimeMsg[ " << lasttime << "-1 ].time "
                << aRecvTimeMsg[lasttime-1].time << " < t " << t << " <= "
                << "aRecvTimeMsg[ " << lasttime << " ].time "
                << aRecvTimeMsg[lasttime].time << endl
                << " ou bien outtime " << outtime << " OK RequestTimeIds "
                << RecvTimeRequestId[lasttime-1] << " " << RecvTimeRequestId[lasttime]
                << " RequestIds "
                << RecvRequestId[lasttime-1] << " " << RecvRequestId[lasttime] << endl
                << "==========================================================="
                << endl ;
         }
       }
     }
     chksts( sts , myrank , mpi_access ) ;
     istep = istep + 1 ;
  }

  cout << "test" << myrank << " Barrier :" << endl ;
  mpi_access->barrier() ;

  mpi_access->check() ;

  if ( myrank == 0 ) {
//CheckFinalSent
//==============
    cout << "test" << myrank << " CheckFinalSent :" << endl ;
    int sendrequests[2*maxreq] ;
    int sendreqsize = mpi_access->sendRequestIds( target , 2*maxreq , sendrequests ) ;
    int j ;
    for ( j = 0 ; j < sendreqsize ; j++ ) {
       sts = mpi_access->wait( sendrequests[j] ) ;
       chksts( sts , myrank , mpi_access ) ;
       mpi_access->deleteRequest( sendrequests[j] ) ;
       cout << "test" << myrank << " " << j << ". " << sendrequests[j] << " deleted"
            << endl ;
    }
  }
  else {
    cout << "test" << myrank << " CheckFinalRecv :" << endl ;
    int recvrequests[2*maxreq] ;
    int recvreqsize = mpi_access->recvRequestIds( target , 2*maxreq , recvrequests ) ;
    int cancelflag ;
    int j ;
    for ( j = 0 ; j < recvreqsize ; j++ ) {
       sts = mpi_access->cancel( recvrequests[j] , cancelflag ) ;
       chksts( sts , myrank , mpi_access ) ;
       mpi_access->deleteRequest( recvrequests[j] ) ;
       cout << "test" << myrank << " " << j << ". " << recvrequests[j] << " deleted"
            << " cancelflag " << cancelflag << endl ;
    }
    int source, MPITag, outcount , flag ;
    MPI_Datatype datatype ;
    sts = mpi_access->IProbe( target , source, MPITag, datatype,
                             outcount , flag ) ;
    chksts( sts , myrank , mpi_access ) ;
    while ( flag ) {
         sts = mpi_access->cancel( source, MPITag, datatype, outcount ,
         //sts = mpi_access->cancel( source, datatype, outcount ,
                                  //RecvRequestId[lasttime] ,
                                  cancelflag ) ;
         cout << "test" << myrank << " TO CANCEL RequestId "
              << RecvRequestId[lasttime]
              << " tag " << mpi_access->recvMPITag( target )
              << " cancelflag " << cancelflag << endl ;
         chksts( sts , myrank , mpi_access ) ;
         sts = mpi_access->IProbe( target , source, MPITag, datatype,
                                  outcount , flag ) ;
         chksts( sts , myrank , mpi_access ) ;
    }
  }
  mpi_access->check() ;

  if ( myrank == 0 ) {
    int sendrequests[2*maxreq] ;
    int sendreqsize = mpi_access->sendRequestIds( target , 2*maxreq , sendrequests ) ;
    if ( sendreqsize != 0 ) {
      ostringstream strstream ;
      strstream << "=========================================================" << endl
                << "test" << myrank << " sendreqsize " << sendreqsize << " KO" << endl
                << "=========================================================" << endl ;
      cout << strstream.str() << endl ;
      CPPUNIT_FAIL( strstream.str() ) ;
    }
    else {
      cout << "=========================================================" << endl
           << "test" << myrank << " sendreqsize " << sendreqsize << " OK" << endl
           << "=========================================================" << endl ;
    }
  }
  else {
    int recvrequests[2*maxreq] ;
    int recvreqsize = mpi_access->recvRequestIds( target , 2*maxreq , recvrequests ) ;
    if ( recvreqsize != 0 ) {
      ostringstream strstream ;
      strstream << "=========================================================" << endl
                << "test" << myrank << " recvreqsize " << recvreqsize << " KO" << endl
                << "=========================================================" << endl ;
      cout << strstream.str() << endl ;
      CPPUNIT_FAIL( strstream.str() ) ;
    }
    else {
      cout << "=========================================================" << endl
           << "test" << myrank << " recvreqsize " << recvreqsize << " OK" << endl
           << "=========================================================" << endl ;
    }
  }

  int i ;
  for ( i = 0 ; i <= lasttime ; i++ ) {
     cout << "test" << myrank << " " << i << ". RecvTimeMsg "
          << aRecvTimeMsg[i].time << " recvbuf " << recvbuf[i] << endl ;
  }

  cout << "test_MPI_Access_Time_0 rank" << myrank << " --> mpi_access->barrier" << endl ;
  mpi_access->barrier() ;
  cout << "test_MPI_Access_Time_0 rank" << myrank << " <-- mpi_access->barrier" << endl ;

  delete group ;
  delete mpi_access ;

//  MPI_Finalize();

  cout << "test" << myrank << " OK" << endl ;

  return ;
}

Here is the call graph for this function:


The documentation for this class was generated from the following files: