From b488d670e3f08ae35bf08607622a7ac607a91eb7 Mon Sep 17 00:00:00 2001 From: Kanav Gupta Date: Tue, 28 May 2024 19:51:57 +0530 Subject: [PATCH] add CPU instructions --- GPU-MPC/experiments/sigma/README.md | 27 +++++++++++++++++++ .../scripts/all-cpu-benchmarks-local.py | 2 +- .../scripts/all-cpu-benchmarks-remote.py | 2 +- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/GPU-MPC/experiments/sigma/README.md b/GPU-MPC/experiments/sigma/README.md index b67cffdb..ac8d14da 100644 --- a/GPU-MPC/experiments/sigma/README.md +++ b/GPU-MPC/experiments/sigma/README.md @@ -119,6 +119,33 @@ Results are stored in `output/P/Table.json` or `outp Log files (which might help with debugging) can be found in the `output/P/models/-/logs/` folder. +### Generating CPU numbers + +To generate CPU performance numbers in table 3 and figures 9,10, follow these steps: + +1. On both machines, run `setup.sh` script, as described in previous sections. + +2. On the first machine, change to the build directory and run the python script with it's IP address + +``` +cd ext/sytorch/build/ +python ../scripts/all-cpu-benchmarks-remote.py 0 +``` + +3. On the second machine, use the IP address of the first machine. + +``` +cd ext/sytorch/build/ +python ../scripts/all-cpu-benchmarks-remote.py 1 +``` + +If you'd like to run on a single machine machine, use the local script without any arguments. Note that since it runs 2 processes in parallel, it requires double the hardware. + +``` +python ../scripts/all-cpu-benchmarks-local.py +``` + +At the end of this script, which could take several hours, you get a `results.csv` file containing all the required time and communication numbers required to generate table 3 and figure 9,10. ## Citation diff --git a/GPU-MPC/ext/sytorch/scripts/all-cpu-benchmarks-local.py b/GPU-MPC/ext/sytorch/scripts/all-cpu-benchmarks-local.py index 49591859..659d38bc 100644 --- a/GPU-MPC/ext/sytorch/scripts/all-cpu-benchmarks-local.py +++ b/GPU-MPC/ext/sytorch/scripts/all-cpu-benchmarks-local.py @@ -77,7 +77,7 @@ def run_par(cmd1, cmd2): print("[+] --- norm comm = " + str(norm_comm/1024.0) + " GB") print("[+] --- online time = " + str(total_time/1000.0) + " s") print("[+] --- online comm = " + str(total_comm/1024.0) + " GB") - outcsv.write(f"{b},{act_time},{act_comm},{softmax_time},{softmax_comm},{norm_time},{norm_comm},{total_time},{total_comm}\n") + outcsv.write(f"{b},{act_time/1000.0},{act_comm/1024.0},{softmax_time/1000.0},{softmax_comm/1024.0},{norm_time/1000.0},{norm_comm/1024.0},{total_time/1000.0},{total_comm/1024.0}\n") outcsv.flush() logfile1.close() diff --git a/GPU-MPC/ext/sytorch/scripts/all-cpu-benchmarks-remote.py b/GPU-MPC/ext/sytorch/scripts/all-cpu-benchmarks-remote.py index 57f12366..db744a6e 100644 --- a/GPU-MPC/ext/sytorch/scripts/all-cpu-benchmarks-remote.py +++ b/GPU-MPC/ext/sytorch/scripts/all-cpu-benchmarks-remote.py @@ -80,7 +80,7 @@ def run_seq(cmd): print("[+] --- norm comm = " + str(norm_comm/1024.0) + " GB") print("[+] --- online time = " + str(total_time/1000.0) + " s") print("[+] --- online comm = " + str(total_comm/1024.0) + " GB") - outcsv.write(f"remote-{b},{act_time},{act_comm},{softmax_time},{softmax_comm},{norm_time},{norm_comm},{total_time},{total_comm}\n") + outcsv.write(f"remote-{b},{act_time/1000.0},{act_comm/1024.0},{softmax_time/1000.0},{softmax_comm/1024.0},{norm_time/1000.0},{norm_comm/1024.0},{total_time/1000.0},{total_comm/1024.0}\n") outcsv.flush() logfile1.close()