Question about performance of SCALE-MAMBA program

40 views
Skip to first unread message

Sakine Yalman

unread,
Nov 29, 2022, 9:25:05 AM11/29/22
to sp...@googlegroups.com
Hi SCALE-MAMBA Team,

I hope you are all well.

I have a question concerning the performance of programs in SCALE-MAMBA.

The following code is what I am computing, and the diagram is the runtime behaviour I am observing. It changes significantly after 8 participants. And we see this effect even more dramatically on our large application. Is there any explanation for this? 

I have checked the documentation for an explanation, but I could not find it. I am sorry if I am missing anything. 
Thank you for your time in advance.

Kind regards,
Sakine Yalman

#![no_std]
#![no_main]

const COMPANY_NUM:u64 = $numberofcompanies;

fn calculate_aggregated_value() {

    let mut secret_result= SecretModp::from(0);
    let x: i64 = 100;

    for i in 0..COMPANY_NUM {
        secret_result= secret_result + SecretModp::from(SecretI64::from(x.rand()));
    }

    // Output Aggregated Value to main(0) company //
    secret_result.private_output(0,10);
}

#[scale::main(KAPPA = 40)]
#[inline(always)]
fn main() {

    let v: i64 = 1;

    let _ans = open_channel(10);
    v.output(0);

    //  Calculation of Aggregated Value//
    calculate_aggregated_value();

    close_channel(10);
}

image.png

Nigel Smart

unread,
Nov 29, 2022, 9:26:29 AM11/29/22
to sp...@googlegroups.com
What secret sharing scheme are you using, and with what
threshold?

Nigel
> image.png
>
> --
> You received this message because you are subscribed to the Google
> Groups "SPDZ/SCALE-MAMBA Discussion Group" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to spdz+uns...@googlegroups.com
> <mailto:spdz+uns...@googlegroups.com>.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/spdz/CAMV6rAWAiQOeL8w-X20HZDquWq4x46Tg2S_n3QCsJ57wCwZqVQ%40mail.gmail.com <https://groups.google.com/d/msgid/spdz/CAMV6rAWAiQOeL8w-X20HZDquWq4x46Tg2S_n3QCsJ57wCwZqVQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
OpenPGP_0x7224BD3CC839656F.asc
OpenPGP_signature

Sakine Yalman

unread,
Nov 29, 2022, 9:41:17 AM11/29/22
to Nigel Smart, sp...@googlegroups.com
Hi, 

Sorry, I should have written them too!

I am using Shamir secret sharing and the threshold is changing with the number of companies joining the computation which is companies/2-1. And as Modulus I am using the one you used in you examples which is 340282366920938463463374607431768211507.

Nigel Smart <nigel.pa...@gmail.com>, 29 Kas 2022 Sal, 14:26 tarihinde şunu yazdı:
To unsubscribe from this group and stop receiving emails from it, send an email to spdz+uns...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/spdz/59e1ee9f-4c83-67eb-fce6-54b36693495f%40gmail.com.

Nigel Smart

unread,
Nov 29, 2022, 9:44:33 AM11/29/22
to Sakine Yalman, sp...@googlegroups.com
Hi

That is the reason.

The protocols change depending on n choose t.

If n choose t is small then a non-interactive PRSS is used
to generate random shares.

If n choose t is big then an interactive protocol is used
instead.
- This latter one is not that well optimized for multiple
usage

Nigel

On 29/11/2022 15:41, Sakine Yalman wrote:
> Hi,
>
> Sorry, I should have written them too!
>
> I am using Shamir secret sharing and the threshold is changing with the
> number of companies joining the computation which is companies/2-1. And
> as Modulus I am using the one you used in you examples which is
> 340282366920938463463374607431768211507.
>
> Nigel Smart <nigel.pa...@gmail.com
> <mailto:nigel.pa...@gmail.com>>, 29 Kas 2022 Sal, 14:26 tarihinde
> <mailto:spdz%2Bunsu...@googlegroups.com>
> > <mailto:spdz+uns...@googlegroups.com
> <mailto:spdz%2Bunsu...@googlegroups.com>>.
> > To view this discussion on the web, visit
> >
> https://groups.google.com/d/msgid/spdz/CAMV6rAWAiQOeL8w-X20HZDquWq4x46Tg2S_n3QCsJ57wCwZqVQ%40mail.gmail.com <https://groups.google.com/d/msgid/spdz/CAMV6rAWAiQOeL8w-X20HZDquWq4x46Tg2S_n3QCsJ57wCwZqVQ%40mail.gmail.com> <https://groups.google.com/d/msgid/spdz/CAMV6rAWAiQOeL8w-X20HZDquWq4x46Tg2S_n3QCsJ57wCwZqVQ%40mail.gmail.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/spdz/CAMV6rAWAiQOeL8w-X20HZDquWq4x46Tg2S_n3QCsJ57wCwZqVQ%40mail.gmail.com?utm_medium=email&utm_source=footer>>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "SPDZ/SCALE-MAMBA Discussion Group" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to spdz+uns...@googlegroups.com
> <mailto:spdz%2Bunsu...@googlegroups.com>.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/spdz/59e1ee9f-4c83-67eb-fce6-54b36693495f%40gmail.com <https://groups.google.com/d/msgid/spdz/59e1ee9f-4c83-67eb-fce6-54b36693495f%40gmail.com>.
>
OpenPGP_0x7224BD3CC839656F.asc
OpenPGP_signature

Sakine Yalman

unread,
Nov 29, 2022, 9:51:43 AM11/29/22
to Nigel Smart, sp...@googlegroups.com
Okay.

So, basically after 8 participants, I am having a threshold that makes an interactive protocol to generate random shares and that is why I have this peak, am I right?


Nigel Smart <nigel.pa...@gmail.com>, 29 Kas 2022 Sal, 14:44 tarihinde şunu yazdı:

Nigel Smart

unread,
Nov 29, 2022, 10:04:11 AM11/29/22
to sp...@googlegroups.com
Yep

On 29/11/2022 15:51, Sakine Yalman wrote:
> Okay.
>
> So, basically after 8 participants, I am having a threshold that makes
> an interactive protocol to generate random shares and that is why I have
> this peak, am I right?
>
>
> Nigel Smart <nigel.pa...@gmail.com
> <mailto:nigel.pa...@gmail.com>>, 29 Kas 2022 Sal, 14:44 tarihinde
> şunu yazdı:
>
> Hi
>
> That is the reason.
>
> The protocols change depending on n choose t.
>
> If n choose t is small then a non-interactive PRSS is used
> to generate random shares.
>
> If n choose t is big then an interactive protocol is used
> instead.
>    - This latter one is not that well optimized for multiple
>      usage
>
> Nigel
>
> On 29/11/2022 15:41, Sakine Yalman wrote:
> > Hi,
> >
> > Sorry, I should have written them too!
> >
> > I am using Shamir secret sharing and the threshold is changing
> with the
> > number of companies joining the computation which is
> companies/2-1. And
> > as Modulus I am using the one you used in you examples which is
> > 340282366920938463463374607431768211507.
> >
> > Nigel Smart <nigel.pa...@gmail.com
> <mailto:nigel.pa...@gmail.com>
> > <mailto:nigel.pa...@gmail.com
> >     <mailto:spdz%2Bunsu...@googlegroups.com
> <mailto:spdz%252Buns...@googlegroups.com>>
> >      > <mailto:spdz+uns...@googlegroups.com
> <mailto:spdz%2Bunsu...@googlegroups.com>
> >     <mailto:spdz%2Bunsu...@googlegroups.com
> <mailto:spdz%252Buns...@googlegroups.com>>>.
> >      > To view this discussion on the web, visit
> >      >
> >
> https://groups.google.com/d/msgid/spdz/CAMV6rAWAiQOeL8w-X20HZDquWq4x46Tg2S_n3QCsJ57wCwZqVQ%40mail.gmail.com <https://groups.google.com/d/msgid/spdz/CAMV6rAWAiQOeL8w-X20HZDquWq4x46Tg2S_n3QCsJ57wCwZqVQ%40mail.gmail.com> <https://groups.google.com/d/msgid/spdz/CAMV6rAWAiQOeL8w-X20HZDquWq4x46Tg2S_n3QCsJ57wCwZqVQ%40mail.gmail.com <https://groups.google.com/d/msgid/spdz/CAMV6rAWAiQOeL8w-X20HZDquWq4x46Tg2S_n3QCsJ57wCwZqVQ%40mail.gmail.com>> <https://groups.google.com/d/msgid/spdz/CAMV6rAWAiQOeL8w-X20HZDquWq4x46Tg2S_n3QCsJ57wCwZqVQ%40mail.gmail.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/spdz/CAMV6rAWAiQOeL8w-X20HZDquWq4x46Tg2S_n3QCsJ57wCwZqVQ%40mail.gmail.com?utm_medium=email&utm_source=footer> <https://groups.google.com/d/msgid/spdz/CAMV6rAWAiQOeL8w-X20HZDquWq4x46Tg2S_n3QCsJ57wCwZqVQ%40mail.gmail.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/spdz/CAMV6rAWAiQOeL8w-X20HZDquWq4x46Tg2S_n3QCsJ57wCwZqVQ%40mail.gmail.com?utm_medium=email&utm_source=footer>>>.
> >
> >     --
> >     You received this message because you are subscribed to the
> Google
> >     Groups "SPDZ/SCALE-MAMBA Discussion Group" group.
> >     To unsubscribe from this group and stop receiving emails from it,
> >     send an email to spdz+uns...@googlegroups.com
> <mailto:spdz%2Bunsu...@googlegroups.com>
> >     <mailto:spdz%2Bunsu...@googlegroups.com
> <mailto:spdz%252Buns...@googlegroups.com>>.
> >     To view this discussion on the web, visit
> >
> https://groups.google.com/d/msgid/spdz/59e1ee9f-4c83-67eb-fce6-54b36693495f%40gmail.com <https://groups.google.com/d/msgid/spdz/59e1ee9f-4c83-67eb-fce6-54b36693495f%40gmail.com> <https://groups.google.com/d/msgid/spdz/59e1ee9f-4c83-67eb-fce6-54b36693495f%40gmail.com <https://groups.google.com/d/msgid/spdz/59e1ee9f-4c83-67eb-fce6-54b36693495f%40gmail.com>>.
> >
>
OpenPGP_0x7224BD3CC839656F.asc
OpenPGP_signature

Sakine Yalman

unread,
Nov 29, 2022, 10:05:55 AM11/29/22
to Nigel Smart, sp...@googlegroups.com
Thank you so much for your answer and quick reply :)

Kind regards, 
Sakine

Nigel Smart <nigel.pa...@gmail.com>, 29 Kas 2022 Sal, 15:04 tarihinde şunu yazdı:
To unsubscribe from this group and stop receiving emails from it, send an email to spdz+uns...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/spdz/973314eb-d114-6101-925e-a2b556407475%40gmail.com.
Reply all
Reply to author
Forward
0 new messages