Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows/VirtualBox performance #557

Closed
jakobzierk opened this issue May 2, 2022 · 3 comments
Closed

Windows/VirtualBox performance #557

jakobzierk opened this issue May 2, 2022 · 3 comments

Comments

@jakobzierk
Copy link

jakobzierk commented May 2, 2022

Dear Marcel and all,

thank you for your great project! I'm just exploring MP-SPDZ using Windows/VirtualBox and made the following observations, which I'd like you to consider to share (Readme or Troubleshooting), as they cost me quite some time and might help others.

Performance is by default abysmal:
AVX/AVX2 instructions are by default deactivated (see e.g. here) causing significant performance loss, deactivate Hyper-V/Hypervisor using:

bcdedit /set hypervisorlaunchtype off
DISM /Online /Disable-Feature:Microsoft-Hyper-V

Activate AVX/AVX2:

c:\Program Files\Oracle\VirtualBox>VBoxManage setextradata "<YOUR VM NAME>" VBoxInternal/CPUM/IsaExts/AVX 1
c:\Program Files\Oracle\VirtualBox>VBoxManage setextradata "<YOUR VM NAME>" VBoxInternal/CPUM/IsaExts/AVX2 1

Still, the default releases are slow under VirtualBox, compile them yourself:

sudo apt-get update
sudo apt-get install automake build-essential git libboost-dev libboost-thread-dev libntl-dev libsodium-dev libssl-dev libtool m4 python3 texinfo yasm
git clone https://github.com/data61/MP-SPDZ.git
cd MP-SPDZ
make tldr

Thanks
Jakob

@mkskeller
Copy link
Member

Thank you for raising this. The release includes two sets of binaries, with and without AVX2. The set is chosen by looking at /proc/cpuinfo here:

flags='cat /proc/cpuinfo'

It might be that you just need to activate AVX2 before running tldr.sh. Can you post the output of cat /proc/cpuinfo under VirtualBox after activating AVX2?

@jakobzierk
Copy link
Author

Ah, ok, I didn't run Scripts/tldr.sh after activating AVX/AVX2, this drastically improved performance, thanks for the hint.
Still, the self-compiled version performs better, but I guess this is to be expected:

Official release:

jakob@spdz-virtualbox:~/mp-spdz-0.3.1$ Scripts/mascot.sh tutorial
Running /home/jakob/mp-spdz-0.3.1/Scripts/../mascot-party.x 0 tutorial -pn 12994 -h localhost -N 2
Running /home/jakob/mp-spdz-0.3.1/Scripts/../mascot-party.x 1 tutorial -pn 12994 -h localhost -N 2
Using security parameter 40
got 1 from player 0
got 1 from player 1
expected 3, got 3
expected 2, got 2
expected -1, got -1
expected 2, got 2
expected 1, got 1
expected 1, got 1
expected 0, got 0
expected 0, got 0
expected 0, got 0
expected 1, got 1
expected 2, got 2
expected 9702, got 9702
expected 1.9, got 1.9
expected 2.1, got 2.1
expected -0.2, got -0.2
expected -20, got -20
expected 0, got 0
expected 0, got 0
expected 1, got 1
expected 1, got 1
expected 0, got 0
expected 1, got 1
expected -0.1, got -0.1
Party 0: please input three numbers not adding up to zero
Party 1: please input any three numbers
weighted average: 3.222
expected 2, got 2
expected 3, got 3
Significant amount of unused triples of SPDZ gfp. For more accurate benchmarks, consider reducing the batch size with -b.
The following timing is inclusive preprocessing.
**Time = 6.77218 seconds** 
Data sent = 223.717 MB in ~685 rounds (party 0)
Global data sent = 447.433 MB (all parties)
This program might benefit from some protocol options.
Consider adding the following at the beginning of 'tutorial.mpc':
program.use_edabit(True)

Self-compiled:

jakob@spdz-virtualbox:~/MP-SPDZ$ Scripts/mascot.sh tutorial
Running /home/jakob/MP-SPDZ/Scripts/../mascot-party.x 0 tutorial -pn 19256 -h localhost -N 2
Running /home/jakob/MP-SPDZ/Scripts/../mascot-party.x 1 tutorial -pn 19256 -h localhost -N 2
Using security parameter 40
got 1 from player 0
got 1 from player 1
expected 3, got 3
expected 2, got 2
expected -1, got -1
expected 2, got 2
expected 1, got 1
expected 1, got 1
expected 0, got 0
expected 0, got 0
expected 0, got 0
expected 1, got 1
expected 2, got 2
expected 9702, got 9702
expected 1.9, got 1.9
expected 2.1, got 2.1
expected -0.2, got -0.2
expected -20, got -20
expected 0, got 0
expected 0, got 0
expected 1, got 1
expected 1, got 1
expected 0, got 0
expected 1, got 1
expected -0.1, got -0.1
Party 0: please input three numbers not adding up to zero
Party 1: please input any three numbers
weighted average: 3.222
expected 2, got 2
expected 3, got 3
Significant amount of unused triples of SPDZ gfp. For more accurate benchmarks, consider reducing the batch size with -b.
The following timing is inclusive preprocessing.
**Time = 1.85793 seconds** 
Data sent = 223.717 MB in ~685 rounds (party 0)
Global data sent = 447.433 MB (all parties)
This program might benefit from some protocol options.
Consider adding the following at the beginning of 'tutorial.mpc':
	program.use_edabit(True)

But I guess you're right, primarily my bad for not calling Scripts/tldr.sh after acitvating AVX/AVX2.

Still, my main point remains that this might help other users and you could add it to the Readme/troubleshooting section (but probably this gitissue can also be googled).

Best
Jakob

@mkskeller
Copy link
Member

Absolutely, I appreciate your contribution. I'm happy to merge a pull request documenting this. Otherwise, I'll add a link to this discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants