static MPI_Comm get_comm(int comm) {
if(comm == -2) {
return MPI_COMM_SELF;
- } else if(comm >= 0) {
+ } else if(comm_lookup && comm >= 0 && comm < (int)xbt_dynar_length(comm_lookup)) {
return *(MPI_Comm*)xbt_dynar_get_ptr(comm_lookup, comm);
}
return MPI_COMM_NULL;
new_datatype(MPI_UINT16_T);
new_datatype(MPI_UINT32_T);
new_datatype(MPI_UINT64_T);
+ new_datatype(MPI_2FLOAT);
+ new_datatype(MPI_2DOUBLE);
+
op_lookup = xbt_dynar_new(sizeof(MPI_Op), NULL);
new_op(MPI_MAX);
void mpi_finalize__(int* ierr) {
*ierr = MPI_Finalize();
xbt_dynar_free(&op_lookup);
+ op_lookup = NULL;
xbt_dynar_free(&datatype_lookup);
+ datatype_lookup = NULL;
xbt_dict_free(&request_lookup);
+ request_lookup = NULL;
xbt_dynar_free(&comm_lookup);
+ comm_lookup = NULL;
}
void mpi_abort__(int* comm, int* errorcode, int* ierr) {
return MPI_Wtime();
}
+double mpi_wtick__(void) {
+ return MPI_Wtick();
+}
+
void mpi_comm_dup__(int* comm, int* newcomm, int* ierr) {
MPI_Comm tmp;
get_comm(*comm));
}
+void mpi_sendrecv__(void* sendbuf, int* sendcount, int* sendtype, int* dst,
+ int* sendtag, void *recvbuf, int* recvcount,
+ int* recvtype, int* src, int* recvtag,
+ int* comm, MPI_Status* status, int* ierr) {
+ *ierr = MPI_Sendrecv(sendbuf, *sendcount, get_datatype(*sendtype), *dst,
+ *sendtag, recvbuf, *recvcount,get_datatype(*recvtype), *src, *recvtag,
+ get_comm(*comm), status);
+}
+
void mpi_recv_init__(void *buf, int* count, int* datatype, int* src, int* tag,
int* comm, int* request, int* ierr) {
MPI_Request req;
recvbuf, *recvcount, get_datatype(*recvtype), *root, get_comm(*comm));
}
+void mpi_gatherv__(void* sendbuf, int* sendcount, int* sendtype,
+ void* recvbuf, int* recvcounts, int* displs, int* recvtype,
+ int* root, int* comm, int* ierr) {
+ *ierr = MPI_Gatherv(sendbuf, *sendcount, get_datatype(*sendtype),
+ recvbuf, recvcounts, displs, get_datatype(*recvtype), *root, get_comm(*comm));
+}
+
void mpi_allgather__(void* sendbuf, int* sendcount, int* sendtype,
void* recvbuf, int* recvcount, int* recvtype,
int* comm, int* ierr) {
recvbuf, *recvcount, get_datatype(*recvtype), get_comm(*comm));
}
+void mpi_allgatherv__(void* sendbuf, int* sendcount, int* sendtype,
+ void* recvbuf, int* recvcount,int* displs, int* recvtype,
+ int* comm, int* ierr) {
+ *ierr = MPI_Allgatherv(sendbuf, *sendcount, get_datatype(*sendtype),
+ recvbuf, recvcount, displs, get_datatype(*recvtype), get_comm(*comm));
+}
+
void mpi_scan__(void* sendbuf, void* recvbuf, int* count, int* datatype,
int* op, int* comm, int* ierr) {
*ierr = MPI_Scan(sendbuf, recvbuf, *count, get_datatype(*datatype),
*ierr = MPI_Alltoall(sendbuf, *sendcount, get_datatype(*sendtype),
recvbuf, *recvcount, get_datatype(*recvtype), get_comm(*comm));
}
+
+void mpi_test__ (int * request, int *flag, MPI_Status * status, int* ierr){
+ MPI_Request req = find_request(*request);
+ *ierr= MPI_Test(&req, flag, status);
+}
+void mpi_get_processor_name__(char *name, int *resultlen, int* ierr){
+ *ierr = MPI_Get_processor_name(name, resultlen);
+}
+
+void mpi_get_count__(MPI_Status * status, int* datatype, int *count, int* ierr){
+ *ierr = MPI_Get_count(status, get_datatype(*datatype), count);
+}
+
+void mpi_type_extent__(int* datatype, MPI_Aint * extent, int* ierr){
+ *ierr= MPI_Type_extent(get_datatype(*datatype), extent);
+}
+
+void mpi_type_ub__(int* datatype, MPI_Aint * disp, int* ierr){
+ *ierr= MPI_Type_ub(get_datatype(*datatype), disp);
+}
+
+void mpi_type_lb__(int* datatype, MPI_Aint * extent, int* ierr){
+ *ierr= MPI_Type_extent(get_datatype(*datatype), extent);
+}
+
+void mpi_type_size__(int* datatype, int *size, int* ierr)
+{
+ *ierr = MPI_Type_size(get_datatype(*datatype), size);
+}