]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Revert eb5db19276 to get consistent memory usage. 4234/head
authorDavid Wells <wellsd2@rpi.edu>
Sat, 8 Apr 2017 17:13:41 +0000 (13:13 -0400)
committerDavid Wells <wellsd2@rpi.edu>
Sat, 8 Apr 2017 17:13:41 +0000 (13:13 -0400)
Rather than rely on details of std::vector's reallocation scheme, just
copy things.

source/base/partitioner.cc

index 3f4d01522bf1274bfd4da07af2b8c012b6a6ec8e..500d762864d5e72f87a05dc346936bf231d2a8c7 100644 (file)
@@ -269,7 +269,6 @@ namespace Utilities
 
         // allocate memory for import data
         std::vector<std::pair<unsigned int,unsigned int> > import_targets_temp;
-        import_targets_temp.reserve(n_procs);
         n_import_indices_data = 0;
         for (unsigned int i=0; i<n_procs; i++)
           if (receive_buffer[i] > 0)
@@ -278,8 +277,8 @@ namespace Utilities
               import_targets_temp.push_back(std::pair<unsigned int,
                                             unsigned int> (i, receive_buffer[i]));
             }
-
-        import_targets_data = std::move(import_targets_temp);
+        // copy, don't move, to get deterministic memory usage.
+        import_targets_data = import_targets_temp;
       }
 
       // send and receive indices for import data. non-blocking receives and

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.