V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Philippa
V2EX  ›  问与答

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

  •  
  •   Philippa · Jun 4, 2020 · 1847 views
    This topic created in 2165 days ago, the information mentioned may be changed or developed.

    这两天在看分布式的东西,在看 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 replies    2020-06-05 07:01:03 +08:00
    Wincer
        1
    Wincer  
       Jun 4, 2020 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
       Jun 5, 2020
    @Wincer thanks,的确是格式问题。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5385 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 08:05 · PVG 16:05 · LAX 01:05 · JFK 04:05
    ♥ Do have faith in what you're doing.