MP-SPDZ开源库——将结果输出到文件

mp-spdz测试版本:0.3.0
使用到的测试程序:./Program/Source/test_sbitint.mpc

  1. 首先对程序进行编译:./compile.py -B 32 test_sbitint
    输出:
ubuntu@ubuntu:~/spdz030$ ./compile.py -B 32 test_sbitint
Default bit length: 32
Default security parameter: 40
Compiling file /home/ubuntu/spdz030/Programs/Source/test_sbitint.mpc
Not merging instructions in tape test_sbitint-0
Writing to /home/ubuntu/spdz030/Programs/Schedules/test_sbitint.sch
Writing to /home/ubuntu/spdz030/Programs/Bytecode/test_sbitint-0.bc
Program requires at most:
        4404 bit triples

  1. 执行程序
    首先是不将结果输出到文件,直接打印在屏幕上,使用命令./emulate.x test_sbitint
    输出结果为:
ubuntu@ubuntu:~/spdz030$ ./emulate.x test_sbitint
Trying to run 64-bit computation
16: 0 5 0x5
17: 0 1 0x1
18: 0 0 0x0
19: 0 1 0x1
20: 0 1 0x1
21: 0 4 0x4
23: 0 6 0x6
24: 0 6 0x6
25: 0 6 0x6
27: -4294967296 -1 0xffffffff
28: 0 2 0x2
29: 0 1 0x1
31: 0 4 0x4
35: 0 -3 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
37: 0 2 0x2
38: 0 2 0x2
The following timing is inclusive preprocessing.
Time = 0.00297332 seconds 
Data sent = 0 MB in ~1 rounds (party 0)
Global data sent = 0 MB (all parties)

使用-OF将结果输出到文件里,使用命令:./emulate.x -OF outPut test_sbitint
outPut是输出的文件名一部分,spdz库会根据这个名字,创建文件outPut-P0-0,结果被保存在这里面。
输出信息:

ubuntu@ubuntu:~/spdz030$ ./emulate.x -OF outPut  test_sbitint
Trying to run 64-bit computation
The following timing is inclusive preprocessing.
Time = 0.00320688 seconds 
Data sent = 0 MB in ~1 rounds (party 0)
Global data sent = 0 MB (all parties)

运行命令后,屏幕上没有了输出结果,在根目录文件夹内多了一个文件
在这里插入图片描述
查看里面的内容:

ubuntu@ubuntu:~/spdz030$ cat outPut-P0-0 
16: 0 5 0x5
17: 0 1 0x1
18: 0 0 0x0
19: 0 1 0x1
20: 0 1 0x1
21: 0 4 0x4
23: 0 6 0x6
24: 0 6 0x6
25: 0 6 0x6
27: -4294967296 -1 0xffffffff
28: 0 2 0x2
29: 0 1 0x1
31: 0 4 0x4
35: 0 -3 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
35: 0 5 0x5
(上面为部分结果,以下内容省略)
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值