Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines.
[simgrid.git] / src / smpi / colls / bcast / bcast-mvapich-smp.cpp
index 70239f6..ff2d754 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2019. The SimGrid Team.
+/* Copyright (c) 2013-2021. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -91,12 +91,11 @@ int bcast__mvapich2_inter_node(void *buffer,
     rank = comm->rank();
     //comm_size = comm->size();
 
-
-    if (MV2_Bcast_function==NULL){
+    if (MV2_Bcast_function == nullptr) {
       MV2_Bcast_function = bcast__mpich;
     }
 
-    if (MV2_Bcast_intra_node_function==NULL){
+    if (MV2_Bcast_intra_node_function == nullptr) {
       MV2_Bcast_intra_node_function = bcast__mpich;
     }
 
@@ -179,11 +178,11 @@ int bcast__mvapich2_knomial_intra_node(void *buffer,
     int mpi_errno = MPI_SUCCESS;
     int src, dst, mask, relative_rank;
     int k;
-    if (MV2_Bcast_function==NULL){
+    if (MV2_Bcast_function == nullptr) {
       MV2_Bcast_function = bcast__mpich;
     }
 
-    if (MV2_Bcast_intra_node_function==NULL){
+    if (MV2_Bcast_intra_node_function == nullptr) {
       MV2_Bcast_intra_node_function = bcast__mpich;
     }
 
@@ -194,9 +193,9 @@ int bcast__mvapich2_knomial_intra_node(void *buffer,
     local_size = comm->size();
     rank = comm->rank();
 
-    MPI_Request* reqarray = new MPI_Request[2 * mv2_intra_node_knomial_factor];
+    auto* reqarray = new MPI_Request[2 * mv2_intra_node_knomial_factor];
 
-    MPI_Status* starray = new MPI_Status[2 * mv2_intra_node_knomial_factor];
+    auto* starray = new MPI_Status[2 * mv2_intra_node_knomial_factor];
 
     /* intra-node k-nomial bcast  */
     if (local_size > 1) {
@@ -250,20 +249,20 @@ int bcast__mvapich2_intra_node(void *buffer,
 {
     int mpi_errno = MPI_SUCCESS;
     int comm_size;
-    int two_level_bcast = 1;
+    bool two_level_bcast = true;
     size_t nbytes = 0;
-    int is_homogeneous, is_contig;
+    bool is_homogeneous, is_contig;
     MPI_Aint type_size;
     unsigned char* tmp_buf = nullptr;
     MPI_Comm shmem_comm;
 
     if (count == 0)
         return MPI_SUCCESS;
-    if (MV2_Bcast_function==NULL){
+    if (MV2_Bcast_function == nullptr) {
       MV2_Bcast_function = bcast__mpich;
     }
 
-    if (MV2_Bcast_intra_node_function==NULL){
+    if (MV2_Bcast_intra_node_function == nullptr) {
       MV2_Bcast_intra_node_function = bcast__mpich;
     }
 
@@ -275,16 +274,16 @@ int bcast__mvapich2_intra_node(void *buffer,
    // rank = comm->rank();
 /*
     if (HANDLE_GET_KIND(datatype) == HANDLE_KIND_BUILTIN)*/
-        is_contig = 1;
+        is_contig = true;
 /*    else {
         MPID_Datatype_get_ptr(datatype, dtp);
         is_contig = dtp->is_contig;
     }
 */
-    is_homogeneous = 1;
+    is_homogeneous = true;
 #ifdef MPID_HAS_HETERO
     if (comm_ptr->is_hetero)
-        is_homogeneous = 0;
+      is_homogeneous = false;
 #endif
 
     /* MPI_Type_size() might not give the accurate size of the packed
@@ -303,13 +302,13 @@ int bcast__mvapich2_intra_node(void *buffer,
     nbytes = (size_t) (count) * (type_size);
     if (comm_size <= mv2_bcast_two_level_system_size) {
         if (nbytes > mv2_bcast_short_msg && nbytes < mv2_bcast_large_msg) {
-            two_level_bcast = 1;
+          two_level_bcast = true;
         } else {
-            two_level_bcast = 0;
+          two_level_bcast = false;
         }
     }
 
-    if (two_level_bcast == 1
+    if (two_level_bcast
 #if defined(_MCST_SUPPORT_)
             || comm_ptr->ch.is_mcast_ok
 #endif