MichaelTJones / Crossover

Example of determining the performance crossover point for serial/parallel evaluation
3 stars 0 forks source link

Something wrong when i run the test... #1

Open yarcowang opened 8 years ago

yarcowang commented 8 years ago

Thanks for the code... but i got error when running the code.

yarco@me Crossover$ go test -v -benchtime=10s
=== RUN   TestSerial10
--- PASS: TestSerial10 (0.00s)
=== RUN   TestSerial100
--- PASS: TestSerial100 (0.00s)
=== RUN   TestSerial1000
--- PASS: TestSerial1000 (0.00s)
=== RUN   TestSerial10000
--- PASS: TestSerial10000 (0.00s)
=== RUN   TestSerial100000
--- PASS: TestSerial100000 (0.00s)
=== RUN   TestSerial1000000
--- PASS: TestSerial1000000 (0.00s)
=== RUN   TestParallel10
--- PASS: TestParallel10 (0.00s)
=== RUN   TestParallel100
--- PASS: TestParallel100 (0.00s)
=== RUN   TestParallel1000
--- PASS: TestParallel1000 (0.00s)
=== RUN   TestParallel10000
--- PASS: TestParallel10000 (0.00s)
=== RUN   TestParallel100000
--- PASS: TestParallel100000 (0.00s)
=== RUN   TestParallel1000000
--- PASS: TestParallel1000000 (0.00s)
=== RUN   TestSum10
--- PASS: TestSum10 (0.00s)
=== RUN   TestSum100
--- PASS: TestSum100 (0.00s)
=== RUN   TestSum1000
--- PASS: TestSum1000 (0.00s)
=== RUN   TestSum10000
--- PASS: TestSum10000 (0.00s)
=== RUN   TestSum100000
--- PASS: TestSum100000 (0.00s)
=== RUN   TestSum1000000
--- PASS: TestSum1000000 (0.00s)
=== RUN   TestCrossover
SIGQUIT: quit
PC=0x7e3a8 m=0

goroutine 86301082 [running]:
_/Users/yarco/Documents/projects/golang/test/Crossover.SumIntsSerial(0x820310000, 0xb301, 0x989680, 0x1c33a8)
    /Users/yarco/Documents/projects/golang/test/Crossover/sum.go:14 +0x18 fp=0x82545bf70 sp=0x82545bf68
_/Users/yarco/Documents/projects/golang/test/Crossover.SumIntsParallel.func1.1(0x8260ab3b0, 0x820310000, 0xb301, 0x989680)
    /Users/yarco/Documents/projects/golang/test/Crossover/sum.go:34 +0x35 fp=0x82545bfa0 sp=0x82545bf70
runtime.goexit()
    /usr/local/Cellar/go/1.6.2/libexec/src/runtime/asm_amd64.s:1998 +0x1 fp=0x82545bfa8 sp=0x82545bfa0
created by _/Users/yarco/Documents/projects/golang/test/Crossover.SumIntsParallel.func1
    /Users/yarco/Documents/projects/golang/test/Crossover/sum.go:35 +0xb3

goroutine 1 [chan receive, 9 minutes]:
testing.RunTests(0x1c31a0, 0x24f480, 0x13, 0x13, 0x251901)
    /usr/local/Cellar/go/1.6.2/libexec/src/testing/testing.go:583 +0x8d2
testing.(*M).Run(0x8202dff08, 0x8202d7e78)
    /usr/local/Cellar/go/1.6.2/libexec/src/testing/testing.go:515 +0x81
main.main()
    _/Users/yarco/Documents/projects/golang/test/Crossover/_test/_testmain.go:144 +0x117

goroutine 49 [chan receive]:
testing.(*B).run(0x824f74100, 0x0, 0x0, 0x0, 0x0, 0x0)
    /usr/local/Cellar/go/1.6.2/libexec/src/testing/benchmark.go:191 +0x7b
testing.Benchmark(0x82975c030, 0x0, 0x0, 0x0, 0x0, 0x0)
    /usr/local/Cellar/go/1.6.2/libexec/src/testing/benchmark.go:476 +0xc8
_/Users/yarco/Documents/projects/golang/test/Crossover.TestCrossover(0x824f70a20)
    /Users/yarco/Documents/projects/golang/test/Crossover/sum_test.go:193 +0x3a7
testing.tRunner(0x824f70a20, 0x24f630)
    /usr/local/Cellar/go/1.6.2/libexec/src/testing/testing.go:473 +0x98
created by testing.RunTests
    /usr/local/Cellar/go/1.6.2/libexec/src/testing/testing.go:582 +0x892

goroutine 85744532 [chan receive]:
_/Users/yarco/Documents/projects/golang/test/Crossover.SumIntsParallel(0x820310000, 0x16601, 0x989680, 0xfa541901)
    /Users/yarco/Documents/projects/golang/test/Crossover/sum.go:41 +0xfd
_/Users/yarco/Documents/projects/golang/test/Crossover.benchmarkParallel(0x824f74100, 0x16601)
    /Users/yarco/Documents/projects/golang/test/Crossover/sum_test.go:131 +0x8e
_/Users/yarco/Documents/projects/golang/test/Crossover.TestCrossover.func2.1(0x824f74100)
    /Users/yarco/Documents/projects/golang/test/Crossover/sum_test.go:178 +0x2a
testing.(*B).runN(0x824f74100, 0x30d40)
    /usr/local/Cellar/go/1.6.2/libexec/src/testing/benchmark.go:135 +0x9a
testing.(*B).launch(0x824f74100)
    /usr/local/Cellar/go/1.6.2/libexec/src/testing/benchmark.go:227 +0x131
created by testing.(*B).run
    /usr/local/Cellar/go/1.6.2/libexec/src/testing/benchmark.go:190 +0x54

rax    0x82033c8f8
rbx    0x989680
rcx    0x591f
rdx    0xf837570
rdi    0xb301
rsi    0x2515c0
rbp    0x591f
rsp    0x82545bf68
r8     0x251900
r9     0x820369808
r10    0x8202b9ac0
r11    0x202
r12    0x66389a016175
r13    0x6647fa67d560
r14    0x144cbad059230600
r15    0x251260
rip    0x7e3a8
rflags 0x287
cs     0x2b
fs     0x0
gs     0x0
*** Test killed with quit: ran too long (10m0s).
FAIL    _/Users/yarco/Documents/projects/golang/test/Crossover  600.089s
MichaelTJones commented 8 years ago

The test timed out.

Run with -benchtime=1 for shorter tests of with -timeout=9h to let the overall benchmark run longer.

Also, do you have multiple CPUs On May 9, 2016 8:24 AM, "Yarco" notifications@github.com wrote:

Thanks for the code... but i got error when running the code.

yarco@me Crossover$ go test -v -benchtime=10s === RUN TestSerial10 --- PASS: TestSerial10 (0.00s) === RUN TestSerial100 --- PASS: TestSerial100 (0.00s) === RUN TestSerial1000 --- PASS: TestSerial1000 (0.00s) === RUN TestSerial10000 --- PASS: TestSerial10000 (0.00s) === RUN TestSerial100000 --- PASS: TestSerial100000 (0.00s) === RUN TestSerial1000000 --- PASS: TestSerial1000000 (0.00s) === RUN TestParallel10 --- PASS: TestParallel10 (0.00s) === RUN TestParallel100 --- PASS: TestParallel100 (0.00s) === RUN TestParallel1000 --- PASS: TestParallel1000 (0.00s) === RUN TestParallel10000 --- PASS: TestParallel10000 (0.00s) === RUN TestParallel100000 --- PASS: TestParallel100000 (0.00s) === RUN TestParallel1000000 --- PASS: TestParallel1000000 (0.00s) === RUN TestSum10 --- PASS: TestSum10 (0.00s) === RUN TestSum100 --- PASS: TestSum100 (0.00s) === RUN TestSum1000 --- PASS: TestSum1000 (0.00s) === RUN TestSum10000 --- PASS: TestSum10000 (0.00s) === RUN TestSum100000 --- PASS: TestSum100000 (0.00s) === RUN TestSum1000000 --- PASS: TestSum1000000 (0.00s) === RUN TestCrossover SIGQUIT: quit PC=0x7e3a8 m=0

goroutine 86301082 [running]: /Users/yarco/Documents/projects/golang/test/Crossover.SumIntsSerial(0x820310000, 0xb301, 0x989680, 0x1c33a8) /Users/yarco/Documents/projects/golang/test/Crossover/sum.go:14 +0x18 fp=0x82545bf70 sp=0x82545bf68 /Users/yarco/Documents/projects/golang/test/Crossover.SumIntsParallel.func1.1(0x8260ab3b0, 0x820310000, 0xb301, 0x989680) /Users/yarco/Documents/projects/golang/test/Crossover/sum.go:34 +0x35 fp=0x82545bfa0 sp=0x82545bf70 runtime.goexit() /usr/local/Cellar/go/1.6.2/libexec/src/runtime/asmamd64.s:1998 +0x1 fp=0x82545bfa8 sp=0x82545bfa0 created by /Users/yarco/Documents/projects/golang/test/Crossover.SumIntsParallel.func1 /Users/yarco/Documents/projects/golang/test/Crossover/sum.go:35 +0xb3

goroutine 1 [chan receive, 9 minutes]: testing.RunTests(0x1c31a0, 0x24f480, 0x13, 0x13, 0x251901) /usr/local/Cellar/go/1.6.2/libexec/src/testing/testing.go:583 +0x8d2 testing.(*M).Run(0x8202dff08, 0x8202d7e78) /usr/local/Cellar/go/1.6.2/libexec/src/testing/testing.go:515 +0x81 main.main() _/Users/yarco/Documents/projects/golang/test/Crossover/_test/_testmain.go:144 +0x117

goroutine 49 [chan receive]: testing.(*B).run(0x824f74100, 0x0, 0x0, 0x0, 0x0, 0x0) /usr/local/Cellar/go/1.6.2/libexec/src/testing/benchmark.go:191 +0x7b testing.Benchmark(0x82975c030, 0x0, 0x0, 0x0, 0x0, 0x0) /usr/local/Cellar/go/1.6.2/libexec/src/testing/benchmark.go:476 +0xc8 _/Users/yarco/Documents/projects/golang/test/Crossover.TestCrossover(0x824f70a20) /Users/yarco/Documents/projects/golang/test/Crossover/sum_test.go:193 +0x3a7 testing.tRunner(0x824f70a20, 0x24f630) /usr/local/Cellar/go/1.6.2/libexec/src/testing/testing.go:473 +0x98 created by testing.RunTests /usr/local/Cellar/go/1.6.2/libexec/src/testing/testing.go:582 +0x892

goroutine 85744532 [chan receive]: /Users/yarco/Documents/projects/golang/test/Crossover.SumIntsParallel(0x820310000, 0x16601, 0x989680, 0xfa541901) /Users/yarco/Documents/projects/golang/test/Crossover/sum.go:41 +0xfd /Users/yarco/Documents/projects/golang/test/Crossover.benchmarkParallel(0x824f74100, 0x16601) /Users/yarco/Documents/projects/golang/test/Crossover/sumtest.go:131 +0x8e /Users/yarco/Documents/projects/golang/test/Crossover.TestCrossover.func2.1(0x824f74100) /Users/yarco/Documents/projects/golang/test/Crossover/sum_test.go:178 +0x2a testing.(_B).runN(0x824f74100, 0x30d40) /usr/local/Cellar/go/1.6.2/libexec/src/testing/benchmark.go:135 +0x9a testing.(_B).launch(0x824f74100) /usr/local/Cellar/go/1.6.2/libexec/src/testing/benchmark.go:227 +0x131 created by testing.(*B).run /usr/local/Cellar/go/1.6.2/libexec/src/testing/benchmark.go:190 +0x54

rax 0x82033c8f8 rbx 0x989680 rcx 0x591f rdx 0xf837570 rdi 0xb301 rsi 0x2515c0 rbp 0x591f rsp 0x82545bf68 r8 0x251900 r9 0x820369808 r10 0x8202b9ac0 r11 0x202 r12 0x66389a016175 r13 0x6647fa67d560 r14 0x144cbad059230600 r15 0x251260 rip 0x7e3a8 rflags 0x287 cs 0x2b fs 0x0 gs 0x0 *\ Test killed with quit: ran too long (10m0s). FAIL _/Users/yarco/Documents/projects/golang/test/Crossover 600.089s

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/MichaelTJones/Crossover/issues/1

MichaelTJones commented 8 years ago

I will change the test to do nothing on single-cpu systems. On May 9, 2016 10:42 AM, "Michael Jones" michael.jones@gmail.com wrote:

The test timed out.

Run with -benchtime=1 for shorter tests of with -timeout=9h to let the overall benchmark run longer.

Also, do you have multiple CPUs On May 9, 2016 8:24 AM, "Yarco" notifications@github.com wrote:

Thanks for the code... but i got error when running the code.

yarco@me Crossover$ go test -v -benchtime=10s === RUN TestSerial10 --- PASS: TestSerial10 (0.00s) === RUN TestSerial100 --- PASS: TestSerial100 (0.00s) === RUN TestSerial1000 --- PASS: TestSerial1000 (0.00s) === RUN TestSerial10000 --- PASS: TestSerial10000 (0.00s) === RUN TestSerial100000 --- PASS: TestSerial100000 (0.00s) === RUN TestSerial1000000 --- PASS: TestSerial1000000 (0.00s) === RUN TestParallel10 --- PASS: TestParallel10 (0.00s) === RUN TestParallel100 --- PASS: TestParallel100 (0.00s) === RUN TestParallel1000 --- PASS: TestParallel1000 (0.00s) === RUN TestParallel10000 --- PASS: TestParallel10000 (0.00s) === RUN TestParallel100000 --- PASS: TestParallel100000 (0.00s) === RUN TestParallel1000000 --- PASS: TestParallel1000000 (0.00s) === RUN TestSum10 --- PASS: TestSum10 (0.00s) === RUN TestSum100 --- PASS: TestSum100 (0.00s) === RUN TestSum1000 --- PASS: TestSum1000 (0.00s) === RUN TestSum10000 --- PASS: TestSum10000 (0.00s) === RUN TestSum100000 --- PASS: TestSum100000 (0.00s) === RUN TestSum1000000 --- PASS: TestSum1000000 (0.00s) === RUN TestCrossover SIGQUIT: quit PC=0x7e3a8 m=0

goroutine 86301082 [running]: /Users/yarco/Documents/projects/golang/test/Crossover.SumIntsSerial(0x820310000, 0xb301, 0x989680, 0x1c33a8) /Users/yarco/Documents/projects/golang/test/Crossover/sum.go:14 +0x18 fp=0x82545bf70 sp=0x82545bf68 /Users/yarco/Documents/projects/golang/test/Crossover.SumIntsParallel.func1.1(0x8260ab3b0, 0x820310000, 0xb301, 0x989680) /Users/yarco/Documents/projects/golang/test/Crossover/sum.go:34 +0x35 fp=0x82545bfa0 sp=0x82545bf70 runtime.goexit() /usr/local/Cellar/go/1.6.2/libexec/src/runtime/asmamd64.s:1998 +0x1 fp=0x82545bfa8 sp=0x82545bfa0 created by /Users/yarco/Documents/projects/golang/test/Crossover.SumIntsParallel.func1 /Users/yarco/Documents/projects/golang/test/Crossover/sum.go:35 +0xb3

goroutine 1 [chan receive, 9 minutes]: testing.RunTests(0x1c31a0, 0x24f480, 0x13, 0x13, 0x251901) /usr/local/Cellar/go/1.6.2/libexec/src/testing/testing.go:583 +0x8d2 testing.(*M).Run(0x8202dff08, 0x8202d7e78) /usr/local/Cellar/go/1.6.2/libexec/src/testing/testing.go:515 +0x81 main.main() _/Users/yarco/Documents/projects/golang/test/Crossover/_test/_testmain.go:144 +0x117

goroutine 49 [chan receive]: testing.(*B).run(0x824f74100, 0x0, 0x0, 0x0, 0x0, 0x0) /usr/local/Cellar/go/1.6.2/libexec/src/testing/benchmark.go:191 +0x7b testing.Benchmark(0x82975c030, 0x0, 0x0, 0x0, 0x0, 0x0) /usr/local/Cellar/go/1.6.2/libexec/src/testing/benchmark.go:476 +0xc8 _/Users/yarco/Documents/projects/golang/test/Crossover.TestCrossover(0x824f70a20) /Users/yarco/Documents/projects/golang/test/Crossover/sum_test.go:193 +0x3a7 testing.tRunner(0x824f70a20, 0x24f630) /usr/local/Cellar/go/1.6.2/libexec/src/testing/testing.go:473 +0x98 created by testing.RunTests /usr/local/Cellar/go/1.6.2/libexec/src/testing/testing.go:582 +0x892

goroutine 85744532 [chan receive]: /Users/yarco/Documents/projects/golang/test/Crossover.SumIntsParallel(0x820310000, 0x16601, 0x989680, 0xfa541901) /Users/yarco/Documents/projects/golang/test/Crossover/sum.go:41 +0xfd /Users/yarco/Documents/projects/golang/test/Crossover.benchmarkParallel(0x824f74100, 0x16601) /Users/yarco/Documents/projects/golang/test/Crossover/sumtest.go:131 +0x8e /Users/yarco/Documents/projects/golang/test/Crossover.TestCrossover.func2.1(0x824f74100) /Users/yarco/Documents/projects/golang/test/Crossover/sum_test.go:178 +0x2a testing.(_B).runN(0x824f74100, 0x30d40) /usr/local/Cellar/go/1.6.2/libexec/src/testing/benchmark.go:135 +0x9a testing.(_B).launch(0x824f74100) /usr/local/Cellar/go/1.6.2/libexec/src/testing/benchmark.go:227 +0x131 created by testing.(*B).run /usr/local/Cellar/go/1.6.2/libexec/src/testing/benchmark.go:190 +0x54

rax 0x82033c8f8 rbx 0x989680 rcx 0x591f rdx 0xf837570 rdi 0xb301 rsi 0x2515c0 rbp 0x591f rsp 0x82545bf68 r8 0x251900 r9 0x820369808 r10 0x8202b9ac0 r11 0x202 r12 0x66389a016175 r13 0x6647fa67d560 r14 0x144cbad059230600 r15 0x251260 rip 0x7e3a8 rflags 0x287 cs 0x2b fs 0x0 gs 0x0 *\ Test killed with quit: ran too long (10m0s). FAIL _/Users/yarco/Documents/projects/golang/test/Crossover 600.089s

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/MichaelTJones/Crossover/issues/1

yarcowang commented 8 years ago

2.4 GHz Intel Core 2 Duo I think it is mutli-core, not multi-cpus. But i'm not quite sure whether such differences(multi-cores vs multi-cpus) will affect golang code or not. Anyway, thank you, you are a good guy. I got the result when run with -benchtime=1s

$ go test -v -benchtime=1s
.....
=== RUN   TestCrossover
--- PASS: TestCrossover (63.78s)
    sum_test.go:188: serial/parallel crossover between slice length 10000 and 100000
    sum_test.go:200: slice length 43881 estimated as serial/parallel crossover for this computer
PASS
ok      _/Users/yarco/Documents/projects/golang/test/Crossover  63.956s

// that is with -benchtime=2s
--- PASS: TestCrossover (123.85s)
    sum_test.go:188: serial/parallel crossover between slice length 10000 and 100000
    sum_test.go:200: slice length 41332 estimated as serial/parallel crossover for this computer
PASS
ok      _/Users/yarco/Documents/projects/golang/test/Crossover  124.025s

It seems it changes a bit when have different benchtime...maybe there should be a ratio to point out the trust number...

But i still miss the feature that can Sizeof a procedure/function in runtime ;)

trust_number, size, ok = unsafe.Sizeof(func() {
  sum := []int{1,2,3,4,5,6}
})

It is cool.

MichaelTJones commented 8 years ago

The benchmarks time vary from run to run, so the greater X is in "-benchtime=Xs" the more consistent the results will be.

For the purpose here, though, it seems unimportant because in the lengths where the results are close, then either choice is a good one.

I changed the code at github to be more defensive about single-processor or "GOMAXPROCS=1" systems.

Good luck! Michael

On Mon, May 9, 2016 at 11:24 AM, Yarco notifications@github.com wrote:

2.4 GHz Intel Core 2 Duo I think it is mutli-core, not multi-cpus. But i'm not quite sure whether such differences(multi-cores vs multi-cpus) will affect golang code or not. Anyway, thank you, you are a good guy. I got the result when run with -benchtime=1s

$ go test -v -benchtime=1s ..... === RUN TestCrossover --- PASS: TestCrossover (63.78s) sum_test.go:188: serial/parallel crossover between slice length 10000 and 100000 sumtest.go:200: slice length 43881 estimated as serial/parallel crossover for this computer PASS ok /Users/yarco/Documents/projects/golang/test/Crossover 63.956s

// that is with -benchtime=2s --- PASS: TestCrossover (123.85s) sum_test.go:188: serial/parallel crossover between slice length 10000 and 100000 sumtest.go:200: slice length 41332 estimated as serial/parallel crossover for this computer PASS ok /Users/yarco/Documents/projects/golang/test/Crossover 124.025s

It seems it changes a bit when have different benchtime...maybe there should be a ratio to point out the trust number...

But i still miss the feature that can Sizeof a procedure/function in runtime ;)

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/MichaelTJones/Crossover/issues/1#issuecomment-217763703

Michael T. Jones michael.jones@gmail.com http://www.google.com/profiles/michael.jones

yarcowang commented 8 years ago

:) Get it.