-void mpi_send_init_(void *buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* request, int* ierr) {
- MPI_Request req;
- buf = static_cast<char *>(FORT_BOTTOM(buf));
- *ierr = MPI_Send_init(buf, *count, simgrid::smpi::Datatype::f2c(*datatype), *dst, *tag, simgrid::smpi::Comm::f2c(*comm), &req);
- if(*ierr == MPI_SUCCESS) {
- *request = req->add_f();
- }
-}
-
-void mpi_isend_(void *buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* request, int* ierr) {
- MPI_Request req;
- buf = static_cast<char *>(FORT_BOTTOM(buf));
- *ierr = MPI_Isend(buf, *count, simgrid::smpi::Datatype::f2c(*datatype), *dst, *tag, simgrid::smpi::Comm::f2c(*comm), &req);
- if(*ierr == MPI_SUCCESS) {
- *request = req->add_f();
- }
-}
-
-void mpi_irsend_(void *buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* request, int* ierr) {
- MPI_Request req;
- buf = static_cast<char *>(FORT_BOTTOM(buf));
- *ierr = MPI_Irsend(buf, *count, simgrid::smpi::Datatype::f2c(*datatype), *dst, *tag, simgrid::smpi::Comm::f2c(*comm), &req);
- if(*ierr == MPI_SUCCESS) {
- *request = req->add_f();
- }
-}
-
-void mpi_send_(void* buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* ierr) {
- buf = static_cast<char *>(FORT_BOTTOM(buf));
- *ierr = MPI_Send(buf, *count, simgrid::smpi::Datatype::f2c(*datatype), *dst, *tag, simgrid::smpi::Comm::f2c(*comm));
-}
-
-void mpi_rsend_(void* buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* ierr) {
- buf = static_cast<char *>(FORT_BOTTOM(buf));
- *ierr = MPI_Rsend(buf, *count, simgrid::smpi::Datatype::f2c(*datatype), *dst, *tag, simgrid::smpi::Comm::f2c(*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) {
- sendbuf = static_cast<char *>( FORT_BOTTOM(sendbuf));
- recvbuf = static_cast<char *>( FORT_BOTTOM(recvbuf));
- *ierr = MPI_Sendrecv(sendbuf, *sendcount, simgrid::smpi::Datatype::f2c(*sendtype), *dst, *sendtag, recvbuf, *recvcount,
- simgrid::smpi::Datatype::f2c(*recvtype), *src, *recvtag, simgrid::smpi::Comm::f2c(*comm), FORT_STATUS_IGNORE(status));
-}
-
-void mpi_recv_init_(void *buf, int* count, int* datatype, int* src, int* tag, int* comm, int* request, int* ierr) {
- MPI_Request req;
- buf = static_cast<char *>( FORT_BOTTOM(buf));
- *ierr = MPI_Recv_init(buf, *count, simgrid::smpi::Datatype::f2c(*datatype), *src, *tag, simgrid::smpi::Comm::f2c(*comm), &req);
- if(*ierr == MPI_SUCCESS) {
- *request = req->add_f();
- }
-}
-
-void mpi_irecv_(void *buf, int* count, int* datatype, int* src, int* tag, int* comm, int* request, int* ierr) {
- MPI_Request req;
- buf = static_cast<char *>( FORT_BOTTOM(buf));
- *ierr = MPI_Irecv(buf, *count, simgrid::smpi::Datatype::f2c(*datatype), *src, *tag, simgrid::smpi::Comm::f2c(*comm), &req);
- if(*ierr == MPI_SUCCESS) {
- *request = req->add_f();
- }
-}
-
-void mpi_recv_(void* buf, int* count, int* datatype, int* src, int* tag, int* comm, MPI_Status* status, int* ierr) {
- buf = static_cast<char *>( FORT_BOTTOM(buf));
- *ierr = MPI_Recv(buf, *count, simgrid::smpi::Datatype::f2c(*datatype), *src, *tag, simgrid::smpi::Comm::f2c(*comm), status);
-}
-
-void mpi_start_(int* request, int* ierr) {
- MPI_Request req = simgrid::smpi::Request::f2c(*request);
-
- *ierr = MPI_Start(&req);
-}
-
-void mpi_startall_(int* count, int* requests, int* ierr) {
- MPI_Request* reqs;
- int i;
-
- reqs = xbt_new(MPI_Request, *count);
- for(i = 0; i < *count; i++) {
- reqs[i] = simgrid::smpi::Request::f2c(requests[i]);
- }
- *ierr = MPI_Startall(*count, reqs);
- xbt_free(reqs);
-}
-
-void mpi_wait_(int* request, MPI_Status* status, int* ierr) {
- MPI_Request req = simgrid::smpi::Request::f2c(*request);
-
- *ierr = MPI_Wait(&req, FORT_STATUS_IGNORE(status));
- if(req==MPI_REQUEST_NULL){
- simgrid::smpi::Request::free_f(*request);
- *request=MPI_FORTRAN_REQUEST_NULL;
- }
-}
-
-void mpi_waitany_(int* count, int* requests, int* index, MPI_Status* status, int* ierr) {
- MPI_Request* reqs;
- int i;
-
- reqs = xbt_new(MPI_Request, *count);
- for(i = 0; i < *count; i++) {
- reqs[i] = simgrid::smpi::Request::f2c(requests[i]);
- }
- *ierr = MPI_Waitany(*count, reqs, index, status);
- if(reqs[*index]==MPI_REQUEST_NULL){
- simgrid::smpi::Request::free_f(requests[*index]);
- requests[*index]=MPI_FORTRAN_REQUEST_NULL;
- }
- xbt_free(reqs);
-}
-
-void mpi_waitall_(int* count, int* requests, MPI_Status* status, int* ierr) {
- MPI_Request* reqs;
- int i;
-
- reqs = xbt_new(MPI_Request, *count);
- for(i = 0; i < *count; i++) {
- reqs[i] = simgrid::smpi::Request::f2c(requests[i]);
- }
- *ierr = MPI_Waitall(*count, reqs, FORT_STATUSES_IGNORE(status));
- for(i = 0; i < *count; i++) {
- if(reqs[i]==MPI_REQUEST_NULL){
- simgrid::smpi::Request::free_f(requests[i]);
- requests[i]=MPI_FORTRAN_REQUEST_NULL;
- }
- }
-
- xbt_free(reqs);
-}
-
-void mpi_barrier_(int* comm, int* ierr) {
- *ierr = MPI_Barrier(simgrid::smpi::Comm::f2c(*comm));
-}
-
-void mpi_bcast_(void *buf, int* count, int* datatype, int* root, int* comm, int* ierr) {
- *ierr = MPI_Bcast(buf, *count, simgrid::smpi::Datatype::f2c(*datatype), *root, simgrid::smpi::Comm::f2c(*comm));
-}
-
-void mpi_reduce_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* root, int* comm, int* ierr) {
- sendbuf = static_cast<char *>( FORT_IN_PLACE(sendbuf));
- sendbuf = static_cast<char *>( FORT_BOTTOM(sendbuf));
- recvbuf = static_cast<char *>( FORT_BOTTOM(recvbuf));
- *ierr = MPI_Reduce(sendbuf, recvbuf, *count, simgrid::smpi::Datatype::f2c(*datatype), simgrid::smpi::Op::f2c(*op), *root, simgrid::smpi::Comm::f2c(*comm));
-}
-
-void mpi_allreduce_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* comm, int* ierr) {
- sendbuf = static_cast<char *>( FORT_IN_PLACE(sendbuf));
- *ierr = MPI_Allreduce(sendbuf, recvbuf, *count, simgrid::smpi::Datatype::f2c(*datatype), simgrid::smpi::Op::f2c(*op), simgrid::smpi::Comm::f2c(*comm));
-}
-
-void mpi_reduce_scatter_(void* sendbuf, void* recvbuf, int* recvcounts, int* datatype, int* op, int* comm, int* ierr) {
- sendbuf = static_cast<char *>( FORT_IN_PLACE(sendbuf));
- *ierr = MPI_Reduce_scatter(sendbuf, recvbuf, recvcounts, simgrid::smpi::Datatype::f2c(*datatype),
- simgrid::smpi::Op::f2c(*op), simgrid::smpi::Comm::f2c(*comm));
-}
-
-void mpi_scatter_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, int* recvcount, int* recvtype,
- int* root, int* comm, int* ierr) {
- recvbuf = static_cast<char *>( FORT_IN_PLACE(recvbuf));
- *ierr = MPI_Scatter(sendbuf, *sendcount, simgrid::smpi::Datatype::f2c(*sendtype),
- recvbuf, *recvcount, simgrid::smpi::Datatype::f2c(*recvtype), *root, simgrid::smpi::Comm::f2c(*comm));
-}
-
-void mpi_scatterv_(void* sendbuf, int* sendcounts, int* displs, int* sendtype,
- void* recvbuf, int* recvcount, int* recvtype, int* root, int* comm, int* ierr) {
- recvbuf = static_cast<char *>( FORT_IN_PLACE(recvbuf));
- *ierr = MPI_Scatterv(sendbuf, sendcounts, displs, simgrid::smpi::Datatype::f2c(*sendtype),
- recvbuf, *recvcount, simgrid::smpi::Datatype::f2c(*recvtype), *root, simgrid::smpi::Comm::f2c(*comm));
-}
-
-void mpi_gather_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, int* recvcount, int* recvtype,
- int* root, int* comm, int* ierr) {
- sendbuf = static_cast<char *>( FORT_IN_PLACE(sendbuf));
- sendbuf = sendbuf!=MPI_IN_PLACE ? static_cast<char *>( FORT_BOTTOM(sendbuf)) : MPI_IN_PLACE;
- recvbuf = static_cast<char *>( FORT_BOTTOM(recvbuf));
- *ierr = MPI_Gather(sendbuf, *sendcount, simgrid::smpi::Datatype::f2c(*sendtype),
- recvbuf, *recvcount, simgrid::smpi::Datatype::f2c(*recvtype), *root, simgrid::smpi::Comm::f2c(*comm));
-}
-
-void mpi_gatherv_(void* sendbuf, int* sendcount, int* sendtype,
- void* recvbuf, int* recvcounts, int* displs, int* recvtype, int* root, int* comm, int* ierr) {
- sendbuf = static_cast<char *>( FORT_IN_PLACE(sendbuf));
- sendbuf = sendbuf!=MPI_IN_PLACE ? static_cast<char *>( FORT_BOTTOM(sendbuf)) : MPI_IN_PLACE;
- recvbuf = static_cast<char *>( FORT_BOTTOM(recvbuf));
- *ierr = MPI_Gatherv(sendbuf, *sendcount, simgrid::smpi::Datatype::f2c(*sendtype),
- recvbuf, recvcounts, displs, simgrid::smpi::Datatype::f2c(*recvtype), *root, simgrid::smpi::Comm::f2c(*comm));
-}
-
-void mpi_allgather_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, int* recvcount, int* recvtype,
- int* comm, int* ierr) {
- sendbuf = static_cast<char *>( FORT_IN_PLACE(sendbuf));
- *ierr = MPI_Allgather(sendbuf, *sendcount, simgrid::smpi::Datatype::f2c(*sendtype),
- recvbuf, *recvcount, simgrid::smpi::Datatype::f2c(*recvtype), simgrid::smpi::Comm::f2c(*comm));
-}
-
-void mpi_allgatherv_(void* sendbuf, int* sendcount, int* sendtype,
- void* recvbuf, int* recvcounts,int* displs, int* recvtype, int* comm, int* ierr) {
- sendbuf = static_cast<char *>( FORT_IN_PLACE(sendbuf));
- *ierr = MPI_Allgatherv(sendbuf, *sendcount, simgrid::smpi::Datatype::f2c(*sendtype),
- recvbuf, recvcounts, displs, simgrid::smpi::Datatype::f2c(*recvtype), simgrid::smpi::Comm::f2c(*comm));
-}
-
-void mpi_scan_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* comm, int* ierr) {
- *ierr = MPI_Scan(sendbuf, recvbuf, *count, simgrid::smpi::Datatype::f2c(*datatype),
- simgrid::smpi::Op::f2c(*op), simgrid::smpi::Comm::f2c(*comm));
-}
-
-void mpi_alltoall_(void* sendbuf, int* sendcount, int* sendtype,
- void* recvbuf, int* recvcount, int* recvtype, int* comm, int* ierr) {
- *ierr = MPI_Alltoall(sendbuf, *sendcount, simgrid::smpi::Datatype::f2c(*sendtype),
- recvbuf, *recvcount, simgrid::smpi::Datatype::f2c(*recvtype), simgrid::smpi::Comm::f2c(*comm));
-}
-
-void mpi_alltoallv_(void* sendbuf, int* sendcounts, int* senddisps, int* sendtype,
- void* recvbuf, int* recvcounts, int* recvdisps, int* recvtype, int* comm, int* ierr) {
- *ierr = MPI_Alltoallv(sendbuf, sendcounts, senddisps, simgrid::smpi::Datatype::f2c(*sendtype),
- recvbuf, recvcounts, recvdisps, simgrid::smpi::Datatype::f2c(*recvtype), simgrid::smpi::Comm::f2c(*comm));
-}
-
-void mpi_test_ (int * request, int *flag, MPI_Status * status, int* ierr){
- MPI_Request req = simgrid::smpi::Request::f2c(*request);
- *ierr= MPI_Test(&req, flag, FORT_STATUS_IGNORE(status));
- if(req==MPI_REQUEST_NULL){
- simgrid::smpi::Request::free_f(*request);
- *request=MPI_FORTRAN_REQUEST_NULL;
- }
-}
-
-void mpi_testall_ (int* count, int * requests, int *flag, MPI_Status * statuses, int* ierr){
- int i;
- MPI_Request* reqs = xbt_new(MPI_Request, *count);
- for(i = 0; i < *count; i++) {
- reqs[i] = simgrid::smpi::Request::f2c(requests[i]);
- }
- *ierr= MPI_Testall(*count, reqs, flag, FORT_STATUSES_IGNORE(statuses));
- for(i = 0; i < *count; i++) {
- if(reqs[i]==MPI_REQUEST_NULL){
- simgrid::smpi::Request::free_f(requests[i]);
- requests[i]=MPI_FORTRAN_REQUEST_NULL;
- }
- }
- xbt_free(reqs);
-}
-