V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
Philippa
V2EX  ›  问与答

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

  •  
  •   Philippa · 2020-06-04 04:06:14 +08:00 · 1425 次点击
    这是一个创建于 1421 天前的主题,其中的信息可能已经有所发展或是发生改变。

    这两天在看分布式的东西,在看 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
    ...
    

    有点懵,求解,谢谢。

    2 条回复    2020-06-05 07:01:03 +08:00
    Wincer
        1
    Wincer  
       2020-06-04 08:06:40 +08:00 via Android
    并行测试是要求同时启动两个(或多个) 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
        2
    Philippa  
    OP
       2020-06-05 07:01:03 +08:00
    @Wincer thanks,的确是格式问题。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3565 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 10:45 · PVG 18:45 · LAX 03:45 · JFK 06:45
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.