-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Running crypten computation either with plans or jailing #3410
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
a9030ab
Init Crypten Plan + Rebased (#3254)
gmuraru 10b3ea7
new message CryptenInitJail and CryptenInit -> CryptenInitPlan
youben11 2ea60c2
choice to run jails or plans by decorating a function or a plan
youben11 e209d45
typos and small changes
youben11 0bdbe59
reformatting
youben11 6499207
re-enable mpc hooking
youben11 9b47602
Merge branch 'crypten' into youben11/run-jail
youben11 3670df8
lint
youben11 4ffbff0
update tests
youben11 6cdb131
remove old comments
youben11 9a06726
fix serialization CryptenInitJail and tests
youben11 248cb2c
lint
youben11 016dce4
Update pip-dep/requirements.txt
youben11 8b2933c
typos
youben11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,14 +28,14 @@ | |
| from syft.messaging.message import ForceObjectDeleteMessage | ||
| from syft.messaging.message import GetShapeMessage | ||
| from syft.messaging.message import IsNoneMessage | ||
| from syft.messaging.message import CryptenInit | ||
| from syft.messaging.message import CryptenInitPlan | ||
| from syft.messaging.message import CryptenInitJail | ||
| from syft.messaging.message import Message | ||
| from syft.messaging.message import ObjectMessage | ||
| from syft.messaging.message import ObjectRequestMessage | ||
| from syft.messaging.message import PlanCommandMessage | ||
| from syft.messaging.message import SearchMessage | ||
| from syft.workers.abstract import AbstractWorker | ||
| from syft.messaging.message import CryptenInit | ||
|
|
||
| from syft.frameworks.crypten import run_party | ||
|
|
||
|
|
@@ -132,7 +132,8 @@ def __init__( | |
| IsNoneMessage: self.is_object_none, | ||
| GetShapeMessage: self.handle_get_shape_message, | ||
| SearchMessage: self.respond_to_search, | ||
| CryptenInit: self.run_crypten_party, | ||
| CryptenInitPlan: self.run_crypten_party_plan, | ||
| CryptenInitJail: self.run_crypten_party_jail, | ||
| } | ||
|
|
||
| self._plan_command_router = { | ||
|
|
@@ -430,11 +431,11 @@ def send( | |
|
|
||
| return pointer | ||
|
|
||
| def run_crypten_party(self, message: tuple): | ||
| def run_crypten_party_plan(self, message: CryptenInitPlan): | ||
| """Run crypten party according to the information received. | ||
|
|
||
| Args: | ||
| message (CryptenInit): should contain the rank, world_size, master_addr and master_port. | ||
| message (CryptenInitPlan): should contain the rank, world_size, master_addr and master_port. | ||
|
|
||
| Returns: | ||
| An ObjectMessage containing the return value of the crypten function computed. | ||
|
|
@@ -453,11 +454,37 @@ def run_crypten_party(self, message: tuple): | |
| rank = r | ||
| break | ||
|
|
||
| assert rank != None | ||
| assert rank is not None | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for fixing this :D |
||
|
|
||
| return_value = run_party(plan, rank, world_size, master_addr, master_port, (), {}) | ||
| return ObjectMessage(return_value) | ||
|
|
||
| def run_crypten_party_jail(self, message: CryptenInitJail): | ||
| """Run crypten party according to the information received. | ||
|
|
||
| Args: | ||
| message (CryptenInitJail): should contain the rank, world_size, master_addr and master_port. | ||
|
|
||
| Returns: | ||
| An ObjectMessage containing the return value of the crypten function computed. | ||
| """ | ||
| from syft.frameworks.crypten.jail import JailRunner | ||
|
|
||
| self.rank_to_worker_id, world_size, master_addr, master_port = message.crypten_context | ||
| ser_func = message.jail_runner | ||
| jail_runner = JailRunner.detail(ser_func) | ||
|
|
||
| rank = None | ||
| for r, worker_id in self.rank_to_worker_id.items(): | ||
| if worker_id == self.id: | ||
| rank = r | ||
| break | ||
|
|
||
| assert rank is not None | ||
|
|
||
| return_value = run_party(jail_runner, rank, world_size, master_addr, master_port, (), {}) | ||
| return ObjectMessage(return_value) | ||
|
|
||
| def handle_object_msg(self, obj_msg: ObjectMessage): | ||
| # This should be a good seam for separating Workers from ObjectStorage (someday), | ||
| # so that Workers have ObjectStores instead of being ObjectStores. That would open | ||
|
|
||
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess one example of Crypten context would be useful