@@ -103,11 +103,18 @@ fn execute_partition<C: SimCommunicator + 'static>(comm: C, args: &CommandLineAr
103
103
comm. barrier ( ) ;
104
104
105
105
id:: load_from_file ( & io:: resolve_path ( config_path, & config. proto_files ( ) . ids ) ) ;
106
- let network = Network :: from_file_as_is ( & get_numbered_output_filename (
107
- & output_path,
108
- & io:: resolve_path ( config_path, & config. proto_files ( ) . network ) ,
109
- config. partitioning ( ) . num_parts ,
110
- ) ) ;
106
+ // if we partition the network is copied to the output folder.
107
+ // otherwise nothing is done and we can load the network from the input folder directly.
108
+ let network_path = if let PartitionMethod :: Metis ( _) = config. partitioning ( ) . method {
109
+ get_numbered_output_filename (
110
+ & output_path,
111
+ & io:: resolve_path ( config_path, & config. proto_files ( ) . network ) ,
112
+ config. partitioning ( ) . num_parts ,
113
+ )
114
+ } else {
115
+ io:: resolve_path ( config_path, & config. proto_files ( ) . network )
116
+ } ;
117
+ let network = Network :: from_file_as_is ( & network_path) ;
111
118
let mut garage = Garage :: from_file ( & io:: resolve_path (
112
119
config_path,
113
120
& config. proto_files ( ) . vehicles ,
@@ -189,13 +196,16 @@ fn try_join(mut handles: IntMap<u32, JoinHandle<()>>) {
189
196
190
197
pub fn partition_input ( config : & Config , config_path : & String ) {
191
198
id:: load_from_file ( & io:: resolve_path ( config_path, & config. proto_files ( ) . ids ) ) ;
192
- let _net = if let PartitionMethod :: Metis ( _) = config. partitioning ( ) . method {
199
+ if let PartitionMethod :: Metis ( _) = config. partitioning ( ) . method {
193
200
info ! ( "Config param Partition method was set to metis. Loading input network, running metis conversion and then store it into output folder" ) ;
194
- partition_network ( config, config_path)
195
- } else {
201
+ partition_network ( config, config_path) ;
202
+ }
203
+ // don't do anything. If the network is already partitioned, we'll load it from the input folder.
204
+ /*else {
196
205
info!("Config param Partition method was set to none. Loading network from input, assuming it has partitioning information");
197
206
copy_network_into_output(config, config_path)
198
207
};
208
+ */
199
209
}
200
210
201
211
fn partition_network ( config : & Config , config_path : & String ) -> Network {
@@ -212,19 +222,6 @@ fn partition_network(config: &Config, config_path: &String) -> Network {
212
222
network
213
223
}
214
224
215
- fn copy_network_into_output ( config : & Config , config_path : & String ) -> Network {
216
- let net_in_path = io:: resolve_path ( config_path, & config. proto_files ( ) . network ) ;
217
- let num_parts = config. partitioning ( ) . num_parts ;
218
- let network = Network :: from_file_as_is ( & net_in_path) ;
219
- let mut net_out_path = create_output_filename (
220
- & io:: resolve_path ( config_path, & config. output ( ) . output_dir ) ,
221
- & net_in_path,
222
- ) ;
223
- net_out_path = insert_number_in_proto_filename ( & net_out_path, num_parts) ;
224
- network. to_file ( & net_out_path) ;
225
- network
226
- }
227
-
228
225
pub fn get_numbered_output_filename ( output_dir : & Path , input_file : & Path , part : u32 ) -> PathBuf {
229
226
let out = create_output_filename ( output_dir, input_file) ;
230
227
insert_number_in_proto_filename ( & out, part)
0 commit comments