MPI basics Flashcards

1
Q

initialize

A

int MPI_Init(int* argc, char*** argv);

MPI_Init(&argc, &argv);

call as soon as possible

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

finalize

A

int MPI_Finalize(void);

MPI_Finalize();

releases resources

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

communicators basics

A

MPI_COMM_WORLD
MPI_COMM_SELF: only you

  • any communciation is done in the conte4xt of a comm
  • no communciatorion across comms
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

get size

A

int MPI_Comm_size(MPI_Comm comm, int* size);

MPI_Comm_size(MPI_COMM_WORLD, &comm_size);

get the total n of processes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

get rank

A

int MPI_Comm_rank(MPI_Comm comm,int* rank);

MPI_Comm_rank(MPI_COMM_WORLD, &comm_rank);

own rank

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

basic send

A

int MPI_Send(const void* buffer,
int count,
MPI_Datatype datatype,
int recipient,
int tag,
MPI_Comm communicator);

MPI_Send(&buffer_sent, 1, MPI_INT, RECEIVER, 0, MPI_COMM_WORLD);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

basic receive

A

int MPI_Recv(void* buffer,
int count,
MPI_Datatype datatype,
int sender,
int tag,
MPI_Comm communicator,
MPI_Status* status);

MPI_Recv(&received, 1, MPI_INT, SENDER, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

match

A

send and recv must match
- tag
- source

however you can also use MPI_ANY_TAG and MPI_ANY_SOURCE

also messages in same channel signature (source, dest, tag, comm) are ordered!!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

status

A

status of a reception operation

MPI_SOURCE
MPI_TAG
MPI_ERROR

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what is blocking and non blocking

A

bl can reuse buffer

nonbl cannot

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

send variants

A

Bsend: buffered
pro cannot deadlock, con must allocate buffer of excat size

Ssend sych
pro sure it has received, con costly an extra sync

Rsend ready
bypasses the recv Q since receive has been posted
pro fast, con must be sure its there

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

probe

A

int MPI_Probe(int source,
int tag,
MPI_Comm communicator,
MPI_Status* status);

blocks until a matching msg is found
useful to know how to receive it, buffer size
or to check UMQ for wildcard receives

int MPI_Iprobe(int source,
int tag,
MPI_Comm communicator,
int* flag,
MPI_Status* status);

also non blocking version

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

eager vs rendevouz protocol

A

eager
- sends directly
- good for low short messages
- but many copies
- low overhead

rendevouz
- extra handshake
- first sends envelope
- when receives the clear to send with address it copies data directly into receiver

cross over point: switches protocol

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

send receive

A

int MPI_Sendrecv(const void* buffer_send,
int count_send,
MPI_Datatype datatype_send,
int recipient,
int tag_send,
void* buffer_recv,
int count_recv,
MPI_Datatype datatype_recv,
int sender,
int tag_recv,
MPI_Comm communicator,
MPI_Status* status);

does bothso no deadlock

also the MPI_Sendrecv_replace

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

nonblockign send

A

int MPI_Isend(const void* buffer,
int count,
MPI_Datatype datatype,
int recipient,
int tag,
MPI_Comm communicator,
MPI_Request* request);

MPI_Request request;    MPI_Isend(&buffer_sent, 1, MPI_INT, 1, 0, MPI_COMM_WORLD, &request);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

nonblockign receive

A

int MPI_Irecv(void* buffer,
int count,
MPI_Datatype datatype,
int sender,
int tag,
MPI_Comm communicator,
MPI_Request* request);

MPI_Request request;    MPI_Isend(&buffer_sent, 1, MPI_INT, 1, 0, MPI_COMM_WORLD, &request);
17
Q

wait

A

blocking completion
frees all resources associated with request
returns if request complete

int MPI_Wait(MPI_Request* request,
MPI_Status* status);
MPI_Wait(&request, MPI_STATUS_IGNORE);

18
Q

test

A

int MPI_Test(MPI_Request* request,
int* flag,
MPI_Status* status);

 MPI_Test(&request, &ready, MPI_STATUS_IGNORE);

flag true if complete

19
Q

wait test variants

A

waitall, testall
waits if an array of requests are complete

int MPI_Waitall(int count,
MPI_Request requests[],
MPI_Status statuses[]);
MPI_Waitall(2, requests, MPI_STATUSES_IGNORE);

waitany, testany
at least one must be complete, returns it

int MPI_Testany(int count,
MPI_Request* requests,
int* index,
int* flag,
MPI_Status* status);
MPI_Testany(count, requests, &index, &ready, MPI_STATUS_IGNORE);