mpi: returns

9
MPI: Returns By Camilo A Silva

Upload: felicia-mcdonald

Post on 30-Dec-2015

29 views

Category:

Documents


2 download

DESCRIPTION

MPI: Returns. By Camilo A Silva. Topics. Asynchronous Communication. Asynchronous Communication. Accessing elements of a shared data structure in an unstructured manner HOW? --BY distributing the shared data structure among the computational processes. Asynchronous Functions. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: MPI: Returns

MPI: Returns

By Camilo A Silva

Page 2: MPI: Returns

Topics

• Asynchronous Communication

Page 3: MPI: Returns

Asynchronous Communication

• Accessing elements of a shared data structure in an unstructured manner

• HOW?

--BY distributing the shared data structure among the computational processes

Page 4: MPI: Returns

Asynchronous Functions

Page 5: MPI: Returns

Asynchronous simple program

int count, *buf, source;

MPI_Probe(MPI_ANY_SOURCE, 0, comm, &status);

source = status.MPI_SOURCE;

MPI_Get_count(status, MPI_INT, &count);

buf = malloc(count*sizeof(int));

MPI_Recv(buf, count, MPI_INT, source, 0, comm, &status);

Page 6: MPI: Returns

Example…

/* Data task */

/* Computation task */ while(done != TRUE) {

receive(request);

reply_to(request);

}

while(done != TRUE) {

identify_next_task();

generate_requests();

process_replies();

}

Page 7: MPI: Returns

Asynchronous example

Page 8: MPI: Returns

MPI_StatusIn C: MPI_Status is a structure• status.MPI_TAG is tag of incoming message(useful if MPI_ANY_TAG was specified)• status.MPI_SOURCE is source of incoming message(useful if MPI_ANY_SOURCE was specified)• How many elements of given datatype were receivedMPI_Get_count(IN status, IN datatype, OUT count)

In Fortran: status is an array of integerinteger status(MPI_STATUS_SIZE)status(MPI_SOURCE)status(MPI_TAG)

In MPI-2: Will be able to specify MPI_STATUS_IGNORE

Page 9: MPI: Returns

Next topics…

• Modularity

• Data Types + Heterogeneity

• Buffer + Performance Issues

• Compilation + Other important topics (topologies, MPI objects, tools for evaluating programs, and multiple program connection)