void MPI_Send(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) { $atom { int size; switch (datatype) { case MPI_INT: buf = (int*)buf; size = count*sizeof(int); break; case MPI_FLOAT: buf = (float*)buf; size = count*sizeof(float); break; case MPI_DOUBLE: buf = (double*)buf; size = count*sizeof(double); break; case MPI_CHAR: buf = (char*)buf; size = count*sizeof(char); break; default: printf("Unsupported datatype %d\n", datatype); $assert $false; } $message out = $message_pack(rank, dest, tag, buf, size); $comm_enqueue(comm, out); } } void MPI_Recv(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status) { $message in = $comm_dequeue(comm, source, rank, tag); $atom { int size; switch (datatype) { case MPI_INT: buf = (int*)buf; size = count*sizeof(int); break; case MPI_FLOAT: buf = (float*)buf; size = count*sizeof(float); break; case MPI_DOUBLE: buf = (double*)buf; size = count*sizeof(double); break; case MPI_CHAR: buf = (char*)buf; size = count*sizeof(char); break; default: printf("Unsupported datatype %d\n", datatype); $assert $false; } $message_unpack(in, buf, size); status->source = in.source; status->tag = in.tag; status->size = in.size; } } $when (__start);