Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
enforce a scatter error in some cases
[simgrid.git] / src / smpi / smpi_pmpi.c
index c2aa98c..d0d8b4b 100644 (file)
@@ -127,15 +127,7 @@ int PMPI_Abort(MPI_Comm comm, int errorcode)
 
 double PMPI_Wtime(void)
 {
-  double time;
-  if (smpi_process_initialized() && !smpi_process_finalized() && !smpi_process_get_sampling()) {
-    smpi_bench_end();
-    time = SIMIX_get_clock();
-    smpi_bench_begin();
-  } else {
-    time = SIMIX_get_clock();
-  }
-  return time;
+  return smpi_mpi_wtime();
 }
 
 extern double sg_maxmin_precision;
@@ -1004,7 +996,7 @@ int PMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src,
     *request = MPI_REQUEST_NULL;
     retval = MPI_SUCCESS;
   } else if (src!=MPI_ANY_SOURCE && (src >= smpi_group_size(smpi_comm_group(comm)) || src <0)){
-    retval = MPI_ERR_COMM;
+    retval = MPI_ERR_RANK;
   } else if (count < 0) {
     retval = MPI_ERR_COUNT;
   } else if (buf==NULL && count > 0) {
@@ -1967,7 +1959,10 @@ int PMPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
   } else if (((smpi_comm_rank(comm)==root) && (sendtype == MPI_DATATYPE_NULL))
              || ((recvbuf !=MPI_IN_PLACE) && (recvtype == MPI_DATATYPE_NULL))) {
     retval = MPI_ERR_TYPE;
-  } else {
+  } else if ((sendbuf == recvbuf) ||
+      ((smpi_comm_rank(comm)==root) && sendcount>0 && (sendbuf == NULL))){
+    retval = MPI_ERR_BUFFER;
+  }else {
 
     if (recvbuf == MPI_IN_PLACE) {
         recvtype=sendtype;
@@ -2848,7 +2843,34 @@ int PMPI_Free_mem(void *baseptr){
   return MPI_SUCCESS;
 }
 
+int PMPI_Type_set_name(MPI_Datatype  datatype, char * name)
+{
+  int retval = 0;
+  if (datatype == MPI_DATATYPE_NULL)  {
+    retval = MPI_ERR_TYPE;
+  } else if (name == NULL)  {
+    retval = MPI_ERR_ARG;
+  } else {
+    smpi_datatype_set_name(datatype, name);
+    retval = MPI_SUCCESS;
+  }
+  return retval;
+}
+
+int PMPI_Type_get_name(MPI_Datatype  datatype, char * name, int* len)
+{
+  int retval = 0;
 
+  if (datatype == MPI_DATATYPE_NULL)  {
+    retval = MPI_ERR_TYPE;
+  } else if (name == NULL)  {
+    retval = MPI_ERR_ARG;
+  } else {
+    smpi_datatype_get_name(datatype, name, len);
+    retval = MPI_SUCCESS;
+  }
+  return retval;
+}
 
 /* The following calls are not yet implemented and will fail at runtime. */
 /* Once implemented, please move them above this notice. */
@@ -2858,15 +2880,7 @@ int PMPI_Free_mem(void *baseptr){
     return MPI_SUCCESS;                                                 \
   }
 
-int PMPI_Type_set_name(MPI_Datatype  datatype, char * name)
-{
-  NOT_YET_IMPLEMENTED
-}
 
-int PMPI_Type_get_name(MPI_Datatype  datatype, char * name, int* len)
-{
-  NOT_YET_IMPLEMENTED
-}
 
 int PMPI_Pack_size(int incount, MPI_Datatype datatype, MPI_Comm comm, int* size) {
   NOT_YET_IMPLEMENTED