Skip to content

Commit

Permalink
add CPU instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
kanav99 committed May 28, 2024
1 parent 222db9a commit b488d67
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
27 changes: 27 additions & 0 deletions GPU-MPC/experiments/sigma/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,33 @@ Results are stored in `output/P<party-number>/Table<table-number>.json` or `outp
Log files (which might help with debugging) can be found in the `output/P<party number>/models/<model name>-<sequence length>/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 <ip> 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 <ip> 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
Expand Down
2 changes: 1 addition & 1 deletion GPU-MPC/ext/sytorch/scripts/all-cpu-benchmarks-local.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion GPU-MPC/ext/sytorch/scripts/all-cpu-benchmarks-remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit b488d67

Please sign in to comment.