Skip to content

specify # threads for each task #116

Open

Description

@yakra
  • Add commandline options (probably of only the --TwoHyphen variety) to specify the number of threads for each individual threaded task, overriding -t if also specified.
  • Run tests to find the sweet spot for each task.
  • Create optimized shell scripts.

Activity

  1. yakra commented on Mar 19, 2020

    @yakra
    OwnerAuthor

    # of threads for optimum efficiency as of ef1894f:

    thread BT
    (4)
    lab1
    (8)
    lab1.5
    (8)
    lab2
    (16)
    lab3
    (24)
    ReadWptThread 4 8 4 8 9
    NmpSearchThread 4 8 7-8 9-16 19
    NmpMergedThread 4 6 8 15 21
    ReadListThread 4 8 8 15 15
    ConcAugThread 4 3 4 5 3
    ComputeStatsThread 4 3-8 3-4 10-11 12
    UserLogThread 4 8 8 16 24
    SubgraphThread 4 8 8 14 10
  2. yakra commented on Mar 21, 2020

    @yakra
    OwnerAuthor

    Well this is mysterious.
    On BiggaTomato, when <4 ReadWptThreads are followed by 4+ NmpSearchThreads, siteupdate crashes when we try to create ifstream nmpfpfile(args.highwaydatapath+"/nmpfps.log");, of all things.

    • This does not appear to be affected by the value of NumThreads. (Or is it? More testing required...)
    • No obvious questionable sections of code. Edit: It was obvious!
    • ToDo: Test on lab1.5; see whether related to # of hardware threads.
    • In the meantime, more exhaustive testing on BiggaTomato is underway.
    • Longer term: See how much code I can delete & how much I can pare down the program while maintaining the same behavior. Create a new fork of yakra/HighwayData and add commits to that.
    *** Error in `./siteupdate_numthr': corrupted size vs. prev_size: 0x00000000056060a0 ***
    ======= Backtrace: =========
    /lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fa42b1067e5]
    /lib/x86_64-linux-gnu/libc.so.6(+0x7e9dc)[0x7fa42b10d9dc]
    /lib/x86_64-linux-gnu/libc.so.6(+0x80678)[0x7fa42b10f678]
    /lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7fa42b11353c]
    ./siteupdate_numthr[0x46320a]
    ./siteupdate_numthr[0x46322a]
    ./siteupdate_numthr[0x451eb4]
    ./siteupdate_numthr[0x44aef2]
    ./siteupdate_numthr[0x420b88]
    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7fa42b0af830]
    ./siteupdate_numthr[0x4048a9]
    ======= Memory map: ========
    00400000-004d9000 r-xp 00000000 08:01 9568896                            /home/yakra/TravelMapping/yakra/DataProcessing/siteupdate/cplusplus/siteupdate_numthr
    006d9000-006da000 r--p 000d9000 08:01 9568896                            /home/yakra/TravelMapping/yakra/DataProcessing/siteupdate/cplusplus/siteupdate_numthr
    006da000-006db000 rw-p 000da000 08:01 9568896                            /home/yakra/TravelMapping/yakra/DataProcessing/siteupdate/cplusplus/siteupdate_numthr
    014a4000-07252000 rw-p 00000000 00:00 0                                  [heap]
    7fa3e4000000-7fa3e4021000 rw-p 00000000 00:00 0 
    7fa3e4021000-7fa3e8000000 ---p 00000000 00:00 0 
    7fa3ec000000-7fa3ede52000 rw-p 00000000 00:00 0 
    7fa3ede52000-7fa3f0000000 ---p 00000000 00:00 0 
    7fa3f0000000-7fa3f1d96000 rw-p 00000000 00:00 0 
    7fa3f1d96000-7fa3f4000000 ---p 00000000 00:00 0 
    7fa3f4000000-7fa3f7fff000 rw-p 00000000 00:00 0 
    7fa3f7fff000-7fa3f8000000 ---p 00000000 00:00 0 
    7fa3f8000000-7fa3fabdc000 rw-p 00000000 00:00 0 
    7fa3fabdc000-7fa3fc000000 ---p 00000000 00:00 0 
    7fa3fc000000-7fa400000000 rw-p 00000000 00:00 0 
    7fa400000000-7fa404000000 rw-p 00000000 00:00 0 
    7fa404000000-7fa408000000 rw-p 00000000 00:00 0 
    7fa408000000-7fa40c000000 rw-p 00000000 00:00 0 
    7fa40c000000-7fa410000000 rw-p 00000000 00:00 0 
    7fa410000000-7fa414000000 rw-p 00000000 00:00 0 
    7fa414000000-7fa418000000 rw-p 00000000 00:00 0 
    7fa418000000-7fa41c000000 rw-p 00000000 00:00 0 
    7fa41c000000-7fa420000000 rw-p 00000000 00:00 0 
    7fa420000000-7fa424000000 rw-p 00000000 00:00 0 
    7fa424000000-7fa428000000 rw-p 00000000 00:00 0 
    7fa42908b000-7fa42908c000 ---p 00000000 00:00 0 
    7fa42908c000-7fa42988c000 rw-p 00000000 00:00 0 
    7fa42988c000-7fa42988d000 ---p 00000000 00:00 0 
    7fa42988d000-7fa42a08d000 rw-p 00000000 00:00 0 
    7fa42a08d000-7fa42a08e000 ---p 00000000 00:00 0 
    7fa42a08e000-7fa42a88e000 rw-p 00000000 00:00 0 
    7fa42a88e000-7fa42a88f000 ---p 00000000 00:00 0 
    7fa42a88f000-7fa42b08f000 rw-p 00000000 00:00 0 
    7fa42b08f000-7fa42b24f000 r-xp 00000000 08:01 4723690                    /lib/x86_64-linux-gnu/libc-2.23.so
    7fa42b24f000-7fa42b44f000 ---p 001c0000 08:01 4723690                    /lib/x86_64-linux-gnu/libc-2.23.so
    7fa42b44f000-7fa42b453000 r--p 001c0000 08:01 4723690                    /lib/x86_64-linux-gnu/libc-2.23.so
    7fa42b453000-7fa42b455000 rw-p 001c4000 08:01 4723690                    /lib/x86_64-linux-gnu/libc-2.23.so
    7fa42b455000-7fa42b459000 rw-p 00000000 00:00 0 
    7fa42b459000-7fa42b471000 r-xp 00000000 08:01 4723677                    /lib/x86_64-linux-gnu/libpthread-2.23.so
    7fa42b471000-7fa42b670000 ---p 00018000 08:01 4723677                    /lib/x86_64-linux-gnu/libpthread-2.23.so
    7fa42b670000-7fa42b671000 r--p 00017000 08:01 4723677                    /lib/x86_64-linux-gnu/libpthread-2.23.so
    7fa42b671000-7fa42b672000 rw-p 00018000 08:01 4723677                    /lib/x86_64-linux-gnu/libpthread-2.23.so
    7fa42b672000-7fa42b676000 rw-p 00000000 00:00 0 
    7fa42b676000-7fa42b68c000 r-xp 00000000 08:01 4723173                    /lib/x86_64-linux-gnu/libgcc_s.so.1
    7fa42b68c000-7fa42b88b000 ---p 00016000 08:01 4723173                    /lib/x86_64-linux-gnu/libgcc_s.so.1
    7fa42b88b000-7fa42b88c000 rw-p 00015000 08:01 4723173                    /lib/x86_64-linux-gnu/libgcc_s.so.1
    7fa42b88c000-7fa42b994000 r-xp 00000000 08:01 4723693                    /lib/x86_64-linux-gnu/libm-2.23.so
    7fa42b994000-7fa42bb93000 ---p 00108000 08:01 4723693                    /lib/x86_64-linux-gnu/libm-2.23.so
    7fa42bb93000-7fa42bb94000 r--p 00107000 08:01 4723693                    /lib/x86_64-linux-gnu/libm-2.23.so
    7fa42bb94000-7fa42bb95000 rw-p 00108000 08:01 4723693                    /lib/x86_64-linux-gnu/libm-2.23.so
    7fa42bb95000-7fa42bd07000 r-xp 00000000 08:01 132700                     /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
    7fa42bd07000-7fa42bf07000 ---p 00172000 08:01 132700                     /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
    7fa42bf07000-7fa42bf11000 r--p 00172000 08:01 132700                     /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
    7fa42bf11000-7fa42bf13000 rw-p 0017c000 08:01 132700                     /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
    7fa42bf13000-7fa42bf17000 rw-p 00000000 00:00 0 
    7fa42bf17000-7fa42bf3d000 r-xp 00000000 08:01 4723676                    /lib/x86_64-linux-gnu/ld-2.23.so
    7fa42c117000-7fa42c11d000 rw-p 00000000 00:00 0 
    7fa42c13b000-7fa42c13c000 rw-p 00000000 00:00 0 
    7fa42c13c000-7fa42c13d000 r--p 00025000 08:01 4723676                    /lib/x86_64-linux-gnu/ld-2.23.so
    7fa42c13d000-7fa42c13e000 rw-p 00026000 08:01 4723676                    /lib/x86_64-linux-gnu/ld-2.23.so
    7fa42c13e000-7fa42c13f000 rw-p 00000000 00:00 0 
    7fffc973f000-7fffc9760000 rw-p 00000000 00:00 0                          [stack]
    7fffc97c5000-7fffc97c7000 r--p 00000000 00:00 0                          [vvar]
    7fffc97c7000-7fffc97c9000 r-xp 00000000 00:00 0                          [vdso]
    ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
    Aborted (core dumped)
    
  3. yakra commented on Mar 21, 2020

    @yakra
    OwnerAuthor
    ( echo -e "mnt\trwt\tnst\tresult"; \
    for mnt in {1..9}; do
      for rwt in {1..9}; do
        for nst in {1..9}; do
          rm -rf graphs logs nmp_merged stats
          mkdir -p graphs logs/users nmp_merged stats
    
          echo -en "$mnt\t$rwt\t$nst\t"
          ./siteupdate_numthr -l logs -n nmp_merged -c stats -g graphs \
          -u /home/yakra/tm/UserData/list_files -w /home/yakra/tm/HighwayData \
          -t $mnt --ReadWptThreads $rwt --NmpSearchThreads $nst \
          > sulogs/siteupdate-$mnt-$rwt-$nst.log
    
          lastline=$(tail -n 1 sulogs/siteupdate-$mnt-$rwt-$nst.log)
          if [[ $(echo $lastline | grep -c '^Total run time: \[[0-9]\+\.[0-9]\]$') != 1 ]]; then
            echo "crash"
          else
            echo "OK"
          fi
        done
      done
    done ) | tee crashtest.log
  4. yakra commented on Mar 21, 2020

    @yakra
    OwnerAuthor

    On lab1.5 (UbuntuMate 18.04) I'm seeing

    • malloc_consolidate(): invalid chunk size
    • corrupted size vs. prev_size
    • corrupted double-linked list
    • malloc(): memory corruption
    • a greater frequency of crashes.
  5. yakra commented on Mar 21, 2020

    @yakra
    OwnerAuthor

    Results are not deterministic.
    Value of NumThreads & # of hardware threads does not appear to affect things.
    Crashes so far only happen when NmpSearchThreads > ReadWptThreads, but not every time.
    Not all crashes produce error messages in shell.
    ToDo: tail siteupdate.log for crashes

  6. yakra commented on Mar 22, 2020

    @yakra
    OwnerAuthor

    Crashes so far only happen when NmpSearchThreads > ReadWptThreads, but not every time.

    This pattern has not held.

    Of 125 runs on BiggaTomato:

    • 34 crashes
      • 27 where NmpSearchThreads > ReadWptThreads
      • 3 where NmpSearchThreads = ReadWptThreads
      • 4 where NmpSearchThreads < ReadWptThreads

    Of 400 runs so far on lab1.5:

    • 169 crashes
      • 156 where NmpSearchThreads > ReadWptThreads
      • 6 where NmpSearchThreads = ReadWptThreads
      • 6 where NmpSearchThreads < ReadWptThreads
  7. yakra commented on Mar 22, 2020

    @yakra
    OwnerAuthor

    Duh.

    (I am not worthy of saying "When the light went on it nearly blinded me.")

    Before, thread **thr = new thread*[args.numthreads]; was just fine, with every array of threads being the same size.
    But now, it's declared as thread **thr = new thread*[args.ReadWptThreads]; -- and I then go on to access it as if it's any old size. Even a bigger size. Wacky antics ensue.

    I was looking right at this and didn't notice it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions