MIT 6.824 Lab1 并行测试部分如何过?

2020-06-04 04:06:14 +08:00
 Philippa

这两天在看分布式的东西,在看 MIT 那个已经晃荡好久了,所以开始做 lab1 。indexer,wc 和 crash 测试问题 ok,但 parallelism 总是不能过,起了两个,但总告诉我的 worker 运行数为 0😵,感觉是输出格式不对所以不行。然后我回去看了一下: https://pdos.csail.mit.edu/6.824/labs/lab-mr.html

我觉得是这个提示我没看懂:

A mr-out-X file should contain one line per Reduce function output. The line should be generated with the Go "%v %v" format, called with the key and value. Have a look in main/mrsequential.go for the line commented "this is the correct format". The test script will fail if your implementation deviates too much from this format.

然后测试语句是这个,心想怎么在读我的文件:

NT=`cat mr-out* | grep '^times-' | wc -l | sed 's/ //g'`
if [ "$NT" != "2" ]
then
  echo '---' saw "$NT" workers rather than 2
  echo '---' map parallelism test: FAIL
  failed_any=1
fi

而我参考了例子的 mr-out-X 文件却是这样的,为了知道我的并行数,读这个有什么用呢?

A 509
ABOUT 2
ACT 8
ACTRESS 1
ACTUAL 8
ADLER 1
ADVENTURE 12
...

有点懵,求解,谢谢。

1439 次点击
所在节点    问与答
2 条回复
Wincer
2020-06-04 08:06:40 +08:00
并行测试是要求同时启动两个(或多个) worker 的时候,master 能正确的给 worker 分配任务,这两个 worker 也能同时生成各自的 intermediate file ( mr-x-y ),在 reduce 阶段再合成 mr-out-x 再和只有一个 worker 的时候进行对比,楼主可以看看自己是在 map 阶段出了问题还是 reduce 阶段出了问题。以及 mr-out-x 的文件格式就是这样的:“单词 出现次数”,intermediate file 的格式每一行是一个 json,key 是单词,value 是 1 。
Philippa
2020-06-05 07:01:03 +08:00
@Wincer thanks,的确是格式问题。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/678446

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX