@@ -83,7 +83,7 @@ namespace wrench {
8383
8484 try {
8585 flop_rate = UnitParser::parse_compute_speed (reference_flop_rate);
86- } catch (std::invalid_argument &e ) {
86+ } catch (std::invalid_argument &) {
8787 throw ;
8888 }
8989
@@ -93,7 +93,7 @@ namespace wrench {
9393 nlohmann::json schema_version;
9494 try {
9595 schema_version = j.at (" schemaVersion" );
96- } catch (std::out_of_range &e ) {
96+ } catch (std::out_of_range &) {
9797 throw std::invalid_argument (" WfCommonsWorkflowParser::createWorkflowFromJson(): Could not find a 'schema_version' key" );
9898 }
9999 if (schema_version != " 1.5" ) {
@@ -104,7 +104,7 @@ namespace wrench {
104104 nlohmann::json workflow_spec;
105105 try {
106106 workflow_spec = j.at (" workflow" );
107- } catch (std::out_of_range &e ) {
107+ } catch (std::out_of_range &) {
108108 throw std::invalid_argument (" WfCommonsWorkflowParser::createWorkflowFromJson(): Could not find a 'workflow' key" );
109109 }
110110
@@ -126,13 +126,13 @@ namespace wrench {
126126 unsigned long num_cores;
127127 try {
128128 num_cores = core_spec.at (" coreCount" );
129- } catch (nlohmann::detail::out_of_range &e ) {
129+ } catch (nlohmann::detail::out_of_range &) {
130130 num_cores = 1 ;
131131 }
132132 double mhz;
133133 try {
134134 mhz = core_spec.at (" speedInMHz" );
135- } catch (nlohmann::detail::out_of_range &e ) {
135+ } catch (nlohmann::detail::out_of_range &) {
136136 if (show_warnings) std::cerr << " [WARNING]: Machine " + name + " does not define a speed\n " ;
137137 mhz = -1.0 ;// unknown
138138 }
@@ -148,9 +148,9 @@ namespace wrench {
148148 std::shared_ptr<DataFile> data_file;
149149 try {
150150 Simulation::getFileByID (file_name);
151- } catch (const std::invalid_argument &e ) {
151+ } catch (const std::invalid_argument &) {
152152 // making a new file
153- double file_size = file_spec.at (" sizeInBytes" );
153+ sg_size_t file_size = file_spec.at (" sizeInBytes" );
154154 Simulation::addFile (file_name, file_size);
155155 }
156156 }
@@ -190,14 +190,14 @@ namespace wrench {
190190 double avg_cpu = -1.0 ;
191191 try {
192192 avg_cpu = task_exec.at (" avgCPU" );
193- } catch (nlohmann::json::out_of_range &e ) {
193+ } catch (nlohmann::json::out_of_range &) {
194194 // do nothing
195195 }
196196
197197 double num_cores = -1.0 ;
198198 try {
199199 num_cores = task_exec.at (" coreCount" );
200- } catch (nlohmann::json::out_of_range &e ) {
200+ } catch (nlohmann::json::out_of_range &) {
201201 // do nothing
202202 }
203203 if (num_cores <= 0 ) {
@@ -224,7 +224,7 @@ namespace wrench {
224224 avg_cpu = 100.0 * num_cores;
225225 } else if (avg_cpu > 100 * num_cores) {
226226 if (show_warnings) {
227- std::cerr << " [WARNING]: Task " << task->getID () << " specifies " << ( unsigned long ) num_cores << " cores and avgCPU " << avg_cpu << " %, "
227+ std::cerr << " [WARNING]: Task " << task->getID () << " specifies " << static_cast < unsigned long >( num_cores) << " cores and avgCPU " << avg_cpu << " %, "
228228 << " which is impossible: Assuming avgCPU " << 100.0 * num_cores << " instead.\n " ;
229229 }
230230 avg_cpu = 100.0 * num_cores;
@@ -249,13 +249,13 @@ namespace wrench {
249249 // Deal with the flop amount
250250 double flop_amount;
251251 std::string execution_machine;
252- if (task_exec.contains (" machines" ) and machines.size () > 0 ) {
253- std::vector<std::string> machines = task_exec.at (" machines" );
254- if (machines .size () > 1 ) {
252+ if (task_exec.contains (" machines" ) and ! machines.empty () ) {
253+ std::vector<std::string> task_machines = task_exec.at (" machines" );
254+ if (task_machines .size () > 1 ) {
255255 throw std::invalid_argument (" WfCommonsWorkflowParser::createWorkflowFromJSON(): Task " + task->getID () +
256256 " was executed on multiple machines, which WRENCH currently does not support" );
257257 }
258- execution_machine = machines .at (0 );
258+ execution_machine = task_machines .at (0 );
259259 }
260260 if (ignore_machine_specs or execution_machine.empty ()) {
261261 flop_amount = runtimeInSeconds * flop_rate;
@@ -267,11 +267,11 @@ namespace wrench {
267267 }
268268 if (machines[execution_machine].second >= 0 ) {
269269 double core_ghz = (machines[execution_machine].second ) / 1000.0 ;
270- double total_compute_power_used = core_ghz * ( double ) min_num_cores;
270+ double total_compute_power_used = core_ghz * static_cast < double >( min_num_cores) ;
271271 double actual_flop_rate = total_compute_power_used * 1000.0 * 1000.0 * 1000.0 ;
272272 flop_amount = runtimeInSeconds * actual_flop_rate;
273273 } else {
274- flop_amount = ( double ) min_num_cores * runtimeInSeconds * flop_rate;// Assume a min-core execution
274+ flop_amount = static_cast < double >( min_num_cores) * runtimeInSeconds * flop_rate;// Assume a min-core execution
275275 }
276276 }
277277
@@ -312,9 +312,9 @@ namespace wrench {
312312 try {
313313 auto parent_task = workflow->getTaskByID (parent);
314314 workflow->addControlDependency (parent_task, task, redundant_dependencies);
315- } catch (std::invalid_argument &e ) {
315+ } catch (std::invalid_argument &) {
316316 // do nothing
317- } catch (std::runtime_error &e ) {
317+ } catch (std::runtime_error &) {
318318 if (ignore_cycle_creating_dependencies) {
319319 // nothing
320320 } else {
@@ -327,9 +327,9 @@ namespace wrench {
327327 try {
328328 auto child_task = workflow->getTaskByID (child);
329329 workflow->addControlDependency (task, child_task, redundant_dependencies);
330- } catch (std::invalid_argument &e ) {
330+ } catch (std::invalid_argument &) {
331331 // do nothing
332- } catch (std::runtime_error &e ) {
332+ } catch (std::runtime_error &) {
333333 if (ignore_cycle_creating_dependencies) {
334334 // nothing
335335 } else {
@@ -351,7 +351,7 @@ namespace wrench {
351351 * @param workflow
352352 * @return
353353 */
354- nlohmann::json build_workflow_specification_json (std::shared_ptr<Workflow> workflow) {
354+ nlohmann::json build_workflow_specification_json (const std::shared_ptr<Workflow>& workflow) {
355355 nlohmann::json json_specification;
356356
357357 // Tasks
@@ -390,7 +390,7 @@ namespace wrench {
390390 auto file = item.second ;
391391 nlohmann::json json_file;
392392 json_file[" id" ] = file->getID ();
393- json_file[" sizeInBytes" ] = ( long long ) (file->getSize ());
393+ json_file[" sizeInBytes" ] = static_cast < long long > (file->getSize ());
394394 json_specification[" files" ].push_back (json_file);
395395 }
396396
@@ -402,7 +402,7 @@ namespace wrench {
402402 * @param workflow
403403 * @return
404404 */
405- nlohmann::json build_workflow_execution_json (std::shared_ptr<Workflow> workflow) {
405+ nlohmann::json build_workflow_execution_json (const std::shared_ptr<Workflow>& workflow) {
406406 nlohmann::json json_execution;
407407
408408 json_execution[" makespanInSeconds" ] = workflow->getCompletionDate () - workflow->getStartDate ();
@@ -430,7 +430,7 @@ namespace wrench {
430430 /* *
431431 * Documentation in .h file
432432 */
433- std::string WfCommonsWorkflowParser::createJSONStringFromWorkflow (std::shared_ptr<Workflow> workflow) {
433+ std::string WfCommonsWorkflowParser::createJSONStringFromWorkflow (const std::shared_ptr<Workflow>& workflow) {
434434 nlohmann::json json_doc;
435435 json_doc[" name" ] = workflow->getName ();
436436 json_doc[" description" ] = " Generated from a WRENCH simulator" ;
0 commit comments