Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
this writeActions stuff was never used
[simgrid.git] / src / smpi / smpi_pmpi.cpp
index 13ea956..c48bdcf 100644 (file)
@@ -3,8 +3,11 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include <climits>
+
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Host.hpp"
+#include "src/smpi/private.h"
 #include "src/smpi/smpi_comm.hpp"
 #include "src/smpi/smpi_coll.hpp"
 #include "src/smpi/smpi_datatype_derived.hpp"
@@ -625,8 +628,8 @@ int PMPI_Send_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag
       retval = MPI_ERR_ARG;
   } else if (comm == MPI_COMM_NULL) {
       retval = MPI_ERR_COMM;
-  } else if (!datatype->is_valid()) {
-      retval = MPI_ERR_TYPE;
+  } else if (not datatype->is_valid()) {
+    retval = MPI_ERR_TYPE;
   } else if (dst == MPI_PROC_NULL) {
       retval = MPI_SUCCESS;
   } else {
@@ -648,8 +651,8 @@ int PMPI_Recv_init(void *buf, int count, MPI_Datatype datatype, int src, int tag
     retval = MPI_ERR_ARG;
   } else if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!datatype->is_valid()) {
-      retval = MPI_ERR_TYPE;
+  } else if (not datatype->is_valid()) {
+    retval = MPI_ERR_TYPE;
   } else if (src == MPI_PROC_NULL) {
     retval = MPI_SUCCESS;
   } else {
@@ -671,8 +674,8 @@ int PMPI_Ssend_init(void* buf, int count, MPI_Datatype datatype, int dst, int ta
     retval = MPI_ERR_ARG;
   } else if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!datatype->is_valid()) {
-      retval = MPI_ERR_TYPE;
+  } else if (not datatype->is_valid()) {
+    retval = MPI_ERR_TYPE;
   } else if (dst == MPI_PROC_NULL) {
     retval = MPI_SUCCESS;
   } else {
@@ -753,8 +756,8 @@ int PMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MP
     retval = MPI_ERR_RANK;
   } else if ((count < 0) || (buf==nullptr && count > 0)) {
     retval = MPI_ERR_COUNT;
-  } else if (!datatype->is_valid()) {
-      retval = MPI_ERR_TYPE;
+  } else if (not datatype->is_valid()) {
+    retval = MPI_ERR_TYPE;
   } else if(tag<0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
   } else {
@@ -803,8 +806,8 @@ int PMPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MP
     retval = MPI_ERR_RANK;
   } else if ((count < 0) || (buf==nullptr && count > 0)) {
     retval = MPI_ERR_COUNT;
-  } else if (!datatype->is_valid()) {
-      retval = MPI_ERR_TYPE;
+  } else if (not datatype->is_valid()) {
+    retval = MPI_ERR_TYPE;
   } else if(tag<0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
   } else {
@@ -851,8 +854,8 @@ int PMPI_Issend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, M
     retval = MPI_ERR_RANK;
   } else if ((count < 0)|| (buf==nullptr && count > 0)) {
     retval = MPI_ERR_COUNT;
-  } else if (!datatype->is_valid()) {
-      retval = MPI_ERR_TYPE;
+  } else if (not datatype->is_valid()) {
+    retval = MPI_ERR_TYPE;
   } else if(tag<0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
   } else {
@@ -898,8 +901,8 @@ int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI
     retval = MPI_ERR_RANK;
   } else if ((count < 0) || (buf==nullptr && count > 0)) {
     retval = MPI_ERR_COUNT;
-  } else if (!datatype->is_valid()) {
-      retval = MPI_ERR_TYPE;
+  } else if (not datatype->is_valid()) {
+    retval = MPI_ERR_TYPE;
   } else if(tag<0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
   } else {
@@ -923,7 +926,7 @@ int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI
     // the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE)
     if (status != MPI_STATUS_IGNORE) {
       src_traced = comm->group()->index(status->MPI_SOURCE);
-      if (!TRACE_smpi_view_internals()) {
+      if (not TRACE_smpi_view_internals()) {
         TRACE_smpi_recv(rank, src_traced, rank, tag);
       }
     }
@@ -948,7 +951,7 @@ int PMPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI
     retval = MPI_ERR_RANK;
   } else if ((count < 0) || (buf == nullptr && count > 0)) {
     retval = MPI_ERR_COUNT;
-  } else if (!datatype->is_valid()) {
+  } else if (not datatype->is_valid()) {
     retval = MPI_ERR_TYPE;
   } else if(tag < 0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
@@ -967,7 +970,7 @@ int PMPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI
     }
     extra->send_size = count*dt_size_send;
     TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra);
-    if (!TRACE_smpi_view_internals()) {
+    if (not TRACE_smpi_view_internals()) {
       TRACE_smpi_send(rank, rank, dst_traced, tag,count*datatype->size());
     }
 
@@ -994,7 +997,7 @@ int PMPI_Ssend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MP
     retval = MPI_ERR_RANK;
   } else if ((count < 0) || (buf==nullptr && count > 0)) {
     retval = MPI_ERR_COUNT;
-  } else if (!datatype->is_valid()){
+  } else if (not datatype->is_valid()) {
     retval = MPI_ERR_TYPE;
   } else if(tag<0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
@@ -1014,10 +1017,10 @@ int PMPI_Ssend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MP
     extra->send_size = count*dt_size_send;
     TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra);
     TRACE_smpi_send(rank, rank, dst_traced, tag,count*datatype->size());
-  
+
     simgrid::smpi::Request::ssend(buf, count, datatype, dst, tag, comm);
     retval = MPI_SUCCESS;
-  
+
     TRACE_smpi_ptp_out(rank, rank, dst_traced, __FUNCTION__);
   }
 
@@ -1034,7 +1037,7 @@ int PMPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype, int dst,
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!sendtype->is_valid() || !recvtype->is_valid()) {
+  } else if (not sendtype->is_valid() || not recvtype->is_valid()) {
     retval = MPI_ERR_TYPE;
   } else if (src == MPI_PROC_NULL || dst == MPI_PROC_NULL) {
     simgrid::smpi::Status::empty(status);
@@ -1043,7 +1046,7 @@ int PMPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype, int dst,
   }else if (dst >= comm->group()->size() || dst <0 ||
       (src!=MPI_ANY_SOURCE && (src >= comm->group()->size() || src <0))){
     retval = MPI_ERR_RANK;
-  } else if ((sendcount < 0 || recvcount<0) || 
+  } else if ((sendcount < 0 || recvcount<0) ||
       (sendbuf==nullptr && sendcount > 0) || (recvbuf==nullptr && recvcount>0)) {
     retval = MPI_ERR_COUNT;
   } else if((sendtag<0 && sendtag !=  MPI_ANY_TAG)||(recvtag<0 && recvtag != MPI_ANY_TAG)){
@@ -1088,7 +1091,7 @@ int PMPI_Sendrecv_replace(void* buf, int count, MPI_Datatype datatype, int dst,
                           MPI_Comm comm, MPI_Status* status)
 {
   int retval = 0;
-  if (!datatype->is_valid()) {
+  if (not datatype->is_valid()) {
     return MPI_ERR_TYPE;
   } else if (count < 0) {
     return MPI_ERR_COUNT;
@@ -1387,7 +1390,7 @@ int PMPI_Bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm c
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!datatype->is_valid()) {
+  } else if (not datatype->is_valid()) {
     retval = MPI_ERR_ARG;
   } else {
     int rank        = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
@@ -1658,8 +1661,8 @@ int PMPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (((comm->rank() == root) && (!sendtype->is_valid())) ||
-             ((recvbuf != MPI_IN_PLACE) && (!recvtype->is_valid()))) {
+  } else if (((comm->rank() == root) && (not sendtype->is_valid())) ||
+             ((recvbuf != MPI_IN_PLACE) && (not recvtype->is_valid()))) {
     retval = MPI_ERR_TYPE;
   } else if ((sendbuf == recvbuf) ||
       ((comm->rank()==root) && sendcount>0 && (sendbuf == nullptr))){
@@ -1757,7 +1760,7 @@ int PMPI_Reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!datatype->is_valid() || op == MPI_OP_NULL) {
+  } else if (not datatype->is_valid() || op == MPI_OP_NULL) {
     retval = MPI_ERR_ARG;
   } else {
     int rank               = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
@@ -1788,7 +1791,7 @@ int PMPI_Reduce_local(void *inbuf, void *inoutbuf, int count, MPI_Datatype datat
   int retval = 0;
 
   smpi_bench_end();
-  if (!datatype->is_valid() || op == MPI_OP_NULL) {
+  if (not datatype->is_valid() || op == MPI_OP_NULL) {
     retval = MPI_ERR_ARG;
   } else {
     op->apply(inbuf, inoutbuf, &count, datatype);
@@ -1806,7 +1809,7 @@ int PMPI_Allreduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatyp
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!datatype->is_valid()) {
+  } else if (not datatype->is_valid()) {
     retval = MPI_ERR_TYPE;
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
@@ -1850,7 +1853,7 @@ int PMPI_Scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MP
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!datatype->is_valid()) {
+  } else if (not datatype->is_valid()) {
     retval = MPI_ERR_TYPE;
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
@@ -1883,7 +1886,7 @@ int PMPI_Exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!datatype->is_valid()) {
+  } else if (not datatype->is_valid()) {
     retval = MPI_ERR_TYPE;
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
@@ -1922,7 +1925,7 @@ int PMPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts, MPI_Datat
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!datatype->is_valid()) {
+  } else if (not datatype->is_valid()) {
     retval = MPI_ERR_TYPE;
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
@@ -1975,7 +1978,7 @@ int PMPI_Reduce_scatter_block(void *sendbuf, void *recvbuf, int recvcount,
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!datatype->is_valid()) {
+  } else if (not datatype->is_valid()) {
     retval = MPI_ERR_TYPE;
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
@@ -2098,9 +2101,8 @@ int PMPI_Alltoallv(void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype
     extra->recvcounts      = xbt_new(int, size);
     extra->sendcounts      = xbt_new(int, size);
     int known              = 0;
-    int dt_size_recv       = 1;
     extra->datatype2       = encode_datatype(recvtype, &known);
-    dt_size_recv           = recvtype->size();
+    int dt_size_recv       = recvtype->size();
 
     void* sendtmpbuf         = static_cast<char*>(sendbuf);
     int* sendtmpcounts       = sendcounts;
@@ -2125,8 +2127,7 @@ int PMPI_Alltoallv(void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype
     }
 
     extra->datatype1 = encode_datatype(sendtmptype, &known);
-    int dt_size_send = 1;
-    dt_size_send     = sendtmptype->size();
+    int dt_size_send = sendtmptype->size();
 
     for (i = 0; i < size; i++) { // copy data to avoid bad free
       extra->send_size += sendtmpcounts[i] * dt_size_send;
@@ -2152,8 +2153,8 @@ int PMPI_Alltoallv(void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype
 
 int PMPI_Get_processor_name(char *name, int *resultlen)
 {
-  strncpy(name, SIMIX_host_self()->cname(), strlen(SIMIX_host_self()->cname()) < MPI_MAX_PROCESSOR_NAME - 1
-                                                ? strlen(SIMIX_host_self()->cname()) + 1
+  strncpy(name, sg_host_self()->getCname(), strlen(sg_host_self()->getCname()) < MPI_MAX_PROCESSOR_NAME - 1
+                                                ? strlen(sg_host_self()->getCname()) + 1
                                                 : MPI_MAX_PROCESSOR_NAME - 1);
   *resultlen = strlen(name) > MPI_MAX_PROCESSOR_NAME ? MPI_MAX_PROCESSOR_NAME : strlen(name);
 
@@ -2164,7 +2165,7 @@ int PMPI_Get_count(MPI_Status * status, MPI_Datatype datatype, int *count)
 {
   if (status == nullptr || count == nullptr) {
     return MPI_ERR_ARG;
-  } else if (!datatype->is_valid()) {
+  } else if (not datatype->is_valid()) {
     return MPI_ERR_TYPE;
   } else {
     size_t size = datatype->size();
@@ -2620,13 +2621,13 @@ int PMPI_Get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
     retval = MPI_SUCCESS;
   } else if (target_rank <0){
     retval = MPI_ERR_RANK;
-  } else if (win->dynamic()==0 && target_disp <0){ 
+  } else if (win->dynamic()==0 && target_disp <0){
     //in case of dynamic window, target_disp can be mistakenly seen as negative, as it is an address
     retval = MPI_ERR_ARG;
   } else if ((origin_count < 0 || target_count < 0) ||
              (origin_addr==nullptr && origin_count > 0)){
     retval = MPI_ERR_COUNT;
-  } else if ((!origin_datatype->is_valid()) || (!target_datatype->is_valid())) {
+  } else if ((not origin_datatype->is_valid()) || (not target_datatype->is_valid())) {
     retval = MPI_ERR_TYPE;
   } else {
     int rank = smpi_process()->index();
@@ -2655,13 +2656,13 @@ int PMPI_Rget( void *origin_addr, int origin_count, MPI_Datatype origin_datatype
     retval = MPI_SUCCESS;
   } else if (target_rank <0){
     retval = MPI_ERR_RANK;
-  } else if (win->dynamic()==0 && target_disp <0){ 
+  } else if (win->dynamic()==0 && target_disp <0){
     //in case of dynamic window, target_disp can be mistakenly seen as negative, as it is an address
     retval = MPI_ERR_ARG;
   } else if ((origin_count < 0 || target_count < 0) ||
              (origin_addr==nullptr && origin_count > 0)){
     retval = MPI_ERR_COUNT;
-  } else if ((!origin_datatype->is_valid()) || (!target_datatype->is_valid())) {
+  } else if ((not origin_datatype->is_valid()) || (not target_datatype->is_valid())) {
     retval = MPI_ERR_TYPE;
   } else if(request == nullptr){
     retval = MPI_ERR_REQUEST;
@@ -2691,13 +2692,13 @@ int PMPI_Put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
     retval = MPI_SUCCESS;
   } else if (target_rank <0){
     retval = MPI_ERR_RANK;
-  } else if (win->dynamic()==0 && target_disp <0){ 
+  } else if (win->dynamic()==0 && target_disp <0){
     //in case of dynamic window, target_disp can be mistakenly seen as negative, as it is an address
     retval = MPI_ERR_ARG;
   } else if ((origin_count < 0 || target_count < 0) ||
             (origin_addr==nullptr && origin_count > 0)){
     retval = MPI_ERR_COUNT;
-  } else if ((!origin_datatype->is_valid()) || (!target_datatype->is_valid())) {
+  } else if ((not origin_datatype->is_valid()) || (not target_datatype->is_valid())) {
     retval = MPI_ERR_TYPE;
   } else {
     int rank = smpi_process()->index();
@@ -2727,13 +2728,13 @@ int PMPI_Rput( void *origin_addr, int origin_count, MPI_Datatype origin_datatype
     retval = MPI_SUCCESS;
   } else if (target_rank <0){
     retval = MPI_ERR_RANK;
-  } else if (win->dynamic()==0 && target_disp <0){ 
+  } else if (win->dynamic()==0 && target_disp <0){
     //in case of dynamic window, target_disp can be mistakenly seen as negative, as it is an address
     retval = MPI_ERR_ARG;
   } else if ((origin_count < 0 || target_count < 0) ||
             (origin_addr==nullptr && origin_count > 0)){
     retval = MPI_ERR_COUNT;
-  } else if ((!origin_datatype->is_valid()) || (!target_datatype->is_valid())) {
+  } else if ((not origin_datatype->is_valid()) || (not target_datatype->is_valid())) {
     retval = MPI_ERR_TYPE;
   } else if(request == nullptr){
     retval = MPI_ERR_REQUEST;
@@ -2764,14 +2765,13 @@ int PMPI_Accumulate( void *origin_addr, int origin_count, MPI_Datatype origin_da
     retval = MPI_SUCCESS;
   } else if (target_rank <0){
     retval = MPI_ERR_RANK;
-  } else if (win->dynamic()==0 && target_disp <0){ 
+  } else if (win->dynamic()==0 && target_disp <0){
     //in case of dynamic window, target_disp can be mistakenly seen as negative, as it is an address
     retval = MPI_ERR_ARG;
   } else if ((origin_count < 0 || target_count < 0) ||
              (origin_addr==nullptr && origin_count > 0)){
     retval = MPI_ERR_COUNT;
-  } else if ((!origin_datatype->is_valid()) ||
-            (!target_datatype->is_valid())) {
+  } else if ((not origin_datatype->is_valid()) || (not target_datatype->is_valid())) {
     retval = MPI_ERR_TYPE;
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
@@ -2802,14 +2802,13 @@ int PMPI_Raccumulate( void *origin_addr, int origin_count, MPI_Datatype origin_d
     retval = MPI_SUCCESS;
   } else if (target_rank <0){
     retval = MPI_ERR_RANK;
-  } else if (win->dynamic()==0 && target_disp <0){ 
+  } else if (win->dynamic()==0 && target_disp <0){
     //in case of dynamic window, target_disp can be mistakenly seen as negative, as it is an address
     retval = MPI_ERR_ARG;
   } else if ((origin_count < 0 || target_count < 0) ||
              (origin_addr==nullptr && origin_count > 0)){
     retval = MPI_ERR_COUNT;
-  } else if ((!origin_datatype->is_valid()) ||
-            (!target_datatype->is_valid())) {
+  } else if ((not origin_datatype->is_valid()) || (not target_datatype->is_valid())) {
     retval = MPI_ERR_TYPE;
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
@@ -2831,8 +2830,8 @@ int PMPI_Raccumulate( void *origin_addr, int origin_count, MPI_Datatype origin_d
   return retval;
 }
 
-int PMPI_Get_accumulate(void *origin_addr, int origin_count, MPI_Datatype origin_datatype, void *result_addr, 
-int result_count, MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp, int target_count, 
+int PMPI_Get_accumulate(void *origin_addr, int origin_count, MPI_Datatype origin_datatype, void *result_addr,
+int result_count, MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp, int target_count,
 MPI_Datatype target_datatype, MPI_Op op, MPI_Win win){
   int retval = 0;
   smpi_bench_end();
@@ -2842,16 +2841,15 @@ MPI_Datatype target_datatype, MPI_Op op, MPI_Win win){
     retval = MPI_SUCCESS;
   } else if (target_rank <0){
     retval = MPI_ERR_RANK;
-  } else if (win->dynamic()==0 && target_disp <0){ 
+  } else if (win->dynamic()==0 && target_disp <0){
     //in case of dynamic window, target_disp can be mistakenly seen as negative, as it is an address
     retval = MPI_ERR_ARG;
   } else if ((origin_count < 0 || target_count < 0 || result_count <0) ||
              (origin_addr==nullptr && origin_count > 0 && op != MPI_NO_OP) ||
              (result_addr==nullptr && result_count > 0)){
     retval = MPI_ERR_COUNT;
-  } else if ((origin_datatype!=MPI_DATATYPE_NULL && !origin_datatype->is_valid()) ||
-            (!target_datatype->is_valid())||
-            (!result_datatype->is_valid())) {
+  } else if ((origin_datatype != MPI_DATATYPE_NULL && not origin_datatype->is_valid()) ||
+             (not target_datatype->is_valid()) || (not result_datatype->is_valid())) {
     retval = MPI_ERR_TYPE;
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
@@ -2862,8 +2860,8 @@ MPI_Datatype target_datatype, MPI_Op op, MPI_Win win){
     int src_traced = group->index(target_rank);
     TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__, nullptr);
 
-    retval = win->get_accumulate( origin_addr, origin_count, origin_datatype, result_addr, 
-                                  result_count, result_datatype, target_rank, target_disp, 
+    retval = win->get_accumulate( origin_addr, origin_count, origin_datatype, result_addr,
+                                  result_count, result_datatype, target_rank, target_disp,
                                   target_count, target_datatype, op);
 
     TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__);
@@ -2873,8 +2871,8 @@ MPI_Datatype target_datatype, MPI_Op op, MPI_Win win){
 }
 
 
-int PMPI_Rget_accumulate(void *origin_addr, int origin_count, MPI_Datatype origin_datatype, void *result_addr, 
-int result_count, MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp, int target_count, 
+int PMPI_Rget_accumulate(void *origin_addr, int origin_count, MPI_Datatype origin_datatype, void *result_addr,
+int result_count, MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp, int target_count,
 MPI_Datatype target_datatype, MPI_Op op, MPI_Win win, MPI_Request* request){
   int retval = 0;
   smpi_bench_end();
@@ -2885,16 +2883,15 @@ MPI_Datatype target_datatype, MPI_Op op, MPI_Win win, MPI_Request* request){
     retval = MPI_SUCCESS;
   } else if (target_rank <0){
     retval = MPI_ERR_RANK;
-  } else if (win->dynamic()==0 && target_disp <0){ 
+  } else if (win->dynamic()==0 && target_disp <0){
     //in case of dynamic window, target_disp can be mistakenly seen as negative, as it is an address
     retval = MPI_ERR_ARG;
   } else if ((origin_count < 0 || target_count < 0 || result_count <0) ||
              (origin_addr==nullptr && origin_count > 0 && op != MPI_NO_OP) ||
              (result_addr==nullptr && result_count > 0)){
     retval = MPI_ERR_COUNT;
-  } else if ((origin_datatype!=MPI_DATATYPE_NULL && !origin_datatype->is_valid()) ||
-            (!target_datatype->is_valid())||
-            (!result_datatype->is_valid())) {
+  } else if ((origin_datatype != MPI_DATATYPE_NULL && not origin_datatype->is_valid()) ||
+             (not target_datatype->is_valid()) || (not result_datatype->is_valid())) {
     retval = MPI_ERR_TYPE;
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
@@ -2907,8 +2904,8 @@ MPI_Datatype target_datatype, MPI_Op op, MPI_Win win, MPI_Request* request){
     int src_traced = group->index(target_rank);
     TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__, nullptr);
 
-    retval = win->get_accumulate( origin_addr, origin_count, origin_datatype, result_addr, 
-                                  result_count, result_datatype, target_rank, target_disp, 
+    retval = win->get_accumulate( origin_addr, origin_count, origin_datatype, result_addr,
+                                  result_count, result_datatype, target_rank, target_disp,
                                   target_count, target_datatype, op, request);
 
     TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__);
@@ -2932,12 +2929,12 @@ int PMPI_Compare_and_swap(void *origin_addr, void *compare_addr,
     retval = MPI_SUCCESS;
   } else if (target_rank <0){
     retval = MPI_ERR_RANK;
-  } else if (win->dynamic()==0 && target_disp <0){ 
+  } else if (win->dynamic()==0 && target_disp <0){
     //in case of dynamic window, target_disp can be mistakenly seen as negative, as it is an address
     retval = MPI_ERR_ARG;
   } else if (origin_addr==nullptr || result_addr==nullptr || compare_addr==nullptr){
     retval = MPI_ERR_COUNT;
-  } else if (!datatype->is_valid()) {
+  } else if (not datatype->is_valid()) {
     retval = MPI_ERR_TYPE;
   } else {
     int rank = smpi_process()->index();
@@ -2946,7 +2943,7 @@ int PMPI_Compare_and_swap(void *origin_addr, void *compare_addr,
     int src_traced = group->index(target_rank);
     TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__, nullptr);
 
-    retval = win->compare_and_swap( origin_addr, compare_addr, result_addr, datatype, 
+    retval = win->compare_and_swap( origin_addr, compare_addr, result_addr, datatype,
                                   target_rank, target_disp);
 
     TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__);
@@ -3028,10 +3025,10 @@ int PMPI_Win_lock(int lock_type, int rank, int assert, MPI_Win win){
   smpi_bench_end();
   if (win == MPI_WIN_NULL) {
     retval = MPI_ERR_WIN;
-  } else if (lock_type != MPI_LOCK_EXCLUSIVE && 
+  } else if (lock_type != MPI_LOCK_EXCLUSIVE &&
              lock_type != MPI_LOCK_SHARED) {
     retval = MPI_ERR_LOCKTYPE;
-  } else if (rank == MPI_PROC_NULL){ 
+  } else if (rank == MPI_PROC_NULL){
     retval = MPI_SUCCESS;
   } else {
     int myrank = smpi_process()->index();
@@ -3048,7 +3045,7 @@ int PMPI_Win_unlock(int rank, MPI_Win win){
   smpi_bench_end();
   if (win == MPI_WIN_NULL) {
     retval = MPI_ERR_WIN;
-  } else if (rank == MPI_PROC_NULL){ 
+  } else if (rank == MPI_PROC_NULL){
     retval = MPI_SUCCESS;
   } else {
     int myrank = smpi_process()->index();
@@ -3095,7 +3092,7 @@ int PMPI_Win_flush(int rank, MPI_Win win){
   smpi_bench_end();
   if (win == MPI_WIN_NULL) {
     retval = MPI_ERR_WIN;
-  } else if (rank == MPI_PROC_NULL){ 
+  } else if (rank == MPI_PROC_NULL){
     retval = MPI_SUCCESS;
   } else {
     int myrank = smpi_process()->index();
@@ -3112,7 +3109,7 @@ int PMPI_Win_flush_local(int rank, MPI_Win win){
   smpi_bench_end();
   if (win == MPI_WIN_NULL) {
     retval = MPI_ERR_WIN;
-  } else if (rank == MPI_PROC_NULL){ 
+  } else if (rank == MPI_PROC_NULL){
     retval = MPI_SUCCESS;
   } else {
     int myrank = smpi_process()->index();
@@ -3502,7 +3499,7 @@ int PMPI_Info_get_valuelen( MPI_Info info, char *key, int *valuelen, int *flag){
 int PMPI_Unpack(void* inbuf, int incount, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm) {
   if(incount<0 || outcount < 0 || inbuf==nullptr || outbuf==nullptr)
     return MPI_ERR_ARG;
-  if(!type->is_valid())
+  if (not type->is_valid())
     return MPI_ERR_TYPE;
   if(comm==MPI_COMM_NULL)
     return MPI_ERR_COMM;
@@ -3512,7 +3509,7 @@ int PMPI_Unpack(void* inbuf, int incount, int* position, void* outbuf, int outco
 int PMPI_Pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm) {
   if(incount<0 || outcount < 0|| inbuf==nullptr || outbuf==nullptr)
     return MPI_ERR_ARG;
-  if(!type->is_valid())
+  if (not type->is_valid())
     return MPI_ERR_TYPE;
   if(comm==MPI_COMM_NULL)
     return MPI_ERR_COMM;
@@ -3522,7 +3519,7 @@ int PMPI_Pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int out
 int PMPI_Pack_size(int incount, MPI_Datatype datatype, MPI_Comm comm, int* size) {
   if(incount<0)
     return MPI_ERR_ARG;
-  if(!datatype->is_valid())
+  if (not datatype->is_valid())
     return MPI_ERR_TYPE;
   if(comm==MPI_COMM_NULL)
     return MPI_ERR_COMM;