>> In the original process 'A' code, prior to sending out a command, 
>> 'A' will issue an MPI_Wait to make sure that the command request 
>> instance is free. 
>> 
> I'm not quite sure I understand that statement. Can't you just 
> compare the request to MPI_REQUEST_NULL? From your description, it 
> sounds like if you get to this point and the request is not 
> REQUEST_NULL, there's something else wrong. However, this may simply 
> be a side-effect from the short description of complex code...? 
What I'm trying to say here is that the infrastructure that already
exists issues an MPI_Wait
before it sends out anything more to ensure that the previous request
completed.
Maybe this pseudo code will make a little more sense:
        Process 'A'
---------------------------------------------
Initialize requests to MPI_REQUEST_NULL

for i=0; i < n; i++
{
        if (rank == 0)
        {
                initialize 'command' structure
                        (set cmd = 'step 1')
                set destination to Process 'B'
                mpi_issend(command, sizeof(struct command), dest, ...);
        }

        send data to be processed by Process 'B'
                mpi_issend(data, numWords, MPI_FLOAT, ...);


        if (rank == 0)
        {
                mpi_wait(command request for 'step 1' command); 
                sending new command, set cmd = 'step 2', mpi_issend(...)
        }

        send data to be processed by Process 'B'
                mpi_issend(data, ...);

        mpi_wait(command request for 'step n');
}

        Process 'B'
------------------------------------------------
issue mpi_recv_init calls to handle commands and data
coming in from Process 'A'-type processes

while(1)
{
        mpi_wait(command...);

        switch(command->cmd)
        {
                case 'step 1':
                        mpi_waitall(data_requests,...);
                        process data
                        mpi_startall(data_requests, ...);
                        break;

                case 'step 2':
                        mpi_waitall(data_requests, ...);
                        process data
                        mpi_startall(data_requests, ...);
                        break;

                default:
                        break;
        }
        mpi_start(command_request, ...);
}
Process 'B' is not another instance of Process 'A'. They are 2 different
pieces of code
involved in a point-to-point persistent communication.
> One clarifying question: why are you using synchronous sends? 
That is what the existing infrastructure used. I'm just trying to fit
new code into it. Since the code was working, it didn't make sense to
change anything.
Les

Reply via email to