-
Notifications
You must be signed in to change notification settings - Fork 338
Rabbit implementation #1613
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
base: master
Are you sure you want to change the base?
Rabbit implementation #1613
Conversation
|
|
| assert self.m == other.m | ||
| self.v.update(other.v) | ||
|
|
||
|
|
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.
This class will be removed from types.py as it's not needed. The rabbit comparison logic is added in non_linear.py
| dest="edabit", | ||
| help="mixing arithmetic and binary computation using edaBits", | ||
| ) | ||
| parser.add_option( |
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 tried setting the flag for comparison_rabbit with program.use_comparison_rabbit(True) in the .mpc file (similar to use_edabits), but it always remained false, and I only managed to set it true by adding --comparison_rabit in the compilation instruction. Do you see what I am doing wrong there?
| """ | ||
| print_str(str(s) + '\n', *args, **kwargs) | ||
|
|
||
|
|
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.
will also be deleted
| z = floatingpoint.PreOpL(floatingpoint.or_op, y[::-1])[::-1] + [0] | ||
| w = [z[i] - z[i + 1] for i in range(BIT_SIZE)] | ||
|
|
||
| return types.sintbit(1) - types.sintbit(sum((R_bits[i] & w[i]) for i in range(BIT_SIZE))) |
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.
This line was initially 1 - sum(...) but I was getting the error below, and it only worked when I converted 1 and the value of the sum. Could you explain this part?
File "/benchmarks/MP-SPDZ/Compiler/comparison.py", line 85, in LTZ
movs(s, program.non_linear.ltz(a, k))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/benchmarks/MP-SPDZ/Compiler/non_linear.py", line 81, in ltz
return self.rabbitLTZ(a, k)
^^^^^^^^^^^^^^^^^^^^
File "/benchmarks/MP-SPDZ/Compiler/non_linear.py", line 71, in rabbitLTZ
w[1] = self.LTBits(masked_a, r_bits, BIT_SIZE)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/benchmarks/MP-SPDZ/Compiler/non_linear.py", line 54, in LTBits
return_value = 1 - sum((R_bits[i] & w[i]) for i in range(BIT_SIZE))
~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
File "/benchmarks/MP-SPDZ/Compiler/types.py", line 229, in read_mem_operation
return operation(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/benchmarks/MP-SPDZ/Compiler/GC/types.py", line 523, in __add__
return self.xor_int(other)
^^^^^^^^^^^^^^^^^^^
File "/benchmarks/MP-SPDZ/Compiler/GC/types.py", line 585, in xor_int
self_bits = self.bit_decompose()
^^^^^^^^^^^^^^^^^^^^
File "/benchmarks/MP-SPDZ/Compiler/GC/types.py", line 86, in bit_decompose
suffix = [0] * (n - self.n)
~~^~~~~~~~
TypeError: unsupported operand type(s) for -: 'NoneType' and 'NoneType'
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.
Also, now the result of the comparison is no longer 0 or 1, but I had values like -1 and 2, so I think that there might be something wrong with the typing there.
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.
It might be unintuitive, but the description for variables needs to come after the variable to make the documentation work: https://mp-spdz.readthedocs.io/en/latest/Compiler.html#Compiler.program.Program.use_edabit
No description provided.