Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add a bunch of new fortran bindings, to make bigdft happy
authorAugustin Degomme <degomme@idpann.imag.fr>
Fri, 7 Dec 2012 15:24:32 +0000 (16:24 +0100)
committerAugustin Degomme <degomme@idpann.imag.fr>
Mon, 10 Dec 2012 14:05:31 +0000 (15:05 +0100)
include/smpi/mpif.h
src/smpi/private.h
src/smpi/smpi_f77.c
src/smpi/smpi_pmpi.c

index d20dda4..7c900d8 100644 (file)
       parameter(MPI_COMM_SELF=-2)
       parameter(MPI_COMM_WORLD=0)
 
       parameter(MPI_COMM_SELF=-2)
       parameter(MPI_COMM_WORLD=0)
 
+      integer MPI_GROUP_NULL, MPI_GROUP_EMPTY
+      parameter(MPI_GROUP_NULL=-1)
+      parameter(MPI_GROUP_EMPTY=-2)
+
 ! This should be equal to the number of int fields in MPI_Status
       integer MPI_STATUS_SIZE, MPI_STATUSES_IGNORE
       parameter(MPI_STATUS_SIZE=4)
 ! This should be equal to the number of int fields in MPI_Status
       integer MPI_STATUS_SIZE, MPI_STATUSES_IGNORE
       parameter(MPI_STATUS_SIZE=4)
index 0fff8ab..3831ae2 100644 (file)
@@ -262,16 +262,24 @@ void mpi_comm_rank__(int* comm, int* rank, int* ierr);
 void mpi_comm_size__(int* comm, int* size, int* ierr);
 double mpi_wtime__(void);
 double mpi_wtick__(void);
 void mpi_comm_size__(int* comm, int* size, int* ierr);
 double mpi_wtime__(void);
 double mpi_wtick__(void);
+void mpi_initialized__(int* flag, int* ierr);
 
 void mpi_comm_dup__(int* comm, int* newcomm, int* ierr);
 
 void mpi_comm_dup__(int* comm, int* newcomm, int* ierr);
+void mpi_comm_create__(int* comm, int* group, int* newcomm, int* ierr);
+void mpi_comm_free__(int* comm, int* ierr);
 void mpi_comm_split__(int* comm, int* color, int* key, int* comm_out, int* ierr);
 void mpi_comm_split__(int* comm, int* color, int* key, int* comm_out, int* ierr);
-
+void mpi_group_incl__(int* group, int* n, int* key, int* group_out, int* ierr) ;
+void mpi_comm_group__(int* comm, int* group_out,  int* ierr);
 void mpi_send_init__(void *buf, int* count, int* datatype, int* dst, int* tag,
                      int* comm, int* request, int* ierr);
 void mpi_isend__(void *buf, int* count, int* datatype, int* dst,
                  int* tag, int* comm, int* request, int* ierr);
 void mpi_send_init__(void *buf, int* count, int* datatype, int* dst, int* tag,
                      int* comm, int* request, int* ierr);
 void mpi_isend__(void *buf, int* count, int* datatype, int* dst,
                  int* tag, int* comm, int* request, int* ierr);
+void mpi_irsend__(void *buf, int* count, int* datatype, int* dst,
+                 int* tag, int* comm, int* request, int* ierr);
 void mpi_send__(void* buf, int* count, int* datatype, int* dst,
                 int* tag, int* comm, int* ierr);
 void mpi_send__(void* buf, int* count, int* datatype, int* dst,
                 int* tag, int* comm, int* ierr);
+void mpi_rsend__(void* buf, int* count, int* datatype, int* dst,
+                int* tag, int* comm, int* ierr);
 void mpi_recv_init__(void *buf, int* count, int* datatype, int* src, int* tag,
                      int* comm, int* request, int* ierr);
 void mpi_irecv__(void *buf, int* count, int* datatype, int* src, int* tag,
 void mpi_recv_init__(void *buf, int* count, int* datatype, int* src, int* tag,
                      int* comm, int* request, int* ierr);
 void mpi_irecv__(void *buf, int* count, int* datatype, int* src, int* tag,
@@ -290,9 +298,14 @@ void mpi_reduce__(void* sendbuf, void* recvbuf, int* count,
                   int* datatype, int* op, int* root, int* comm, int* ierr);
 void mpi_allreduce__(void* sendbuf, void* recvbuf, int* count, int* datatype,
                      int* op, int* comm, int* ierr);
                   int* datatype, int* op, int* root, int* comm, int* ierr);
 void mpi_allreduce__(void* sendbuf, void* recvbuf, int* count, int* datatype,
                      int* op, int* comm, int* ierr);
+void mpi_reduce_scatter__(void* sendbuf, void* recvbuf, int* recvcounts, int* datatype,
+                     int* op, int* comm, int* ierr) ;
 void mpi_scatter__(void* sendbuf, int* sendcount, int* sendtype,
                    void* recvbuf, int* recvcount, int* recvtype,
                    int* root, int* comm, int* ierr);
 void mpi_scatter__(void* sendbuf, int* sendcount, int* sendtype,
                    void* recvbuf, int* recvcount, int* recvtype,
                    int* root, int* comm, int* ierr);
+void mpi_scatterv__(void* sendbuf, int* sendcounts, int* displs, int* sendtype,
+                   void* recvbuf, int* recvcount, int* recvtype,
+                   int* root, int* comm, int* ierr);
 void mpi_gather__(void* sendbuf, int* sendcount, int* sendtype,
                   void* recvbuf, int* recvcount, int* recvtype,
                   int* root, int* comm, int* ierr);
 void mpi_gather__(void* sendbuf, int* sendcount, int* sendtype,
                   void* recvbuf, int* recvcount, int* recvtype,
                   int* root, int* comm, int* ierr);
@@ -311,12 +324,16 @@ void mpi_scan__(void* sendbuf, void* recvbuf, int* count, int* datatype,
                 int* op, int* comm, int* ierr);
 void mpi_alltoall__(void* sendbuf, int* sendcount, int* sendtype,
                     void* recvbuf, int* recvcount, int* recvtype, int* comm, int* ierr);
                 int* op, int* comm, int* ierr);
 void mpi_alltoall__(void* sendbuf, int* sendcount, int* sendtype,
                     void* recvbuf, int* recvcount, int* recvtype, int* comm, int* ierr);
+void mpi_alltoallv__(void* sendbuf, int* sendcounts, int* senddisps, int* sendtype,
+                    void* recvbuf, int* recvcounts, int* recvdisps, int* recvtype, int* comm, int* ierr);
 void mpi_get_processor_name__(char *name, int *resultlen, int* ierr);
 void mpi_test__ (int * request, int *flag, MPI_Status * status, int* ierr);
 void mpi_get_count__(MPI_Status * status, int* datatype, int *count, int* ierr);
 void mpi_type_extent__(int* datatype, MPI_Aint * extent, int* ierr);
 void mpi_get_processor_name__(char *name, int *resultlen, int* ierr);
 void mpi_test__ (int * request, int *flag, MPI_Status * status, int* ierr);
 void mpi_get_count__(MPI_Status * status, int* datatype, int *count, int* ierr);
 void mpi_type_extent__(int* datatype, MPI_Aint * extent, int* ierr);
+void mpi_attr_get__(int* comm, int* keyval, void* attr_value, int* flag, int* ierr );
 void mpi_type_lb__(int* datatype, MPI_Aint * extent, int* ierr);
 void mpi_type_ub__(int* datatype, MPI_Aint * extent, int* ierr);
 void mpi_type_lb__(int* datatype, MPI_Aint * extent, int* ierr);
 void mpi_type_ub__(int* datatype, MPI_Aint * extent, int* ierr);
+void mpi_error_string__(int* errorcode, char* string, int* resultlen, int* ierr);
 void mpi_sendrecv__(void* sendbuf, int* sendcount, int* sendtype, int* dst,
                 int* sendtag, void *recvbuf, int* recvcount,
                 int* recvtype, int* src, int* recvtag,
 void mpi_sendrecv__(void* sendbuf, int* sendcount, int* sendtype, int* dst,
                 int* sendtag, void *recvbuf, int* recvcount,
                 int* recvtype, int* src, int* recvtag,
index c181e6d..41e837d 100644 (file)
@@ -14,6 +14,7 @@ extern int xargc;
 extern char** xargv;
 
 static xbt_dynar_t comm_lookup = NULL;
 extern char** xargv;
 
 static xbt_dynar_t comm_lookup = NULL;
+static xbt_dynar_t group_lookup = NULL;
 static xbt_dict_t request_lookup = NULL;
 static xbt_dynar_t datatype_lookup = NULL;
 static xbt_dynar_t op_lookup = NULL;
 static xbt_dict_t request_lookup = NULL;
 static xbt_dynar_t datatype_lookup = NULL;
 static xbt_dynar_t op_lookup = NULL;
@@ -25,6 +26,10 @@ static int new_comm(MPI_Comm comm) {
   return (int)xbt_dynar_length(comm_lookup) - 1;
 }
 
   return (int)xbt_dynar_length(comm_lookup) - 1;
 }
 
+static void free_comm(int comm) {
+  xbt_dynar_remove_at(comm_lookup, comm, NULL);
+}
+
 static MPI_Comm get_comm(int comm) {
   if(comm == -2) {
     return MPI_COMM_SELF;
 static MPI_Comm get_comm(int comm) {
   if(comm == -2) {
     return MPI_COMM_SELF;
@@ -34,6 +39,20 @@ static MPI_Comm get_comm(int comm) {
   return MPI_COMM_NULL;
 }
 
   return MPI_COMM_NULL;
 }
 
+static int new_group(MPI_Group group) {
+  xbt_dynar_push(group_lookup, &group);
+  return (int)xbt_dynar_length(group_lookup) - 1;
+}
+
+static MPI_Group get_group(int group) {
+  if(group == -2) {
+    return MPI_GROUP_EMPTY;
+  } else if(group_lookup && group >= 0 && group < (int)xbt_dynar_length(group_lookup)) {
+    return *(MPI_Group*)xbt_dynar_get_ptr(group_lookup, group);
+  }
+  return MPI_COMM_NULL;
+}
+
 static char* get_key(char* key, int id) {
   snprintf(key, KEY_SIZE, "%x", id);
   return key;
 static char* get_key(char* key, int id) {
   snprintf(key, KEY_SIZE, "%x", id);
   return key;
@@ -78,6 +97,7 @@ static MPI_Op get_op(int op) {
 void mpi_init__(int* ierr) {
    comm_lookup = xbt_dynar_new(sizeof(MPI_Comm), NULL);
    new_comm(MPI_COMM_WORLD);
 void mpi_init__(int* ierr) {
    comm_lookup = xbt_dynar_new(sizeof(MPI_Comm), NULL);
    new_comm(MPI_COMM_WORLD);
+   group_lookup = xbt_dynar_new(sizeof(MPI_Group), NULL);
 
    request_lookup = xbt_dict_new_homogeneous(NULL);
 
 
    request_lookup = xbt_dict_new_homogeneous(NULL);
 
@@ -164,6 +184,26 @@ void mpi_comm_dup__(int* comm, int* newcomm, int* ierr) {
   }
 }
 
   }
 }
 
+void mpi_comm_create__(int* comm, int* group, int* newcomm, int* ierr) {
+  MPI_Comm tmp;
+
+  *ierr = MPI_Comm_create(get_comm(*comm),get_group(*group), &tmp);
+  if(*ierr == MPI_SUCCESS) {
+    *newcomm = new_comm(tmp);
+  }
+}
+
+
+void mpi_comm_free__(int* comm, int* ierr) {
+  MPI_Comm tmp = get_comm(*comm);
+
+  *ierr = MPI_Comm_free(&tmp);
+
+  if(*ierr == MPI_SUCCESS) {
+    free_comm(*comm);
+  }
+}
+
 void mpi_comm_split__(int* comm, int* color, int* key, int* comm_out, int* ierr) {
   MPI_Comm tmp;
 
 void mpi_comm_split__(int* comm, int* color, int* key, int* comm_out, int* ierr) {
   MPI_Comm tmp;
 
@@ -173,6 +213,29 @@ void mpi_comm_split__(int* comm, int* color, int* key, int* comm_out, int* ierr)
   }
 }
 
   }
 }
 
+void mpi_group_incl__(int* group, int* n, int* ranks, int* group_out, int* ierr) {
+  MPI_Group tmp;
+
+  *ierr = MPI_Group_incl(get_group(*group), *n, ranks, &tmp);
+  if(*ierr == MPI_SUCCESS) {
+    *group_out = new_group(tmp);
+  }
+}
+
+void mpi_comm_group__(int* comm, int* group_out,  int* ierr) {
+  MPI_Group tmp;
+
+  *ierr = MPI_Comm_group(get_comm(*comm), &tmp);
+  if(*ierr == MPI_SUCCESS) {
+    *group_out = new_group(tmp);
+  }
+}
+
+
+void mpi_initialized__(int* flag, int* ierr){
+  *ierr = MPI_Initialized(flag);
+}
+
 void mpi_send_init__(void *buf, int* count, int* datatype, int* dst, int* tag,
                      int* comm, int* request, int* ierr) {
   MPI_Request req;
 void mpi_send_init__(void *buf, int* count, int* datatype, int* dst, int* tag,
                      int* comm, int* request, int* ierr) {
   MPI_Request req;
@@ -195,12 +258,29 @@ void mpi_isend__(void *buf, int* count, int* datatype, int* dst,
   }
 }
 
   }
 }
 
+void mpi_irsend__(void *buf, int* count, int* datatype, int* dst,
+                 int* tag, int* comm, int* request, int* ierr) {
+  MPI_Request req;
+
+  *ierr = MPI_Irsend(buf, *count, get_datatype(*datatype), *dst, *tag,
+                    get_comm(*comm), &req);
+  if(*ierr == MPI_SUCCESS) {
+    *request = new_request(req);
+  }
+}
+
 void mpi_send__(void* buf, int* count, int* datatype, int* dst,
                 int* tag, int* comm, int* ierr) {
    *ierr = MPI_Send(buf, *count, get_datatype(*datatype), *dst, *tag,
                     get_comm(*comm));
 }
 
 void mpi_send__(void* buf, int* count, int* datatype, int* dst,
                 int* tag, int* comm, int* ierr) {
    *ierr = MPI_Send(buf, *count, get_datatype(*datatype), *dst, *tag,
                     get_comm(*comm));
 }
 
+void mpi_rsend__(void* buf, int* count, int* datatype, int* dst,
+                int* tag, int* comm, int* ierr) {
+   *ierr = MPI_Rsend(buf, *count, get_datatype(*datatype), *dst, *tag,
+                    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,
 void mpi_sendrecv__(void* sendbuf, int* sendcount, int* sendtype, int* dst,
                 int* sendtag, void *recvbuf, int* recvcount,
                 int* recvtype, int* src, int* recvtag,
@@ -306,6 +386,12 @@ void mpi_allreduce__(void* sendbuf, void* recvbuf, int* count, int* datatype,
                         get_op(*op), get_comm(*comm));
 }
 
                         get_op(*op), get_comm(*comm));
 }
 
+void mpi_reduce_scatter__(void* sendbuf, void* recvbuf, int* recvcounts, int* datatype,
+                     int* op, int* comm, int* ierr) {
+  *ierr = MPI_Reduce_scatter(sendbuf, recvbuf, recvcounts, get_datatype(*datatype),
+                        get_op(*op), get_comm(*comm));
+}
+
 void mpi_scatter__(void* sendbuf, int* sendcount, int* sendtype,
                    void* recvbuf, int* recvcount, int* recvtype, 
                    int* root, int* comm, int* ierr) {
 void mpi_scatter__(void* sendbuf, int* sendcount, int* sendtype,
                    void* recvbuf, int* recvcount, int* recvtype, 
                    int* root, int* comm, int* ierr) {
@@ -313,6 +399,14 @@ void mpi_scatter__(void* sendbuf, int* sendcount, int* sendtype,
                       recvbuf, *recvcount, get_datatype(*recvtype), *root, get_comm(*comm));
 }
 
                       recvbuf, *recvcount, get_datatype(*recvtype), *root, get_comm(*comm));
 }
 
+
+void mpi_scatterv__(void* sendbuf, int* sendcounts, int* displs, int* sendtype,
+                   void* recvbuf, int* recvcount, int* recvtype,
+                   int* root, int* comm, int* ierr) {
+  *ierr = MPI_Scatterv(sendbuf, sendcounts, displs, get_datatype(*sendtype),
+                      recvbuf, *recvcount, get_datatype(*recvtype), *root, get_comm(*comm));
+}
+
 void mpi_gather__(void* sendbuf, int* sendcount, int* sendtype,
                   void* recvbuf, int* recvcount, int* recvtype,
                   int* root, int* comm, int* ierr) {
 void mpi_gather__(void* sendbuf, int* sendcount, int* sendtype,
                   void* recvbuf, int* recvcount, int* recvtype,
                   int* root, int* comm, int* ierr) {
@@ -335,10 +429,10 @@ void mpi_allgather__(void* sendbuf, int* sendcount, int* sendtype,
 }
 
 void mpi_allgatherv__(void* sendbuf, int* sendcount, int* sendtype,
 }
 
 void mpi_allgatherv__(void* sendbuf, int* sendcount, int* sendtype,
-                     void* recvbuf, int* recvcount,int* displs, int* recvtype,
+                     void* recvbuf, int* recvcounts,int* displs, int* recvtype,
                      int* comm, int* ierr) {
   *ierr = MPI_Allgatherv(sendbuf, *sendcount, get_datatype(*sendtype),
                      int* comm, int* ierr) {
   *ierr = MPI_Allgatherv(sendbuf, *sendcount, get_datatype(*sendtype),
-                        recvbuf, recvcount, displs, get_datatype(*recvtype), get_comm(*comm));
+                        recvbuf, recvcounts, displs, get_datatype(*recvtype), get_comm(*comm));
 }
 
 void mpi_scan__(void* sendbuf, void* recvbuf, int* count, int* datatype,
 }
 
 void mpi_scan__(void* sendbuf, void* recvbuf, int* count, int* datatype,
@@ -353,6 +447,12 @@ void mpi_alltoall__(void* sendbuf, int* sendcount, int* sendtype,
                        recvbuf, *recvcount, get_datatype(*recvtype), get_comm(*comm));
 }
 
                        recvbuf, *recvcount, get_datatype(*recvtype), get_comm(*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, get_datatype(*sendtype),
+                       recvbuf, recvcounts, recvdisps, 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_test__ (int * request, int *flag, MPI_Status * status, int* ierr){
   MPI_Request req = find_request(*request);
   *ierr= MPI_Test(&req, flag, status);
@@ -365,6 +465,10 @@ void mpi_get_count__(MPI_Status * status, int* datatype, int *count, int* ierr){
   *ierr = MPI_Get_count(status, get_datatype(*datatype), count);
 }
 
   *ierr = MPI_Get_count(status, get_datatype(*datatype), count);
 }
 
+void mpi_attr_get__(int* comm, int* keyval, void* attr_value, int* flag, int* ierr ){
+  *ierr = MPI_Attr_get(get_comm(*comm), *keyval, attr_value, flag);
+}
+
 void mpi_type_extent__(int* datatype, MPI_Aint * extent, int* ierr){
   *ierr= MPI_Type_extent(get_datatype(*datatype),  extent);
 }
 void mpi_type_extent__(int* datatype, MPI_Aint * extent, int* ierr){
   *ierr= MPI_Type_extent(get_datatype(*datatype),  extent);
 }
@@ -381,3 +485,7 @@ void mpi_type_size__(int* datatype, int *size, int* ierr)
 {
   *ierr = MPI_Type_size(get_datatype(*datatype), size);
 }
 {
   *ierr = MPI_Type_size(get_datatype(*datatype), size);
 }
+
+void mpi_error_string__(int* errorcode, char* string, int* resultlen, int* ierr){
+  *ierr = MPI_Error_string(*errorcode, string, resultlen);
+}
index abd6b90..9fde3a0 100644 (file)
@@ -2070,6 +2070,12 @@ int PMPI_Error_class(int errorcode, int* errorclass) {
   return MPI_SUCCESS;
 }
 
   return MPI_SUCCESS;
 }
 
+
+int PMPI_Initialized(int* flag) {
+   *flag=(smpi_process_data()!=NULL);
+   return MPI_SUCCESS;
+}
+
 /* The following calls are not yet implemented and will fail at runtime. */
 /* Once implemented, please move them above this notice. */
 
 /* The following calls are not yet implemented and will fail at runtime. */
 /* Once implemented, please move them above this notice. */
 
@@ -2282,6 +2288,4 @@ int PMPI_Dims_create(int nnodes, int ndims, int* dims) {
    return not_yet_implemented();
 }
 
    return not_yet_implemented();
 }
 
-int PMPI_Initialized(int* flag) {
-   return not_yet_implemented();
-}
+