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

What if I want to perform a two-party calculation in a situation where three-party communication has already been established? It looks like you can only restart the service #409

Closed
mingo0117 opened this issue Sep 27, 2022 · 4 comments

Comments

@mingo0117
Copy link

mingo0117 commented Sep 27, 2022

For help: I have initialized a three-party computing environment by setting environment variables (os.environ and crypten.init()),parameters just like:

alice:
{
    "WORLD_SIZE": "3",
    "RANK": "0",  
    "RENDEZVOUS": "env://",
    "MASTER_ADDR": "192.168.173.173",
    "MASTER_PORT": "9003"
}
bob:
{
    "WORLD_SIZE": "3",
    "RANK": "1",  
    "RENDEZVOUS": "env://",
    "MASTER_ADDR": "192.168.173.173",
    "MASTER_PORT": "9003"
}
carol
{
    "WORLD_SIZE": "3",
    "RANK": "2",  
    "RENDEZVOUS": "env://",
    "MASTER_ADDR": "192.168.173.173",
    "MASTER_PORT": "9003"
}

It works. But now I want to use only Alice and Bob for the two-party operation, and it is clear that the original environment variables are no longer applicable. So what's the solution, other than restarting the service? I've tried crypten.uninit(), set two-party environment variables, just like:

alice:
{
    "WORLD_SIZE": "2",
    "RANK": "0",  
    "RENDEZVOUS": "env://",
    "MASTER_ADDR": "192.168.173.173",
    "MASTER_PORT": "9004"
}
bob:
{
    "WORLD_SIZE": "2",
    "RANK": "1",  
    "RENDEZVOUS": "env://",
    "MASTER_ADDR": "192.168.173.173",
    "MASTER_PORT": "9004"
}

and crypten.init(), but it still doesn't work (crypten.init() blocks).

Thx!

@mohammad-alrubaie
Copy link
Contributor

Hello,
Two quick ideas. Have you tried to run crypten.uninit() before changing the original environment variables, and crypten.init() after updating them? Also, have you issued crypten.uninit() from the rank 0 machine?

@lvdmaaten
Copy link
Member

CrypTen assumes that all parties partake in all the computations and communication. You can uninit and init per @mohammad-alrubaie's suggestions but this is not very efficient: for example, it will cause PRZS seeds to always be reinitialized (which adds a round of communication) and re-does the rendezvous between parties.

I faced a similar problem recently and hacked up this, which implements a participating_parties context manager. The code snippet does require #393 to be merged. I hope this is helpful.

@lvdmaaten
Copy link
Member

@mingo0117 Does this answer your question?

@mingo0117
Copy link
Author

@mingo0117 Does this answer your question?

Sorry, I was a little busy recently and forgot to reply. The problem has been solved. Thank you very much!

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

3 participants