MCPcopy Create free account
hub / github.com/data61/MP-SPDZ / run

Method run

FHEOffline/SimpleMachine.cpp:269–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267}
268
269void MachineBase::run()
270{
271 size_t start_size = 0;
272 for (auto& generator : generators)
273 start_size += generator->report_size(CAPACITY);
274 cout << "Memory requirement at start: " << 1e-9 * start_size << " GB" << endl;
275 Timer cpu_timer(CLOCK_PROCESS_CPUTIME_ID);
276 timer.start();
277 cpu_timer.start();
278 pthread_create(&throughput_loop_thread, 0, run_throughput_loop, this);
279 for (int i = 0; i < nthreads; i++)
280 pthread_create(&(generators[i]->thread), 0, run_generator, generators[i]);
281 long long total = 0;
282 map<string, double> times;
283 size_t memory = 0, sent = 0;
284 MemoryUsage memory_usage;
285 for (int i = 0; i < nthreads; i++)
286 {
287 pthread_join(generators[i]->thread, 0);
288 total += generators[i]->total;
289 auto timers = generators[i]->timers;
290 for (auto timer = timers.begin(); timer != timers.end(); timer++)
291 times[timer->first] += timer->second.elapsed();
292 memory += generators[i]->report_size(CAPACITY);
293 cout << "Generator required up to "
294 << 1e-9 * generators[i]->report_size(CAPACITY) << " GB" << endl;
295 sent += generators[i]->report_sent();
296 generators[i]->report_size(CAPACITY, memory_usage);
297 }
298 pthread_cancel(throughput_loop_thread);
299 timer.stop();
300 cpu_timer.stop();
301 memory_usage.print();
302 cout << "Machine required up to " << 1e-9 * memory << " GB" << endl;
303 cout << "Minimal requirements are " << 1e-9 * report_size(MINIMAL) << " GB"
304 << endl;
305
306 for (int i = 0; i < nthreads; i++)
307 delete generators[i];
308
309 for (auto time = times.begin(); time != times.end(); time++)
310 cout << time->first << " time on average: " << time->second / nthreads << endl;
311 cout << "Sent " << 1e-9 * sent << " GB in total, " << 8e-3 * sent / total
312 << " kbit per " << item_type().substr(0, item_type().length() - 1) << endl;
313 cout << "Produced " << total << " " << item_type() << " in "
314 << timer.elapsed() << " seconds" << endl;
315 cout << "CPU time: " << cpu_timer.elapsed() << endl;
316
317 cout << "Time: " << timer.elapsed() << endl;
318 cout << "Throughput: " << total / timer.elapsed() << endl;
319 mult_performance();
320}
321
322void MachineBase::throughput_loop()
323{

Callers 2

run_generatorFunction · 0.45
fake_keysMethod · 0.45

Calls 9

report_sizeMethod · 0.45
startMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
elapsedMethod · 0.45
report_sentMethod · 0.45
stopMethod · 0.45
printMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected