[Pympi-users] Asynchronous communcation
Status: Alpha
Brought to you by:
patmiller
From: <oli...@en...> - 2003-03-19 19:53:53
|
Hello, I'd like to perform non blocking asynchronous communications between different MPI processus. 0 send to 1 and 2 some message at some given times while 1 and 2 are busy (doing some time consuming operation like sleeping for instance ;). However they check what is in their mail box from time to time. To achieve this task I used mpi.isend and mpi.recv but according to the following I should have made a msitake somewhere because non of the sent messages never arrive to 1 or 2. What have i done wrong? Thanks Olivier PS: Here is the sample program testMPI.py: <quote> #!/usr/bin/env python import mpi, time if mpi.rank == 0: print '** 0 : sleeping ...' time.sleep(3.0) print '** 0 : sending hello to %d ...'%1 request1 = mpi.isend('Hello 1', 1) print '** 0 : sleeping ...' time.sleep(4.0) print '** 0 : sending hello to %d ...'%2 request2 = mpi.isend('Hello 2', 2) while (not request1) or (not request2): pass print '** 0 : sequence finished' else: msg = None while msg == None: print '**', mpi.rank, ': sleeping 1s ...' time.sleep(1.0) print '**', mpi.rank, ': receiving...' reception = mpi.irecv(0) if reception: msg = reception.message print '**', mpi.rank, ':', 'received :', msg </quote> And here is the output (interrupted by keyboard ^C stroke) sync17% mpirun -np 3 -machinefile machines pyMPI testMPI.py ** 1 : sleeping 1s ... ** 0 : sleeping ... ** 2 : sleeping 1s ... ** 1 : receiving... ** 1 : sleeping 1s ... ** 2 : receiving... ** 2 : sleeping 1s ... ** 1 : receiving... ** 1 : sleeping 1s ... ** 2 : receiving... ** 2 : sleeping 1s ... ** 1 : receiving... ** 1 : sleeping 1s ... ** 2 : receiving... ** 2 : sleeping 1s ... ** 0 : sending hello to 1 ... ** 0 : sleeping ... ** 1 : receiving... ** 1 : sleeping 1s ... ** 2 : receiving... ** 2 : sleeping 1s ... ** 1 : receiving... ** 1 : sleeping 1s ... ** 2 : receiving... ** 2 : sleeping 1s ... ** 1 : receiving... ** 1 : sleeping 1s ... ** 2 : receiving... ** 2 : sleeping 1s ... ** 1 : receiving... ** 1 : sleeping 1s ... ** 2 : receiving... ** 2 : sleeping 1s ... ** 0 : sending hello to 2 ... ** 1 : receiving... ** 1 : sleeping 1s ... ** 2 : receiving... ** 2 : sleeping 1s ... ** 1 : receiving... ** 1 : sleeping 1s ... ** 2 : receiving... ** 2 : sleeping 1s ... ** 1 : receiving... ** 1 : sleeping 1s ... ** 2 : receiving... ** 2 : sleeping 1s ... ** 1 : receiving... ** 1 : sleeping 1s ... ** 2 : receiving... ** 2 : sleeping 1s ... bm_list_20012: p4_error: interrupt SIGINT: 2 Killed by signal 2. Killed by signal 2. p0_20011: p4_error: interrupt SIGINT: 2 |