Running crypten computation either with plans or jailing#3410
Merged
Running crypten computation either with plans or jailing#3410
Conversation
LaRiffle
suggested changes
Apr 26, 2020
Contributor
LaRiffle
left a comment
There was a problem hiding this comment.
Tiny changes and we're done :)
syft/messaging/message.py
Outdated
| so they can communicate and exchange tensors and shares while doing computation. This message | ||
| allows the exchange of information such as the ip and port of the master party to connect to, | ||
| as well as the rank of the party to run and the number of parties involved. Compared to | ||
| CryptenInitPlan, this message also send two extra field, a JailRunner and a crypten model.""" |
Contributor
There was a problem hiding this comment.
Suggested change
| CryptenInitPlan, this message also send two extra field, a JailRunner and a crypten model.""" | |
| CryptenInitPlan, this message also sends two extra fields, a JailRunner and a Crypten model.""" |
syft/messaging/message.py
Outdated
| return (self.crypten_context,) | ||
|
|
||
| @staticmethod | ||
| def simplify(worker: AbstractWorker, ptr: "CryptenInitJail") -> tuple: |
Contributor
There was a problem hiding this comment.
Maybe rename ptr -> message ?
syft/messaging/message.py
Outdated
Comment on lines
+794
to
+796
| context = msg_tuple[0:4] | ||
| jail_runner = msg_tuple[4] | ||
| model = msg_tuple[5] |
Contributor
There was a problem hiding this comment.
Suggested change
| context = msg_tuple[0:4] | |
| jail_runner = msg_tuple[4] | |
| model = msg_tuple[5] | |
| *context, jail_runner, model = msg_tuple |
syft/workers/base.py
Outdated
| rank = r | ||
| break | ||
|
|
||
| assert rank != None |
Contributor
There was a problem hiding this comment.
Suggested change
| assert rank != None | |
| assert rank is not None |
| CryptenInitPlan, this message also send two extra field, a JailRunner and a crypten model.""" | ||
|
|
||
| def __init__(self, crypten_context, jail_runner, model=None): | ||
| self.crypten_context = crypten_context |
Contributor
There was a problem hiding this comment.
I guess one example of Crypten context would be useful
gmuraru
reviewed
Apr 28, 2020
| @@ -141,7 +141,8 @@ def __init__( | |||
| self._hook_native_tensor(torch.Tensor, TorchTensor) | |||
|
|
|||
| if dependency_check.crypten_available: | |||
Member
Author
There was a problem hiding this comment.
Oh, I shouldn't have pushed that, I was only commenting this to not hook mpc tensor to get cat and stuff working, will just re-enable it for the moment
91acf35 to
5b69d19
Compare
* Context of computation for crypten (#2963) * New message type for crypten party initialization * Handle CryptenInit message by running local party * Define a new context of computation for crypten The new context of computation can run parties that are distributed across syft workers. The communication of crypten parties remains the same, however, syft workers handle initialization and the serialization of return values. * updated docs * testing crypten context * fix: was setting the bad env variable DISTRIBUTED_BACKEND should have been set and not BACKEND * test serde of CryptenInit message * add crypten as core deps, this should change to extra * delete useless comment * fix: list CryptenInit in OBJ_SIMPLIFIER_AND_DETAILERS * fix msgpack tests * run black * don't cover empty function * Init Crypten Plan * Remove python 3.6 from github actions * Remove SyftCrypTensor as wrapper from MPCTensor * Remove SyftCrypTensor from export * Check for is_wrapper in placeholder * Add placeholder attribute * Bug Fix Message * Add serde test * Old CrypTen version * Add crypten to execution * wrap our load function around crypten.load * Update syft/frameworks/crypten/__init__.py Co-Authored-By: Ayoub Benaissa <ayouben9@gmail.com> * Rework crypten integration for plans * linter fix * Remove duplicate test Co-Authored-By: Ayoub Benaissa <ayouben9@gmail.com> * Crypten track master * Remove SyftCryptensor as a dependency * Remove python 3.6 * Use correct commit * Add MPCTensor as FrameworkTensor and remove SyftCrypTensor * remove duplicated CrypTenInit * Review pass1 Co-authored-by: Ayoub Benaissa <ayouben9@gmail.com>
6ead606 to
6499207
Compare
LaRiffle
approved these changes
May 3, 2020
Contributor
LaRiffle
left a comment
There was a problem hiding this comment.
Thanks for the changes!
youben11
commented
May 5, 2020
gmuraru
reviewed
May 5, 2020
syft/messaging/message.py
Outdated
| def detail(worker: AbstractWorker, msg_tuple: tuple) -> "CryptenInitJail": | ||
| """ | ||
| This function takes the simplified tuple version of this message and converts | ||
| it into an CryptenInitJail. The simplify() method runs the inverse of this method. |
gmuraru
reviewed
May 5, 2020
| break | ||
|
|
||
| assert rank != None | ||
| assert rank is not None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
At the moment we have two ways of running crypten computations, either using plans or jails, instead of having two different branches that have similar functionalities, better to be able to use both in parallel.
This PR introduce a new message type CryptenInitJail to start a JailRunner on other syft workers, need to merge into syft-proto OpenMined/syft-proto#93. This way we can send messages to initiate either plans or jails.
Type of change
Please mark options that are relevant.
Checklist: