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

some small changes to make mpyc compatible with oblif #25

Merged
merged 2 commits into from
May 10, 2021

Conversation

meilof
Copy link
Collaborator

@meilof meilof commented May 8, 2021

These small changes make it possible to use mpyc together with oblif:

  • call if_else via the SecureObject so that no access to the runtime is needed
  • let if_else return directly if the if and else objects are the same
  • make SecureObjects immutable so that objects containing them can be efficiently deepcopied

@codecov-commenter
Copy link

codecov-commenter commented May 8, 2021

Codecov Report

Merging #25 (051e69a) into master (47ac2cc) will decrease coverage by 0.03%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #25      +/-   ##
==========================================
- Coverage   89.75%   89.72%   -0.04%     
==========================================
  Files          13       13              
  Lines        4324     4330       +6     
==========================================
+ Hits         3881     3885       +4     
- Misses        443      445       +2     
Impacted Files Coverage Δ
mpyc/runtime.py 88.35% <50.00%> (-0.06%) ⬇️
mpyc/sectypes.py 99.38% <50.00%> (-0.41%) ⬇️
mpyc/random.py 100.00% <0.00%> (+0.58%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 47ac2cc...051e69a. Read the comment docs.

@lschoe
Copy link
Owner

lschoe commented May 9, 2021

Hi Meilof!
The changes you propose are very reasonable, certainly to make the use of oblif near to effortless.

I've made some minor changes to make things more consistent with MPyC. Defining __deepcopy__ for SecureObject does not seem to interfere with anything (yet). I've also tested things with all the MPyC demos.

The secobj.if_else(x, y) idiom was on the roadmap so that's certainly fine too. There will be more instance methods like if_else() for SecureObject to hide the use of the runtime. E.g., for runtime.random_bits() etc.

The shortcut for the "x is y" case in if_else() looks like it should work in general, I can imagine that it may give you a much better efficiency for oblif. Or do you need it also for another reason?

@meilof
Copy link
Collaborator Author

meilof commented May 9, 2021 via email

@lschoe lschoe merged commit b99aa11 into lschoe:master May 10, 2021
@lschoe
Copy link
Owner

lschoe commented May 10, 2021

Yeah, currently there are no in-place methods for SecureObject. I've experimented a bit with it though, making asyncoro.gather_shares() in-place and when working with SecureObject subclasses for Numpy arrays. Such in-place versions may give a slight performance enhancement. So, in the future this may break, but then if_else might check if x is y and also that x and y are not 'dirty' (potentially modified).

So, your PR is now merged, thx a lot!

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

Successfully merging this pull request may close these issues.

3 participants