Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Modern C++ use "auto".
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 5 Oct 2020 20:59:22 +0000 (22:59 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 6 Oct 2020 09:24:00 +0000 (11:24 +0200)
Clang-tidy enabled checks:
    modernize-use-auto

54 files changed:
examples/s4u/app-bittorrent/s4u-peer.cpp
examples/s4u/dht-kademlia/s4u-dht-kademlia.cpp
examples/s4u/network-ns3/s4u-network-ns3.cpp
src/bindings/java/jmsg.cpp
src/bindings/java/jmsg_comm.cpp
src/bindings/java/jmsg_host.cpp
src/bindings/java/jmsg_process.cpp
src/bindings/java/jmsg_synchro.cpp
src/bindings/java/jmsg_task.cpp
src/bindings/java/jmsg_vm.cpp
src/bindings/java/jxbt_utilities.cpp
src/instr/instr_paje_trace.cpp
src/instr/instr_platform.cpp
src/kernel/routing/FatTreeZone.cpp
src/kernel/routing/VivaldiZone.cpp
src/plugins/file_system/s4u_FileSystem.cpp
src/plugins/host_energy.cpp
src/plugins/link_energy.cpp
src/simgrid/util.hpp
src/smpi/colls/allgather/allgather-2dmesh.cpp
src/smpi/colls/allgather/allgather-3dmesh.cpp
src/smpi/colls/allgather/allgather-NTSLR-NB.cpp
src/smpi/colls/allgather/allgather-SMP-NTS.cpp
src/smpi/colls/allgather/allgather-smp-simple.cpp
src/smpi/colls/allgather/allgather-spreading-simple.cpp
src/smpi/colls/alltoall/alltoall-2dmesh.cpp
src/smpi/colls/alltoall/alltoall-3dmesh.cpp
src/smpi/colls/alltoall/alltoall-basic-linear.cpp
src/smpi/colls/alltoall/alltoall-mvapich-scatter-dest.cpp
src/smpi/colls/alltoallv/alltoallv-bruck.cpp
src/smpi/colls/alltoallv/alltoallv-ompi-basic-linear.cpp
src/smpi/colls/bcast/bcast-NTSB.cpp
src/smpi/colls/bcast/bcast-NTSL-Isend.cpp
src/smpi/colls/bcast/bcast-NTSL.cpp
src/smpi/colls/bcast/bcast-SMP-binary.cpp
src/smpi/colls/bcast/bcast-SMP-linear.cpp
src/smpi/colls/bcast/bcast-arrival-pattern-aware-wait.cpp
src/smpi/colls/bcast/bcast-arrival-pattern-aware.cpp
src/smpi/colls/bcast/bcast-flattree-pipeline.cpp
src/smpi/colls/bcast/bcast-flattree.cpp
src/smpi/colls/bcast/bcast-mvapich-smp.cpp
src/smpi/colls/gather/gather-ompi.cpp
src/smpi/colls/reduce/reduce-NTSL.cpp
src/smpi/colls/reduce/reduce-arrival-pattern-aware.cpp
src/smpi/colls/reduce/reduce-mvapich-knomial.cpp
src/smpi/colls/reduce/reduce-ompi.cpp
src/smpi/colls/smpi_coll.cpp
src/smpi/colls/smpi_mvapich2_selector_stampede.hpp
src/smpi/colls/smpi_nbc_impl.cpp
src/smpi/internals/smpi_bench.cpp
src/smpi/internals/smpi_replay.cpp
src/smpi/mpi/smpi_win.cpp
src/surf/network_ib.cpp
src/surf/network_ns3.cpp

index fe653ac..1b34b49 100644 (file)
@@ -552,7 +552,7 @@ void Peer::updateChokedPeers()
       int j = 0;
       do {
         // We choose a random peer to unchoke.
-        std::unordered_map<int, Connection>::iterator chosen_peer_it = connected_peers.begin();
+        auto chosen_peer_it = connected_peers.begin();
         std::advance(chosen_peer_it, random.uniform_int(0, static_cast<int>(connected_peers.size() - 1)));
         chosen_peer = &chosen_peer_it->second;
         if (not chosen_peer->interested || not chosen_peer->choked_upload)
index 6d595d8..60362b8 100644 (file)
@@ -23,14 +23,14 @@ static void node(int argc, char* argv[])
   double deadline;
   xbt_assert(argc == 3 || argc == 4, "Wrong number of arguments");
   /* Node initialization */
-  unsigned int node_id = static_cast<unsigned int>(strtoul(argv[1], nullptr, 0));
+  auto node_id = static_cast<unsigned int>(strtoul(argv[1], nullptr, 0));
   kademlia::Node node(node_id);
 
   if (argc == 4) {
     XBT_INFO("Hi, I'm going to join the network with id %u", node.getId());
-    unsigned int known_id = static_cast<unsigned int>(strtoul(argv[2], nullptr, 0));
-    join_success          = node.join(known_id);
-    deadline              = std::stod(argv[3]);
+    auto known_id = static_cast<unsigned int>(strtoul(argv[2], nullptr, 0));
+    join_success  = node.join(known_id);
+    deadline      = std::stod(argv[3]);
   } else {
     deadline = std::stod(argv[2]);
     XBT_INFO("Hi, I'm going to create the network with id %u", node.getId());
index 3c150a4..83e4f0a 100644 (file)
@@ -32,8 +32,7 @@ static void master(int argc, char* argv[])
 
   masternames[id] = simgrid::s4u::Host::current()->get_cname();
 
-  double* payload = new double();
-  *payload        = msg_size;
+  auto* payload = new double(msg_size);
 
   count_finished++;
   timer_start = 1;
index 92f1b46..6c984d7 100644 (file)
@@ -106,7 +106,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_init(JNIEnv* env, jclass, jobjec
 
   args.emplace_back("java");
   for (int index = 1; index < argc; index++) {
-    jstring jval    = (jstring)env->GetObjectArrayElement(jargs, index - 1);
+    auto jval       = (jstring)env->GetObjectArrayElement(jargs, index - 1);
     const char* tmp = env->GetStringUTFChars(jval, nullptr);
     args.emplace_back(tmp);
     env->ReleaseStringUTFChars(jval, tmp);
@@ -138,7 +138,7 @@ JNIEXPORT void JNICALL JNICALL Java_org_simgrid_msg_Msg_run(JNIEnv* env, jclass)
   sg_host_t* hosts  = sg_host_list();
   size_t host_count = sg_host_count();
   for (size_t index = 0; index < host_count - 1; index++) {
-    jobject jhost = (jobject)hosts[index]->extension(JAVA_HOST_LEVEL);
+    auto jhost = (jobject)hosts[index]->extension(JAVA_HOST_LEVEL);
     if (jhost)
       jhost_unref(env, jhost);
   }
@@ -277,8 +277,7 @@ static void run_jprocess(JNIEnv *env, jobject jprocess)
 static void java_main(int argc, char* argv[])
 {
   JNIEnv *env = get_current_thread_env();
-  simgrid::kernel::context::JavaContext* context =
-      static_cast<simgrid::kernel::context::JavaContext*>(simgrid::kernel::context::Context::self());
+  auto* context = static_cast<simgrid::kernel::context::JavaContext*>(simgrid::kernel::context::Context::self());
 
   //Change the "." in class name for "/".
   std::string arg0 = argv[0];
@@ -292,8 +291,8 @@ static void java_main(int argc, char* argv[])
   //Retrieve the name of the process.
   jstring jname = env->NewStringUTF(argv[0]);
   //Build the arguments
-  jobjectArray args = static_cast<jobjectArray>(env->NewObjectArray(argc - 1, env->FindClass("java/lang/String"),
-                                                                    env->NewStringUTF("")));
+  auto args = static_cast<jobjectArray>(
+      env->NewObjectArray(argc - 1, env->FindClass("java/lang/String"), env->NewStringUTF("")));
   for (int i = 1; i < argc; i++)
       env->SetObjectArrayElement(args,i - 1, env->NewStringUTF(argv[i]));
   //Retrieve the host for the process.
@@ -323,7 +322,7 @@ namespace context {
 void java_main_jprocess(jobject jprocess)
 {
   JNIEnv *env = get_current_thread_env();
-  JavaContext* context = static_cast<JavaContext*>(Context::self());
+  auto* context        = static_cast<JavaContext*>(Context::self());
   context->jprocess_   = jprocess;
   jprocess_bind(context->jprocess_, sg_actor_self(), env);
 
index 76f56d9..0e4ed68 100644 (file)
@@ -27,7 +27,7 @@ void jcomm_bind_task(JNIEnv *env, jobject jcomm) {
     //bind the task object.
     msg_task_t task = MSG_comm_get_task(comm);
     xbt_assert(task != nullptr, "Task is nullptr");
-    jobject jtask_global = static_cast<jobject>(MSG_task_get_data(task));
+    auto jtask_global = static_cast<jobject>(MSG_task_get_data(task));
     //case where the data has already been retrieved
     if (jtask_global == nullptr) {
       return;
@@ -95,7 +95,7 @@ JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Comm_test(JNIEnv *env, jobject j
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Comm_waitCompletion(JNIEnv *env, jobject jcomm, jdouble timeout) {
-  msg_comm_t comm = (msg_comm_t) (uintptr_t) env->GetLongField(jcomm, jcomm_field_Comm_bind);
+  auto comm = (msg_comm_t)(uintptr_t)env->GetLongField(jcomm, jcomm_field_Comm_bind);
   if (not comm) {
     jxbt_throw_null(env, "comm is null");
     return;
@@ -119,7 +119,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Comm_waitCompletion(JNIEnv *env, job
 static msg_comm_t* jarray_to_commArray(JNIEnv *env, jobjectArray jcomms, /* OUT */ int *count)
 {
   *count = env->GetArrayLength(jcomms);
-  msg_comm_t* comms = new msg_comm_t[*count];
+  auto* comms = new msg_comm_t[*count];
 
   for (int i=0; i < *count; i++) {
      jobject jcomm = env->GetObjectArrayElement(jcomms, i);
index 75c2ad4..655f1ed 100644 (file)
@@ -309,7 +309,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_all(JNIEnv * env, jclas
   }
 
   for (int index = 0; index < count; index++) {
-    jobject jhost = static_cast<jobject>(table[index]->extension(JAVA_HOST_LEVEL));
+    auto jhost = static_cast<jobject>(table[index]->extension(JAVA_HOST_LEVEL));
 
     if (not jhost) {
       jstring jname = env->NewStringUTF(table[index]->get_cname());
index bf00535..2e6c77b 100644 (file)
@@ -70,7 +70,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_create(JNIEnv* env, jobject
   jobject jprocess = jprocess_ref(jprocess_arg, env);
 
   /* Actually build the MSG process */
-  jstring jname     = (jstring)env->GetObjectField(jprocess, jprocess_field_Process_name);
+  auto jname        = (jstring)env->GetObjectField(jprocess, jprocess_field_Process_name);
   const char* name  = env->GetStringUTFChars(jname, nullptr);
   auto actor_code   = [jprocess]() { simgrid::kernel::context::java_main_jprocess(jprocess); };
   smx_actor_t self  = SIMIX_process_self();
index 157f37b..fc46042 100644 (file)
@@ -28,7 +28,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Mutex_init(JNIEnv * env, jobject obj
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Mutex_acquire(JNIEnv * env, jobject obj) {
-  sg_mutex_t mutex = (sg_mutex_t)(uintptr_t)env->GetLongField(obj, jsynchro_field_Mutex_bind);
+  auto mutex = (sg_mutex_t)(uintptr_t)env->GetLongField(obj, jsynchro_field_Mutex_bind);
   sg_mutex_lock(mutex);
 }
 
index 884a6cc..0bd50d6 100644 (file)
@@ -76,8 +76,8 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_parallelCreate(JNIEnv * env, jo
   int host_count = env->GetArrayLength(jhosts);
 
   jdouble* jcomputeDurations = env->GetDoubleArrayElements(jcomputeDurations_arg, nullptr);
-  msg_host_t* hosts          = new msg_host_t[host_count];
-  double* computeDurations   = new double[host_count];
+  auto* hosts                = new msg_host_t[host_count];
+  auto* computeDurations     = new double[host_count];
   for (int index = 0; index < host_count; index++) {
     jobject jhost           = env->GetObjectArrayElement(jhosts, index);
     hosts[index] = jhost_get_native(env, jhost);
@@ -86,7 +86,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_parallelCreate(JNIEnv * env, jo
   env->ReleaseDoubleArrayElements(jcomputeDurations_arg, jcomputeDurations, 0);
 
   jdouble* jmessageSizes = env->GetDoubleArrayElements(jmessageSizes_arg, nullptr);
-  double* messageSizes   = new double[host_count * host_count];
+  auto* messageSizes     = new double[host_count * host_count];
   for (int index = 0; index < host_count * host_count; index++) {
     messageSizes[index] = jmessageSizes[index];
   }
@@ -294,7 +294,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_receive(JNIEnv* env, jclass
     jmsg_throw_status(env, rv);
     return nullptr;
   }
-  jobject jtask_global = (jobject) MSG_task_get_data(task);
+  auto jtask_global = (jobject)MSG_task_get_data(task);
 
   /* Convert the global ref into a local ref so that the JVM can free the stuff */
   jobject jtask_local = env->NewLocalRef(jtask_global);
@@ -310,7 +310,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_irecv(JNIEnv * env, jclass c
     return nullptr;
 
   //pointer to store the task object pointer.
-  msg_task_t* task = new msg_task_t(nullptr);
+  auto* task = new msg_task_t(nullptr);
   /* There should be a cache here */
 
   jobject jcomm = env->NewObject(comm_class, jtask_method_Comm_constructor);
@@ -343,7 +343,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_receiveBounded(JNIEnv* env,
     jmsg_throw_status(env, res);
     return nullptr;
   }
-  jobject jtask_global = (jobject)MSG_task_get_data(task);
+  auto jtask_global = (jobject)MSG_task_get_data(task);
 
   /* Convert the global ref into a local ref so that the JVM can free the stuff */
   jobject jtask_local = env->NewLocalRef(jtask_global);
@@ -363,7 +363,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_irecvBounded(JNIEnv * env, j
     return nullptr;
 
   // pointer to store the task object pointer.
-  msg_task_t* task = new msg_task_t(nullptr);
+  auto* task = new msg_task_t(nullptr);
 
   jobject jcomm = env->NewObject(comm_class, jtask_method_Comm_constructor);
   if (not jcomm) {
@@ -464,10 +464,10 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_nativeFinalize(JNIEnv * env, jo
 }
 
 static void msg_task_cancel_on_failed_dsend(void*t) {
-  msg_task_t task = (msg_task_t) t;
+  auto task       = (msg_task_t)t;
   JNIEnv* env     = get_current_thread_env();
   if (env) {
-    jobject jtask_global = (jobject)MSG_task_get_data(task);
+    auto jtask_global = (jobject)MSG_task_get_data(task);
     /* Destroy the global ref so that the JVM can free the stuff */
     env->DeleteGlobalRef(jtask_global);
     /* Don't free the C data here, to avoid a race condition with the GC also sometimes doing so.
index 6cebf90..8e3193b 100644 (file)
@@ -89,9 +89,9 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_VM_all(JNIEnv* env, jclass c
   std::vector<jobject> vms;
 
   for (size_t i = 0; i < host_count; i++) {
-    simgrid::s4u::VirtualMachine* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(hosts[i]);
+    auto* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(hosts[i]);
     if (vm != nullptr && vm->get_state() != simgrid::s4u::VirtualMachine::state::DESTROYED) {
-      jobject jvm = static_cast<jobject>(vm->extension(JAVA_HOST_LEVEL));
+      auto jvm = static_cast<jobject>(vm->extension(JAVA_HOST_LEVEL));
       vms.push_back(jvm);
     }
   }
index 9eb4936..9907ef0 100644 (file)
@@ -33,7 +33,7 @@ jmethodID jxbt_get_jmethod(JNIEnv * env, jclass cls, const char *name, const cha
 
   if (not id) {
     jmethodID tostr_id = env->GetMethodID(cls, "getName", "()Ljava/lang/String;");
-    jstring jclassname = (jstring) env->CallObjectMethod(cls, tostr_id, nullptr);
+    auto jclassname       = (jstring)env->CallObjectMethod(cls, tostr_id, nullptr);
     const char* classname = env->GetStringUTFChars(jclassname, nullptr);
 
     env->ReleaseStringUTFChars(jclassname, classname);
@@ -55,7 +55,7 @@ jmethodID jxbt_get_static_jmethod(JNIEnv * env, jclass cls, const char *name, co
 
   if (not id) {
     jmethodID tostr_id = env->GetMethodID(cls, "getName", "()Ljava/lang/String;");
-    jstring jclassname = (jstring) env->CallObjectMethod(cls, tostr_id, nullptr);
+    auto jclassname       = (jstring)env->CallObjectMethod(cls, tostr_id, nullptr);
     const char* classname = env->GetStringUTFChars(jclassname, nullptr);
 
     env->ReleaseStringUTFChars(jclassname, classname);
@@ -114,7 +114,7 @@ jfieldID jxbt_get_jfield(JNIEnv * env, jclass cls, const char *name, const char
 
   if (not id) {
     jmethodID getname_id = env->GetMethodID(cls, "getName", "()Ljava/lang/String;");
-    jstring jclassname = (jstring) env->CallObjectMethod(cls, getname_id, nullptr);
+    auto jclassname       = (jstring)env->CallObjectMethod(cls, getname_id, nullptr);
     const char* classname = env->GetStringUTFChars(jclassname, nullptr);
 
     env->ReleaseStringUTFChars(jclassname, classname);
index 45113de..1c6c1c4 100644 (file)
@@ -32,7 +32,7 @@ void dump_buffer(bool force)
     }
     buffer.clear();
   } else {
-    std::vector<PajeEvent*>::iterator i = buffer.begin();
+    auto i = buffer.begin();
     for (auto const& event : buffer) {
       double head_timestamp = event->timestamp_;
       if (head_timestamp > last_timestamp_to_dump)
index 26acc23..6e82562 100644 (file)
@@ -270,7 +270,7 @@ static void on_netzone_creation(s4u::NetZone const& netzone)
     xbt_assert(Container::get_root() == root);
 
     if (TRACE_smpi_is_enabled()) {
-      ContainerType* mpi = root->type_->by_name_or_create<ContainerType>("MPI");
+      auto* mpi = root->type_->by_name_or_create<ContainerType>("MPI");
       if (not TRACE_smpi_is_grouped())
         mpi->by_name_or_create<StateType>("MPI_STATE");
       root->type_->by_name_or_create("MPI_LINK", mpi, mpi);
@@ -332,7 +332,7 @@ static void on_host_creation(s4u::Host const& host)
     container->type_->by_name_or_create("speed_used", "0.5 0.5 0.5");
 
   if (TRACE_smpi_is_enabled() && TRACE_smpi_is_grouped()) {
-    ContainerType* mpi = container->type_->by_name_or_create<ContainerType>("MPI");
+    auto* mpi = container->type_->by_name_or_create<ContainerType>("MPI");
     mpi->by_name_or_create<StateType>("MPI_STATE");
     // TODO See if we can move this to the LoadBalancer plugin
     root->type_->by_name_or_create("MIGRATE_LINK", mpi, mpi);
@@ -381,8 +381,8 @@ static void on_actor_creation(s4u::Actor const& actor)
   std::string container_name = instr_pid(actor);
 
   container->create_child(container_name, "ACTOR");
-  ContainerType* actor_type = container->type_->by_name_or_create<ContainerType>("ACTOR");
-  StateType* state          = actor_type->by_name_or_create<StateType>("ACTOR_STATE");
+  auto* actor_type = container->type_->by_name_or_create<ContainerType>("ACTOR");
+  auto* state      = actor_type->by_name_or_create<StateType>("ACTOR_STATE");
   state->add_entity_value("suspend", "1 0 1");
   state->add_entity_value("sleep", "1 1 0");
   state->add_entity_value("receive", "1 0 0");
@@ -418,8 +418,8 @@ static void on_vm_creation(s4u::Host const& host)
 {
   const Container* container = new HostContainer(host, currentContainer.back());
   const Container* root      = Container::get_root();
-  ContainerType* vm          = container->type_->by_name_or_create<ContainerType>("VM");
-  StateType* state           = vm->by_name_or_create<StateType>("VM_STATE");
+  auto* vm                   = container->type_->by_name_or_create<ContainerType>("VM");
+  auto* state                = vm->by_name_or_create<StateType>("VM_STATE");
   state->add_entity_value("suspend", "1 0 1");
   state->add_entity_value("sleep", "1 1 0");
   state->add_entity_value("receive", "1 0 0");
index d891b6f..a10cbab 100644 (file)
@@ -178,7 +178,7 @@ void FatTreeZone::seal()
 
 int FatTreeZone::connect_node_to_parents(FatTreeNode* node)
 {
-  std::vector<FatTreeNode*>::iterator currentParentNode = this->nodes_.begin();
+  auto currentParentNode                                = this->nodes_.begin();
   int connectionsNumber                                 = 0;
   const int level                                       = node->level;
   XBT_DEBUG("We are connecting node %d(%u,%u) to his parents.", node->id, node->level, node->position);
index be055b4..0cfec03 100644 (file)
@@ -55,7 +55,7 @@ static inline double euclidean_dist_comp(int index, std::vector<double>* src, st
 
 static std::vector<double>* netpoint_get_coords(NetPoint* np)
 {
-  vivaldi::Coords* coords = np->extension<vivaldi::Coords>();
+  auto* coords = np->extension<vivaldi::Coords>();
   xbt_assert(coords, "Please specify the Vivaldi coordinates of %s %s (%p)",
              (np->is_netzone() ? "Netzone" : (np->is_host() ? "Host" : "Router")), np->get_cname(), np);
   return &coords->coords;
index 628c813..516b680 100644 (file)
@@ -106,7 +106,7 @@ File::File(const std::string& fullpath, sg_host_t host, void* userdata) : fullpa
     }
 
     // assign a file descriptor id to the newly opened File
-    FileDescriptorHostExt* ext = host->extension<simgrid::s4u::FileDescriptorHostExt>();
+    auto* ext = host->extension<simgrid::s4u::FileDescriptorHostExt>();
     if (ext->file_descriptor_table == nullptr) {
       ext->file_descriptor_table = std::make_unique<std::vector<int>>(sg_storage_max_file_descriptors);
       std::iota(ext->file_descriptor_table->rbegin(), ext->file_descriptor_table->rend(), 0); // Fill with ..., 1, 0.
index 9f6dc51..1fe7043 100644 (file)
@@ -481,7 +481,7 @@ static void on_action_state_change(simgrid::kernel::resource::CpuAction const& a
         host = vm->get_pm();
 
       // Get the host_energy extension for the relevant host
-      HostEnergy* host_energy = host->extension<HostEnergy>();
+      auto* host_energy = host->extension<HostEnergy>();
 
       if (host_energy->get_last_update_time() < surf_get_clock())
         host_energy->update();
@@ -496,7 +496,7 @@ static void on_host_change(simgrid::s4u::Host const& host)
   if (dynamic_cast<simgrid::s4u::VirtualMachine const*>(&host)) // Ignore virtual machines
     return;
 
-  HostEnergy* host_energy = host.extension<HostEnergy>();
+  auto* host_energy = host.extension<HostEnergy>();
 
   host_energy->update();
 }
index 3d68a3b..8b8699e 100644 (file)
@@ -156,7 +156,7 @@ static void on_communicate(const simgrid::kernel::resource::NetworkAction& actio
       continue;
 
     XBT_DEBUG("Update link %s", link->get_cname());
-    LinkEnergy* link_energy = link->get_iface()->extension<LinkEnergy>();
+    auto* link_energy = link->get_iface()->extension<LinkEnergy>();
     link_energy->init_watts_range_list();
     link_energy->update();
   }
index 634a6f2..d022134 100644 (file)
@@ -17,7 +17,7 @@ template<typename C, typename K>
 inline XBT_PRIVATE
 typename C::mapped_type* find_map_ptr(C& c, K const& k)
 {
-  typename C::iterator i = c.find(k);
+  auto i = c.find(k);
   if (i == c.end())
     return nullptr;
   else
index 10f41b5..6e6ffd6 100644 (file)
@@ -139,7 +139,7 @@ allgather__2dmesh(const void *send_buff, int send_count, MPI_Datatype
   if (Y > X)
     num_reqs = Y;
 
-  MPI_Request* req     = new MPI_Request[num_reqs];
+  auto* req            = new MPI_Request[num_reqs];
   MPI_Request* req_ptr = req;
 
   // do local allgather/local copy
index b0a1002..c642b58 100644 (file)
@@ -131,7 +131,7 @@ int allgather__3dmesh(const void *send_buff, int send_count,
 
   block_size = extent * send_count;
 
-  MPI_Request* req     = new MPI_Request[num_reqs];
+  auto* req            = new MPI_Request[num_reqs];
   MPI_Request* req_ptr = req;
 
   // do local allgather/local copy
index 116e152..623efe8 100644 (file)
@@ -25,8 +25,8 @@ allgather__NTSLR_NB(const void *sbuf, int scount, MPI_Datatype stype,
   size = comm->size();
   rextent = rtype->get_extent();
   sextent = stype->get_extent();
-  MPI_Request* rrequest_array = new MPI_Request[size];
-  MPI_Request* srequest_array = new MPI_Request[size];
+  auto* rrequest_array = new MPI_Request[size];
+  auto* srequest_array = new MPI_Request[size];
 
   // irregular case use default MPI functions
   if (scount * sextent != rcount * rextent) {
index f6c91ab..a185059 100644 (file)
@@ -85,8 +85,8 @@ int allgather__SMP_NTS(const void *sbuf, int scount,
 
   // root of each SMP
   if (intra_rank == 0) {
-    MPI_Request* rrequest_array = new MPI_Request[inter_comm_size - 1];
-    MPI_Request* srequest_array = new MPI_Request[inter_comm_size - 1];
+    auto* rrequest_array = new MPI_Request[inter_comm_size - 1];
+    auto* srequest_array = new MPI_Request[inter_comm_size - 1];
 
     src = ((inter_rank - 1 + inter_comm_size) % inter_comm_size) * num_core;
     dst = ((inter_rank + 1) % inter_comm_size) * num_core;
index b279d4d..338f831 100644 (file)
@@ -76,9 +76,9 @@ int allgather__smp_simple(const void *send_buf, int scount,
 
   if (intra_rank == 0) {
     int num_req = (inter_comm_size - 1) * 2;
-    MPI_Request* reqs    = new MPI_Request[num_req];
+    auto* reqs           = new MPI_Request[num_req];
     MPI_Request* req_ptr = reqs;
-    MPI_Status* stat     = new MPI_Status[num_req];
+    auto* stat           = new MPI_Status[num_req];
 
     for (i = 1; i < inter_comm_size; i++) {
 
index 4d1972b..6a0b5f4 100644 (file)
@@ -89,7 +89,7 @@ allgather__spreading_simple(const void *send_buff, int send_count,
   extent = send_type->get_extent();
 
   num_reqs = (2 * num_procs) - 2;
-  MPI_Request* reqs    = new MPI_Request[num_reqs];
+  auto* reqs           = new MPI_Request[num_reqs];
   MPI_Request* req_ptr = reqs;
   Request::sendrecv(send_buff, send_count, send_type, rank, tag,
                (char *) recv_buff + rank * recv_count * extent, recv_count,
index c427d2c..2da2653 100644 (file)
@@ -87,8 +87,8 @@ int alltoall__2dmesh(const void *send_buff, int send_count,
   if (Y > X)
     num_reqs = Y;
 
-  MPI_Status* statuses = new MPI_Status[num_reqs];
-  MPI_Request* reqs    = new MPI_Request[num_reqs];
+  auto* statuses       = new MPI_Status[num_reqs];
+  auto* reqs           = new MPI_Request[num_reqs];
   MPI_Request* req_ptr = reqs;
 
   count = send_count * num_procs;
index 87a79b0..742c1ab 100644 (file)
@@ -83,8 +83,8 @@ int alltoall__3dmesh(const void *send_buff, int send_count,
   unsigned char* tmp_buff1 = smpi_get_tmp_sendbuffer(block_size * num_procs * two_dsize);
   unsigned char* tmp_buff2 = smpi_get_tmp_recvbuffer(block_size * two_dsize);
 
-  MPI_Status* statuses = new MPI_Status[num_reqs];
-  MPI_Request* reqs    = new MPI_Request[num_reqs];
+  auto* statuses       = new MPI_Status[num_reqs];
+  auto* reqs           = new MPI_Request[num_reqs];
   MPI_Request* req_ptr = reqs;
 
   recv_offset = (rank % two_dsize) * block_size * num_procs;
index 272ffb9..b6fda99 100644 (file)
@@ -32,7 +32,7 @@ int alltoall__basic_linear(const void *sendbuf, int sendcount, MPI_Datatype send
                                static_cast<char *>(recvbuf) + rank * recvcount * recvext, recvcount, recvtype);
   if (err == MPI_SUCCESS && size > 1) {
     /* Initiate all send/recv to/from others. */
-    MPI_Request* requests = new MPI_Request[2 * (size - 1)];
+    auto* requests = new MPI_Request[2 * (size - 1)];
     /* Post all receives first -- a simple optimization */
     count = 0;
     for (i = (rank + 1) % size; i != rank; i = (i + 1) % size) {
index 15dd553..f933511 100644 (file)
@@ -90,9 +90,9 @@ int alltoall__mvapich2_scatter_dest(const void *sendbuf,
 
     /* FIXME: This should use the memory macros (there are storage
      leaks here if there is an error, for example) */
-    MPI_Request* reqarray = new MPI_Request[2 * bblock];
+    auto* reqarray = new MPI_Request[2 * bblock];
 
-    MPI_Status* starray = new MPI_Status[2 * bblock];
+    auto* starray = new MPI_Status[2 * bblock];
 
     for (ii=0; ii<comm_size; ii+=bblock) {
         ss = comm_size-ii < bblock ? comm_size-ii : bblock;
index 2ed596d..8ae8f6a 100644 (file)
@@ -49,7 +49,7 @@ int alltoallv__bruck(const void *sendbuf, const int *sendcounts, const int *send
     int ii, ss, dst;
     /* post only bblock isends/irecvs at a time as suggested by Tony Ladd */
     for (ii = 0; ii < size; ii += bblock) {
-      MPI_Request* requests = new MPI_Request[2 * bblock];
+      auto* requests = new MPI_Request[2 * bblock];
 
       ss    = size - ii < bblock ? size - ii : bblock;
       count = 0;
index f8bd696..8c90b93 100644 (file)
@@ -42,7 +42,7 @@ int alltoallv__ompi_basic_linear(const void *sbuf, const int *scounts, const int
   }
 
   /* Now, initiate all send/recv to/from others. */
-  MPI_Request* ireqs = new MPI_Request[size * 2];
+  auto* ireqs        = new MPI_Request[size * 2];
   int nreqs          = 0;
   MPI_Request* preq  = ireqs;
 
index d30b8b1..e213271 100644 (file)
@@ -92,10 +92,10 @@ int bcast__NTSB(void *buf, int count, MPI_Datatype datatype,
   // pipelining
   else {
 
-    MPI_Request* send_request_array = new MPI_Request[2 * (size + pipe_length)];
-    MPI_Request* recv_request_array = new MPI_Request[size + pipe_length];
-    MPI_Status* send_status_array   = new MPI_Status[2 * (size + pipe_length)];
-    MPI_Status* recv_status_array   = new MPI_Status[size + pipe_length];
+    auto* send_request_array = new MPI_Request[2 * (size + pipe_length)];
+    auto* recv_request_array = new MPI_Request[size + pipe_length];
+    auto* send_status_array  = new MPI_Status[2 * (size + pipe_length)];
+    auto* recv_status_array  = new MPI_Status[size + pipe_length];
 
     /* case: root */
     if (rank == 0) {
index 6883351..bde324f 100644 (file)
@@ -72,10 +72,10 @@ int bcast__NTSL_Isend(void *buf, int count, MPI_Datatype datatype,
 
   /* pipeline bcast */
   else {
-    MPI_Request* send_request_array = new MPI_Request[size + pipe_length];
-    MPI_Request* recv_request_array = new MPI_Request[size + pipe_length];
-    MPI_Status* send_status_array   = new MPI_Status[size + pipe_length];
-    MPI_Status* recv_status_array   = new MPI_Status[size + pipe_length];
+    auto* send_request_array = new MPI_Request[size + pipe_length];
+    auto* recv_request_array = new MPI_Request[size + pipe_length];
+    auto* send_status_array  = new MPI_Status[size + pipe_length];
+    auto* recv_status_array  = new MPI_Status[size + pipe_length];
 
     /* root send data */
     if (rank == 0) {
index 1029e93..8edfd95 100644 (file)
@@ -72,10 +72,10 @@ int bcast__NTSL(void *buf, int count, MPI_Datatype datatype,
 
   /* pipeline bcast */
   else {
-    MPI_Request* send_request_array = new MPI_Request[size + pipe_length];
-    MPI_Request* recv_request_array = new MPI_Request[size + pipe_length];
-    MPI_Status* send_status_array   = new MPI_Status[size + pipe_length];
-    MPI_Status* recv_status_array   = new MPI_Status[size + pipe_length];
+    auto* send_request_array = new MPI_Request[size + pipe_length];
+    auto* recv_request_array = new MPI_Request[size + pipe_length];
+    auto* send_status_array  = new MPI_Status[size + pipe_length];
+    auto* recv_status_array  = new MPI_Status[size + pipe_length];
 
     /* root send data */
     if (rank == 0) {
index 2f56a6e..240d6fe 100644 (file)
@@ -120,8 +120,8 @@ int bcast__SMP_binary(void *buf, int count,
 
   // pipeline bcast
   else {
-    MPI_Request* request_array = new MPI_Request[size + pipe_length];
-    MPI_Status* status_array   = new MPI_Status[size + pipe_length];
+    auto* request_array = new MPI_Request[size + pipe_length];
+    auto* status_array  = new MPI_Status[size + pipe_length];
 
     // case ROOT-of-each-SMP
     if (rank % host_num_core == 0) {
index c91a4a3..a12aabf 100644 (file)
@@ -96,8 +96,8 @@ int bcast__SMP_linear(void *buf, int count,
   }
   // pipeline bcast
   else {
-    MPI_Request* request_array = new MPI_Request[size + pipe_length];
-    MPI_Status* status_array   = new MPI_Status[size + pipe_length];
+    auto* request_array = new MPI_Request[size + pipe_length];
+    auto* status_array  = new MPI_Status[size + pipe_length];
 
     // case ROOT of each SMP
     if (rank % num_core == 0) {
index eba0963..c26c8b3 100644 (file)
@@ -93,10 +93,10 @@ int bcast__arrival_pattern_aware_wait(void *buf, int count,
 
   /* start pipeline bcast */
 
-  MPI_Request* send_request_array = new MPI_Request[size + pipe_length];
-  MPI_Request* recv_request_array = new MPI_Request[size + pipe_length];
-  MPI_Status* send_status_array   = new MPI_Status[size + pipe_length];
-  MPI_Status* recv_status_array   = new MPI_Status[size + pipe_length];
+  auto* send_request_array = new MPI_Request[size + pipe_length];
+  auto* recv_request_array = new MPI_Request[size + pipe_length];
+  auto* send_status_array  = new MPI_Status[size + pipe_length];
+  auto* recv_status_array  = new MPI_Status[size + pipe_length];
 
   /* root */
   if (rank == 0) {
index bd461a6..0fe9dff 100644 (file)
@@ -159,10 +159,10 @@ int bcast__arrival_pattern_aware(void *buf, int count,
   }
   /* pipeline bcast */
   else {
-    MPI_Request* send_request_array = new MPI_Request[size + pipe_length];
-    MPI_Request* recv_request_array = new MPI_Request[size + pipe_length];
-    MPI_Status* send_status_array   = new MPI_Status[size + pipe_length];
-    MPI_Status* recv_status_array   = new MPI_Status[size + pipe_length];
+    auto* send_request_array = new MPI_Request[size + pipe_length];
+    auto* recv_request_array = new MPI_Request[size + pipe_length];
+    auto* send_status_array  = new MPI_Status[size + pipe_length];
+    auto* recv_status_array  = new MPI_Status[size + pipe_length];
 
     if (rank == 0) {
       //double start2 = MPI_Wtime();
index 48571dd..82d4a04 100644 (file)
@@ -30,8 +30,8 @@ int bcast__flattree_pipeline(void *buff, int count,
   rank = comm->rank();
   num_procs = comm->size();
 
-  MPI_Request* request_array = new MPI_Request[pipe_length];
-  MPI_Status* status_array   = new MPI_Status[pipe_length];
+  auto* request_array = new MPI_Request[pipe_length];
+  auto* status_array  = new MPI_Status[pipe_length];
 
   if (rank != root) {
     for (i = 0; i < pipe_length; i++) {
index 8b367f3..0fbbac4 100644 (file)
@@ -21,7 +21,7 @@ int bcast__flattree(void *buff, int count, MPI_Datatype data_type,
   }
 
   else {
-    MPI_Request* reqs    = new MPI_Request[num_procs - 1];
+    auto* reqs           = new MPI_Request[num_procs - 1];
     MPI_Request* req_ptr = reqs;
 
     // Root sends data to all others
index e61d7e2..cfed7b7 100644 (file)
@@ -193,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) {
index 3963e23..e88c4f4 100644 (file)
@@ -270,7 +270,7 @@ int gather__ompi_linear_sync(const void *sbuf, int scount,
 */
       char* ptmp;
       MPI_Request first_segment_req;
-      MPI_Request* reqs = new (std::nothrow) MPI_Request[size];
+      auto* reqs = new (std::nothrow) MPI_Request[size];
       if (nullptr == reqs) {
         ret  = -1;
         line = __LINE__;
index 3b0e3af..a40b751 100644 (file)
@@ -83,10 +83,10 @@ int reduce__NTSL(const void *buf, void *rbuf, int count,
 
   /* pipeline */
   else {
-    MPI_Request* send_request_array = new MPI_Request[size + pipe_length];
-    MPI_Request* recv_request_array = new MPI_Request[size + pipe_length];
-    MPI_Status* send_status_array   = new MPI_Status[size + pipe_length];
-    MPI_Status* recv_status_array   = new MPI_Status[size + pipe_length];
+    auto* send_request_array = new MPI_Request[size + pipe_length];
+    auto* recv_request_array = new MPI_Request[size + pipe_length];
+    auto* send_status_array  = new MPI_Status[size + pipe_length];
+    auto* recv_status_array  = new MPI_Status[size + pipe_length];
 
     /* root recv data */
     if (rank == root) {
index e2f142b..941bd87 100644 (file)
@@ -184,10 +184,10 @@ int reduce__arrival_pattern_aware(const void *buf, void *rbuf,
   else {
     //    printf("node %d start\n",rank);
 
-    MPI_Request* send_request_array = new MPI_Request[size + pipe_length];
-    MPI_Request* recv_request_array = new MPI_Request[size + pipe_length];
-    MPI_Status* send_status_array   = new MPI_Status[size + pipe_length];
-    MPI_Status* recv_status_array   = new MPI_Status[size + pipe_length];
+    auto* send_request_array = new MPI_Request[size + pipe_length];
+    auto* recv_request_array = new MPI_Request[size + pipe_length];
+    auto* send_status_array  = new MPI_Status[size + pipe_length];
+    auto* recv_status_array  = new MPI_Status[size + pipe_length];
 
     if (rank == 0) {
       sent_count = 0;
index ffc0d25..6386bde 100644 (file)
@@ -173,8 +173,8 @@ int reduce__mvapich2_knomial(
            &dst, &expected_send_count, &expected_recv_count, &src_array);
 
     if(expected_recv_count > 0 ) {
-      unsigned char** tmp_buf = new unsigned char*[expected_recv_count];
-      MPI_Request* requests = new MPI_Request[expected_recv_count];
+      auto** tmp_buf = new unsigned char*[expected_recv_count];
+      auto* requests = new MPI_Request[expected_recv_count];
       for (k = 0; k < expected_recv_count; k++) {
         tmp_buf[k] = smpi_get_tmp_sendbuffer(count * std::max(extent, true_extent));
         tmp_buf[k] = tmp_buf[k] - true_lb;
index dec6161..8f87360 100644 (file)
@@ -266,7 +266,7 @@ int smpi_coll_tuned_ompi_reduce_generic(const void* sendbuf, void* recvbuf, int
         else {
 
             int creq = 0;
-            MPI_Request* sreq = new (std::nothrow) MPI_Request[max_outstanding_reqs];
+            auto* sreq = new (std::nothrow) MPI_Request[max_outstanding_reqs];
             if (nullptr == sreq) {
               line = __LINE__;
               ret  = -1;
index f5672c2..6a213c0 100644 (file)
@@ -360,8 +360,8 @@ int colls::scan(const void* sendbuf, void* recvbuf, int count, MPI_Datatype data
   Datatype::copy(sendbuf, count, datatype, recvbuf, count, datatype);
 
   // Send/Recv buffers to/from others
-  MPI_Request* requests = new MPI_Request[size - 1];
-  unsigned char** tmpbufs = new unsigned char*[rank];
+  auto* requests = new MPI_Request[size - 1];
+  auto** tmpbufs = new unsigned char*[rank];
   int index = 0;
   for (int other = 0; other < rank; other++) {
     tmpbufs[index] = smpi_get_tmp_sendbuffer(count * dataext);
@@ -418,8 +418,8 @@ int colls::exscan(const void* sendbuf, void* recvbuf, int count, MPI_Datatype da
   datatype->extent(&lb, &dataext);
 
   // Send/Recv buffers to/from others
-  MPI_Request* requests = new MPI_Request[size - 1];
-  unsigned char** tmpbufs = new unsigned char*[rank];
+  auto* requests = new MPI_Request[size - 1];
+  auto** tmpbufs = new unsigned char*[rank];
   int index = 0;
   for (int other = 0; other < rank; other++) {
     tmpbufs[index] = smpi_get_tmp_sendbuffer(count * dataext);
index 955b9e3..38f329a 100644 (file)
@@ -371,7 +371,7 @@ static void init_mv2_allgather_tables_stampede()
     simgrid::smpi::colls::smpi_coll_cleanup_callback = &smpi_coll_cleanup_mvapich2;
   mv2_allgather_num_ppn_conf                         = 3;
   mv2_allgather_thresholds_table                     = new mv2_allgather_tuning_table*[mv2_allgather_num_ppn_conf];
-  mv2_allgather_tuning_table** table_ptrs            = new mv2_allgather_tuning_table*[mv2_allgather_num_ppn_conf];
+  auto** table_ptrs                                  = new mv2_allgather_tuning_table*[mv2_allgather_num_ppn_conf];
   mv2_size_allgather_tuning_table                    = new int[mv2_allgather_num_ppn_conf];
   mv2_allgather_table_ppn_conf                       = new int[mv2_allgather_num_ppn_conf];
   mv2_allgather_table_ppn_conf[0]    = 1;
@@ -1516,7 +1516,7 @@ static void init_mv2_scatter_tables_stampede()
   int agg_table_sum = 0;
   mv2_scatter_num_ppn_conf              = 3;
   mv2_scatter_thresholds_table          = new mv2_scatter_tuning_table*[mv2_scatter_num_ppn_conf];
-  mv2_scatter_tuning_table** table_ptrs = new mv2_scatter_tuning_table*[mv2_scatter_num_ppn_conf];
+  auto** table_ptrs                     = new mv2_scatter_tuning_table*[mv2_scatter_num_ppn_conf];
   mv2_size_scatter_tuning_table         = new int[mv2_scatter_num_ppn_conf];
   mv2_scatter_table_ppn_conf            = new int[mv2_scatter_num_ppn_conf];
   mv2_scatter_table_ppn_conf[0]    = 1;
index 4a174df..b475317 100644 (file)
@@ -19,7 +19,7 @@ int colls::ibarrier(MPI_Comm comm, MPI_Request* request, int external)
   (*request) = new Request( nullptr, 0, MPI_BYTE,
                          rank,rank, system_tag, comm, MPI_REQ_PERSISTENT);
   if (rank > 0) {
-    MPI_Request* requests = new MPI_Request[2];
+    auto* requests = new MPI_Request[2];
     requests[0] = Request::isend (nullptr, 0, MPI_BYTE, 0,
                              system_tag,
                              comm);
@@ -29,7 +29,7 @@ int colls::ibarrier(MPI_Comm comm, MPI_Request* request, int external)
     (*request)->set_nbc_requests(requests, 2);
   }
   else {
-    MPI_Request* requests = new MPI_Request[(size - 1) * 2];
+    auto* requests = new MPI_Request[(size - 1) * 2];
     for (int i = 1; i < 2 * size - 1; i += 2) {
       requests[i - 1] = Request::irecv(nullptr, 0, MPI_BYTE, MPI_ANY_SOURCE, system_tag, comm);
       requests[i]     = Request::isend(nullptr, 0, MPI_BYTE, (i + 1) / 2, system_tag, comm);
@@ -48,14 +48,14 @@ int colls::ibcast(void* buf, int count, MPI_Datatype datatype, int root, MPI_Com
   (*request) = new Request( nullptr, 0, MPI_BYTE,
                          rank,rank, system_tag, comm, MPI_REQ_PERSISTENT);
   if (rank != root) {
-    MPI_Request* requests = new MPI_Request[1];
+    auto* requests = new MPI_Request[1];
     requests[0] = Request::irecv (buf, count, datatype, root,
                              system_tag,
                              comm);
     (*request)->set_nbc_requests(requests, 1);
   }
   else {
-    MPI_Request* requests = new MPI_Request[size - 1];
+    auto* requests = new MPI_Request[size - 1];
     int n = 0;
     for (int i = 0; i < size; i++) {
       if(i!=root){
@@ -89,7 +89,7 @@ int colls::iallgather(const void* sendbuf, int sendcount, MPI_Datatype sendtype,
   Datatype::copy(sendbuf, sendcount, sendtype, static_cast<char *>(recvbuf) + rank * recvcount * recvext, recvcount,
                      recvtype);
   // Send/Recv buffers to/from others;
-  MPI_Request* requests = new MPI_Request[2 * (size - 1)];
+  auto* requests = new MPI_Request[2 * (size - 1)];
   int index = 0;
   for (int other = 0; other < size; other++) {
     if(other != rank) {
@@ -117,7 +117,7 @@ int colls::iscatter(const void* sendbuf, int sendcount, MPI_Datatype sendtype, v
   (*request) = new Request( nullptr, 0, MPI_BYTE,
                          rank,rank, system_tag, comm, MPI_REQ_PERSISTENT);
   if(rank != root) {
-    MPI_Request* requests = new MPI_Request[1];
+    auto* requests = new MPI_Request[1];
     // Recv buffer from root
     requests[0] = Request::irecv(recvbuf, recvcount, recvtype, root, system_tag, comm);
     (*request)->set_nbc_requests(requests, 1);
@@ -129,7 +129,7 @@ int colls::iscatter(const void* sendbuf, int sendcount, MPI_Datatype sendtype, v
                            sendcount, sendtype, recvbuf, recvcount, recvtype);
     }
     // Send buffers to receivers
-    MPI_Request* requests = new MPI_Request[size - 1];
+    auto* requests = new MPI_Request[size - 1];
     int index = 0;
     for(int dst = 0; dst < size; dst++) {
       if(dst != root) {
@@ -161,7 +161,7 @@ int colls::iallgatherv(const void* sendbuf, int sendcount, MPI_Datatype sendtype
   Datatype::copy(sendbuf, sendcount, sendtype,
                      static_cast<char *>(recvbuf) + displs[rank] * recvext,recvcounts[rank], recvtype);
   // Send buffers to others;
-  MPI_Request *requests = new MPI_Request[2 * (size - 1)];
+  auto* requests = new MPI_Request[2 * (size - 1)];
   int index = 0;
   for (int other = 0; other < size; other++) {
     if(other != rank) {
@@ -199,7 +199,7 @@ int colls::ialltoall(const void* sendbuf, int sendcount, MPI_Datatype sendtype,
                                static_cast<char *>(recvbuf) + rank * recvcount * recvext, recvcount, recvtype);
   if (err == MPI_SUCCESS && size > 1) {
     /* Initiate all send/recv to/from others. */
-    MPI_Request* requests = new MPI_Request[2 * (size - 1)];
+    auto* requests = new MPI_Request[2 * (size - 1)];
     /* Post all receives first -- a simple optimization */
     int count = 0;
     for (int i = (rank + 1) % size; i != rank; i = (i + 1) % size) {
@@ -245,7 +245,7 @@ int colls::ialltoallv(const void* sendbuf, const int* sendcounts, const int* sen
                                static_cast<char *>(recvbuf) + recvdisps[rank] * recvext, recvcounts[rank], recvtype);
   if (err == MPI_SUCCESS && size > 1) {
     /* Initiate all send/recv to/from others. */
-    MPI_Request* requests = new MPI_Request[2 * (size - 1)];
+    auto* requests = new MPI_Request[2 * (size - 1)];
     int count = 0;
     /* Create all receives that will be posted first */
     for (int i = 0; i < size; ++i) {
@@ -290,7 +290,7 @@ int colls::ialltoallw(const void* sendbuf, const int* sendcounts, const int* sen
                                static_cast<char *>(recvbuf) + recvdisps[rank], recvcounts[rank], recvtypes[rank]): MPI_SUCCESS;
   if (err == MPI_SUCCESS && size > 1) {
     /* Initiate all send/recv to/from others. */
-    MPI_Request* requests = new MPI_Request[2 * (size - 1)];
+    auto* requests = new MPI_Request[2 * (size - 1)];
     int count = 0;
     /* Create all receives that will be posted first */
     for (int i = 0; i < size; ++i) {
@@ -332,7 +332,7 @@ int colls::igather(const void* sendbuf, int sendcount, MPI_Datatype sendtype, vo
                          rank,rank, system_tag, comm, MPI_REQ_PERSISTENT);
   if(rank != root) {
     // Send buffer to root
-    MPI_Request* requests = new MPI_Request[1];
+    auto* requests = new MPI_Request[1];
     requests[0]=Request::isend(sendbuf, sendcount, sendtype, root, system_tag, comm);
     (*request)->set_nbc_requests(requests, 1);
   } else {
@@ -341,7 +341,7 @@ int colls::igather(const void* sendbuf, int sendcount, MPI_Datatype sendtype, vo
     Datatype::copy(sendbuf, sendcount, sendtype, static_cast<char*>(recvbuf) + root * recvcount * recvext,
                        recvcount, recvtype);
     // Receive buffers from senders
-    MPI_Request* requests = new MPI_Request[size - 1];
+    auto* requests = new MPI_Request[size - 1];
     int index = 0;
     for (int src = 0; src < size; src++) {
       if(src != root) {
@@ -371,7 +371,7 @@ int colls::igatherv(const void* sendbuf, int sendcount, MPI_Datatype sendtype, v
                          rank,rank, system_tag, comm, MPI_REQ_PERSISTENT);
   if (rank != root) {
     // Send buffer to root
-    MPI_Request* requests = new MPI_Request[1];
+    auto* requests = new MPI_Request[1];
     requests[0]=Request::isend(sendbuf, sendcount, sendtype, root, system_tag, comm);
     (*request)->set_nbc_requests(requests, 1);
   } else {
@@ -380,7 +380,7 @@ int colls::igatherv(const void* sendbuf, int sendcount, MPI_Datatype sendtype, v
     Datatype::copy(sendbuf, sendcount, sendtype, static_cast<char*>(recvbuf) + displs[root] * recvext,
                        recvcounts[root], recvtype);
     // Receive buffers from senders
-    MPI_Request* requests = new MPI_Request[size - 1];
+    auto* requests = new MPI_Request[size - 1];
     int index = 0;
     for (int src = 0; src < size; src++) {
       if(src != root) {
@@ -409,7 +409,7 @@ int colls::iscatterv(const void* sendbuf, const int* sendcounts, const int* disp
                          rank,rank, system_tag, comm, MPI_REQ_PERSISTENT);
   if(rank != root) {
     // Recv buffer from root
-    MPI_Request* requests = new MPI_Request[1];
+    auto* requests = new MPI_Request[1];
     requests[0]=Request::irecv(recvbuf, recvcount, recvtype, root, system_tag, comm);
     (*request)->set_nbc_requests(requests, 1);
   } else {
@@ -420,7 +420,7 @@ int colls::iscatterv(const void* sendbuf, const int* sendcounts, const int* disp
                        sendtype, recvbuf, recvcount, recvtype);
     }
     // Send buffers to receivers
-    MPI_Request *requests = new MPI_Request[size - 1];
+    auto* requests = new MPI_Request[size - 1];
     int index = 0;
     for (int dst = 0; dst < size; dst++) {
       if (dst != root) {
@@ -468,7 +468,7 @@ int colls::ireduce(const void* sendbuf, void* recvbuf, int count, MPI_Datatype d
 
   if(rank != root) {
     // Send buffer to root
-    MPI_Request* requests = new MPI_Request[1];
+    auto* requests        = new MPI_Request[1];
     requests[0]           = Request::isend(real_sendbuf, count, datatype, root, system_tag, comm);
     (*request)->set_nbc_requests(requests, 1);
   } else {
@@ -477,7 +477,7 @@ int colls::ireduce(const void* sendbuf, void* recvbuf, int count, MPI_Datatype d
     if (real_sendbuf != nullptr && recvbuf != nullptr)
       Datatype::copy(real_sendbuf, count, datatype, recvbuf, count, datatype);
     // Receive buffers from senders
-    MPI_Request *requests = new MPI_Request[size - 1];
+    auto* requests = new MPI_Request[size - 1];
     int index = 0;
     for (int src = 0; src < size; src++) {
       if (src != root) {
@@ -513,7 +513,7 @@ int colls::iallreduce(const void* sendbuf, void* recvbuf, int count, MPI_Datatyp
   // Local copy from self
   Datatype::copy(sendbuf, count, datatype, recvbuf, count, datatype);
   // Send/Recv buffers to/from others;
-  MPI_Request* requests = new MPI_Request[2 * (size - 1)];
+  auto* requests = new MPI_Request[2 * (size - 1)];
   int index = 0;
   for (int other = 0; other < size; other++) {
     if(other != rank) {
@@ -546,7 +546,7 @@ int colls::iscan(const void* sendbuf, void* recvbuf, int count, MPI_Datatype dat
   Datatype::copy(sendbuf, count, datatype, recvbuf, count, datatype);
 
   // Send/Recv buffers to/from others
-  MPI_Request *requests = new MPI_Request[size - 1];
+  auto* requests = new MPI_Request[size - 1];
   int index = 0;
   for (int other = 0; other < rank; other++) {
     requests[index] = Request::irecv_init(smpi_get_tmp_sendbuffer(count * dataext), count, datatype, other, system_tag, comm);
@@ -577,7 +577,7 @@ int colls::iexscan(const void* sendbuf, void* recvbuf, int count, MPI_Datatype d
     memset(recvbuf, 0, count*dataext);
 
   // Send/Recv buffers to/from others
-  MPI_Request *requests = new MPI_Request[size - 1];
+  auto* requests = new MPI_Request[size - 1];
   int index = 0;
   for (int other = 0; other < rank; other++) {
     requests[index] = Request::irecv_init(smpi_get_tmp_sendbuffer(count * dataext), count, datatype, other, system_tag, comm);
@@ -609,7 +609,7 @@ int colls::ireduce_scatter(const void* sendbuf, void* recvbuf, const int* recvco
   datatype->extent(&lb, &dataext);
 
   // Send/Recv buffers to/from others;
-  MPI_Request* requests = new MPI_Request[2 * (size - 1)];
+  auto* requests = new MPI_Request[2 * (size - 1)];
   int index = 0;
   int recvdisp=0;
   for (int other = 0; other < size; other++) {
index 369445d..1f10512 100644 (file)
@@ -280,7 +280,7 @@ unsigned long long smpi_rastro_timestamp ()
   smpi_bench_end();
   double now = SIMIX_get_clock();
 
-  unsigned long long sec = static_cast<unsigned long long>(now);
+  auto sec               = static_cast<unsigned long long>(now);
   unsigned long long pre = (now - sec) * smpi_rastro_resolution();
   smpi_bench_begin();
   return sec * smpi_rastro_resolution() + pre;
index 10bb834..925b506 100644 (file)
@@ -111,7 +111,7 @@ public:
 
     MPI_Request find(int src, int dst, int tag)
     {
-      req_storage_t::iterator it = store.find(req_key_t(src, dst, tag));
+      auto it = store.find(req_key_t(src, dst, tag));
       return (it == store.end()) ? MPI_REQUEST_NULL : it->second;
     }
 
index 9cf535d..806b363 100644 (file)
@@ -709,7 +709,7 @@ int Win::finish_comms(int rank){
   if (size > 0) {
     size = 0;
     std::vector<MPI_Request> myreqqs;
-    std::vector<MPI_Request>::iterator iter = reqqs->begin();
+    auto iter                               = reqqs->begin();
     int proc_id                             = comm_->group()->actor(rank)->get_pid();
     while (iter != reqqs->end()){
       // Let's see if we're either the destination or the sender of this request
index ce8a68c..81d0549 100644 (file)
@@ -186,9 +186,8 @@ void NetworkIBModel::updateIBfactors(NetworkAction* action, IBNode* from, IBNode
       to->ActiveCommsDown[from] -= 1;
 
     to->nbActiveCommsDown--;
-    std::vector<ActiveComm*>::iterator it =
-        std::find_if(begin(from->ActiveCommsUp), end(from->ActiveCommsUp),
-                     [action](const ActiveComm* comm) { return comm->action == action; });
+    auto it = std::find_if(begin(from->ActiveCommsUp), end(from->ActiveCommsUp),
+                           [action](const ActiveComm* comm) { return comm->action == action; });
     if (it != std::end(from->ActiveCommsUp)) {
       delete *it;
       from->ActiveCommsUp.erase(it);
index 6ecd3a1..b44c56a 100644 (file)
@@ -378,7 +378,7 @@ LinkNS3::LinkNS3(NetworkNS3Model* model, const std::string& name, double bandwid
     ns3::NetDeviceContainer netA;
     WifiZone* zone = WifiZone::by_name(name);
     xbt_assert(zone != nullptr, "Link name '%s' does not match the 'wifi_link' property of a host.", name.c_str());
-    NetPointNs3* netpoint_ns3 = zone->get_host()->get_netpoint()->extension<NetPointNs3>();
+    auto* netpoint_ns3 = zone->get_host()->get_netpoint()->extension<NetPointNs3>();
 
     wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager", "ControlMode", ns3::StringValue("HtMcs0"), "DataMode",
                                  ns3::StringValue("HtMcs" + std::to_string(zone->get_mcs())));