code: def testPersistent(self):
      size = self.COMM.Get_size()
      rank = self.COMM.Get_rank()
      dest = (rank + 1) % size
      source = (rank - 1) % size
      for array, typecode in arrayimpl.loop():
          with arrayimpl.test(self):
              if unittest.is_mpi_gpu("openmpi", array):
                  continue
              if unittest.is_mpi_gpu("mvapich2", array):
                  continue
              for s, xs in itertools.product(range(size + 1), range(3)):
                  with self.subTest(s=s, xs=xs):
                      #
                      sbuf = array(s, typecode, s)
                      rbuf = array(-1, typecode, s + xs)
                      sendreq = self.COMM.Send_init(
                          sbuf.as_mpi(), dest, 0
                      )
                      recvreq = self.COMM.Recv_init(
                          rbuf.as_mpi(), source, 0
                      )
                      sendreq.Start()
                      recvreq.Start()
                      sendreq.Wait()
                      recvreq.Wait()
                      self.assertNotEqual(sendreq, MPI.REQUEST_NULL)
                      self.assertNotEqual(recvreq, MPI.REQUEST_NULL)
                      sendreq.Free()
                      recvreq.Free()
                      self.assertEqual(sendreq, MPI.REQUEST_NULL)
                      self.assertEqual(recvreq, MPI.REQUEST_NULL)
                      check = arrayimpl.scalar(s)
                      for value in rbuf[:s]:
                          self.assertEqual(value, check)
                      check = arrayimpl.scalar(-1)
                      for value in rbuf[s:]:
                          self.assertEqual(value, check)
                      #
                      sbuf = array(s, typecode, s)
                      rbuf = array(-1, typecode, s + xs)
                      sendreq = self.COMM.Send_init(
                          sbuf.as_mpi(), dest, 0
                      )
                      recvreq = self.COMM.Recv_init(
                          rbuf.as_mpi(), source, 0
                      )
                      reqlist = [sendreq, recvreq]
                      MPI.Prequest.Startall(reqlist)
                      index1 = MPI.Prequest.Waitany(reqlist)
                      self.assertIn(index1, [0, 1])
                      self.assertNotEqual(
                          reqlist[index1], MPI.REQUEST_NULL
                      )
                      index2 = MPI.Prequest.Waitany(reqlist)
                      self.assertIn(index2, [0, 1])
                      self.assertNotEqual(
                          reqlist[index2], MPI.REQUEST_NULL
                      )
                      self.assertNotEqual(index1, index2)
                      index3 = MPI.Prequest.Waitany(reqlist)
                      self.assertEqual(index3, MPI.UNDEFINED)
                      for preq in reqlist:
                          self.assertNotEqual(preq, MPI.REQUEST_NULL)
                          preq.Free()
                          self.assertEqual(preq, MPI.REQUEST_NULL)
                      check = arrayimpl.scalar(s)
                      for value in rbuf[:s]:
                          self.assertEqual(value, check)
                      check = arrayimpl.scalar(-1)
                      for value in rbuf[s:]:
                          self.assertEqual(value, check)
                      #
                      sbuf = array(s, typecode, s)
                      rbuf = array(-1, typecode, s + xs)
                      sendreq = self.COMM.Ssend_init(
                          sbuf.as_mpi(), dest, 0
                      )
                      recvreq = self.COMM.Recv_init(
                          rbuf.as_mpi(), source, 0
                      )
                      sendreq.Start()
                      recvreq.Start()
                      sendreq.Wait()
                      recvreq.Wait()
                      self.assertNotEqual(sendreq, MPI.REQUEST_NULL)
                      self.assertNotEqual(recvreq, MPI.REQUEST_NULL)
                      sendreq.Free()
                      recvreq.Free()
                      self.assertEqual(sendreq, MPI.REQUEST_NULL)
                      self.assertEqual(recvreq, MPI.REQUEST_NULL)
                      check = arrayimpl.scalar(s)
                      for value in rbuf[:s]:
                          self.assertEqual(value, check)
                      check = arrayimpl.scalar(-1)
                      for value in rbuf[s:]:
                          self.assertEqual(value, check)
                      #
                      mem = array(
                          0, typecode, s + MPI.BSEND_OVERHEAD
                      ).as_raw()
                      sbuf = array(s, typecode, s)
                      rbuf = array(-1, typecode, s + xs)
                      MPI.Attach_buffer(mem)
                      sendreq = self.COMM.Bsend_init(
                          sbuf.as_mpi(), dest, 0
                      )
                      recvreq = self.COMM.Recv_init(
                          rbuf.as_mpi(), source, 0
                      )
                      sendreq.Start()
                      recvreq.Start()
                      sendreq.Wait()
                      recvreq.Wait()
                      MPI.Detach_buffer()
                      self.assertNotEqual(sendreq, MPI.REQUEST_NULL)
                      self.assertNotEqual(recvreq, MPI.REQUEST_NULL)
                      sendreq.Free()
                      recvreq.Free()
                      self.assertEqual(sendreq, MPI.REQUEST_NULL)
                      self.assertEqual(recvreq, MPI.REQUEST_NULL)
                      check = arrayimpl.scalar(s)
                      for value in rbuf[:s]:
                          self.assertEqual(value, check)
                      check = arrayimpl.scalar(-1)
                      for value in rbuf[s:]:
                          self.assertEqual(value, check)
                      #
                      rank = self.COMM.Get_rank()
                      sbuf = array(s, typecode, s)
                      rbuf = array(-1, typecode, s + xs)
                      recvreq = self.COMM.Recv_init(
                          rbuf.as_mpi(), rank, 0
                      )
                      sendreq = self.COMM.Rsend_init(
                          sbuf.as_mpi(), rank, 0
                      )
                      recvreq.Start()
                      sendreq.Start()
                      recvreq.Wait()
                      sendreq.Wait()
                      self.assertNotEqual(sendreq, MPI.REQUEST_NULL)
                      self.assertNotEqual(recvreq, MPI.REQUEST_NULL)
                      sendreq.Free()
                      recvreq.Free()
                      self.assertEqual(sendreq, MPI.REQUEST_NULL)
                      self.assertEqual(recvreq, MPI.REQUEST_NULL)
                      check = arrayimpl.scalar(s)
                      for value in rbuf[:s]:
                          self.assertEqual(value, check)
                      check = arrayimpl.scalar(-1)
                      for value in rbuf[s:]:
                          self.assertEqual(value, check)
  
imports: from mpi4py import MPI
  import mpiunittest
  import itertools
  import arrayimpl
label_desc: Use image node_id 10 for calling the BaseTestP2PBuf obj's underlying member method code with example usage: obj.testPersistent() without return types