Drat. I tried a simple growforest
on the iris data set, and the Go runtime is crashing on concurrent map access.
repro: (might need to run a couple of times to get the Go stdlib to detect the concurrent access and panic)
jaten@jatens-MacBook-Pro ~/go/src/github.com/lytics/CloudForest/data (master) $ mkdir tmp
jaten@jatens-MacBook-Pro ~/go/src/github.com/lytics/CloudForest/data (master) $ cp iris.data.fm tmp/train.fm && cd ..
jaten@jatens-MacBook-Pro ~/go/src/github.com/lytics/CloudForest (master) $ go install github.com/lytics/CloudForest/growforest
jaten@jatens-MacBook-Pro ~/go/src/github.com/lytics/CloudForest (master) $ cd data/tmp
jaten@jatens-MacBook-Pro ~/go/src/github.com/lytics/CloudForest/data/tmp (master) $ ls
forest.sf train.fm
jaten@jatens-MacBook-Pro ~/go/src/github.com/lytics/CloudForest/data/tmp (master) $ ls -al
total 16
drwxrwxr-x 4 jaten staff 128 Nov 20 14:44 .
drwxrwxr-x 8 jaten staff 256 Nov 20 14:43 ..
-rw-rw-r-- 1 jaten staff 0 Nov 20 14:44 forest.sf
-rw-rw-r-- 1 jaten staff 4963 Nov 20 14:44 train.fm
jaten@jatens-MacBook-Pro ~/go/src/github.com/lytics/CloudForest/data/tmp (master) $ rm forest.sf
jaten@jatens-MacBook-Pro ~/go/src/github.com/lytics/CloudForest/data/tmp (master) $ growforest -train train.fm -rfpred forest.sf -target C:Class -oob -nCores 16 -nTrees 1000 -leafSize 8
Threads : 16
nTrees : 1000
Loading data from: train.fm
Target : C:Class
Non Target Features : 4
mTry : 2
non-missing cases: 150
leafSize : 8
nSamples : 150
Recording oob error.
Performing classification with 3 categories.
fatal error: concurrent map writes
goroutine 18 [running]:
runtime.throw(0x11b4b02, 0x15)
/usr/local/go/src/runtime/panic.go:616 +0x81 fp=0xc42004e7b0 sp=0xc42004e790 pc=0x1027a61
runtime.mapassign_faststr(0x117fdc0, 0xc4200823f0, 0xc4200e7007, 0xb, 0x12d2120)
/usr/local/go/src/runtime/hashmap_fast.go:703 +0x3e9 fp=0xc42004e820 sp=0xc42004e7b0 pc=0x100b209
github.com/lytics/CloudForest.(*CatMap).CatToNum(...)
/Users/jaten/go/src/github.com/lytics/CloudForest/catmap.go:23
github.com/lytics/CloudForest.(*CatBallotBox).Vote(0xc42008a100, 0x0, 0xc4200e7007, 0xb, 0x3ff0000000000000)
/Users/jaten/go/src/github.com/lytics/CloudForest/catballotbox.go:42 +0x277 fp=0xc42004e898 sp=0xc42004e820 pc=0x1117af7
github.com/lytics/CloudForest.(*Tree).VoteCases.func1(0xc420112140, 0xc420114500, 0x15, 0x96, 0x2)
/Users/jaten/go/src/github.com/lytics/CloudForest/tree.go:421 +0x8e fp=0xc42004e8f0 sp=0xc42004e898 pc=0x113070e
github.com/lytics/CloudForest.(*Node).Recurse(0xc420112140, 0xc42004eb50, 0xc420092f00, 0xc420114500, 0x15, 0x96, 0x2)
/Users/jaten/go/src/github.com/lytics/CloudForest/node.go:70 +0x7d fp=0xc42004e9a8 sp=0xc42004e8f0 pc=0x11286bd
github.com/lytics/CloudForest.(*Node).Recurse(0xc4201120a0, 0xc42004eb50, 0xc420092f00, 0xc420114500, 0x25, 0x96, 0x2)
/Users/jaten/go/src/github.com/lytics/CloudForest/node.go:83 +0x27c fp=0xc42004ea60 sp=0xc42004e9a8 pc=0x11288bc
github.com/lytics/CloudForest.(*Node).Recurse(0xc420112000, 0xc42004eb50, 0xc420092f00, 0xc420114500, 0x36, 0x96, 0x1)
/Users/jaten/go/src/github.com/lytics/CloudForest/node.go:83 +0x27c fp=0xc42004eb18 sp=0xc42004ea60 pc=0x11288bc
github.com/lytics/CloudForest.(*Tree).VoteCases(0xc42000a060, 0xc420092f00, 0x11d3d00, 0xc42008a100, 0xc420114500, 0x36, 0x96)
/Users/jaten/go/src/github.com/lytics/CloudForest/tree.go:417 +0xba fp=0xc42004eb80 sp=0xc42004eb18 pc=0x112ed6a
main.main.func1()
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:696 +0x16a7 fp=0xc42004efe0 sp=0xc42004eb80 pc=0x11588c7
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:2361 +0x1 fp=0xc42004efe8 sp=0xc42004efe0 pc=0x1050df1
created by main.main
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:747 +0x2669
goroutine 1 [semacquire]:
sync.runtime_Semacquire(0xc4200f448c)
/usr/local/go/src/runtime/sema.go:56 +0x39
sync.(*WaitGroup).Wait(0xc4200f4480)
/usr/local/go/src/sync/waitgroup.go:129 +0x72
main.main()
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:754 +0x3238
goroutine 19 [runnable]:
sync.runtime_SemacquireMutex(0xc42008a044, 0x112c500)
/usr/local/go/src/runtime/sema.go:71 +0x3d
sync.(*Mutex).Lock(0xc42008a040)
/usr/local/go/src/sync/mutex.go:134 +0x108
math/rand.(*lockedSource).Int63(0xc42008a040, 0x4ab7118ec39a66a6)
/usr/local/go/src/math/rand/rand.go:377 +0x2d
math/rand.(*Rand).Int63(0xc420082180, 0x4ab7118ec39a66a6)
/usr/local/go/src/math/rand/rand.go:82 +0x33
math/rand.(*Rand).Int31(0xc420082180, 0xc44ab7118e)
/usr/local/go/src/math/rand/rand.go:96 +0x2b
math/rand.(*Rand).Int31n(0xc420082180, 0xc400000096, 0xc400000074)
/usr/local/go/src/math/rand/rand.go:131 +0x4f
math/rand.(*Rand).Intn(0xc420082180, 0x96, 0x74)
/usr/local/go/src/math/rand/rand.go:169 +0x45
math/rand.Intn(0x96, 0x74)
/usr/local/go/src/math/rand/rand.go:326 +0x37
main.main.func1()
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:632 +0x1ac8
created by main.main
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:747 +0x2669
goroutine 20 [runnable]:
main.main.func1()
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:592
created by main.main
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:747 +0x2669
goroutine 21 [runnable]:
sync.runtime_SemacquireMutex(0xc42008a044, 0x112c501)
/usr/local/go/src/runtime/sema.go:71 +0x3d
sync.(*Mutex).Lock(0xc42008a040)
/usr/local/go/src/sync/mutex.go:134 +0x108
math/rand.(*lockedSource).Int63(0xc42008a040, 0x341e252378ba9d7b)
/usr/local/go/src/math/rand/rand.go:377 +0x2d
math/rand.(*Rand).Int63(0xc420082180, 0x341e252378ba9d7b)
/usr/local/go/src/math/rand/rand.go:82 +0x33
math/rand.(*Rand).Int31(0xc420082180, 0xc4341e2523)
/usr/local/go/src/math/rand/rand.go:96 +0x2b
math/rand.(*Rand).Int31n(0xc420082180, 0xc400000096, 0xc400000013)
/usr/local/go/src/math/rand/rand.go:131 +0x4f
math/rand.(*Rand).Intn(0xc420082180, 0x96, 0x13)
/usr/local/go/src/math/rand/rand.go:169 +0x45
math/rand.Intn(0x96, 0x13)
/usr/local/go/src/math/rand/rand.go:326 +0x37
main.main.func1()
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:632 +0x1ac8
created by main.main
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:747 +0x2669
goroutine 22 [runnable]:
syscall.Syscall(0x4, 0x3, 0xc42017a000, 0x4c, 0x4c, 0x0, 0x0)
/usr/local/go/src/syscall/asm_darwin_amd64.s:16 +0x5
syscall.write(0x3, 0xc42017a000, 0x4c, 0x80, 0xc42016a001, 0x0, 0x0)
/usr/local/go/src/syscall/zsyscall_darwin_amd64.go:1321 +0x5f
syscall.Write(0x3, 0xc42017a000, 0x4c, 0x80, 0x4b, 0x0, 0xc4201a78d0)
/usr/local/go/src/syscall/syscall_unix.go:181 +0x49
internal/poll.(*FD).Write(0xc42009e460, 0xc42017a000, 0x4c, 0x80, 0x0, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_unix.go:256 +0x142
os.(*File).write(0xc42009c058, 0xc42017a000, 0x4c, 0x80, 0xc4201d0020, 0x76, 0xc42016e000)
/usr/local/go/src/os/file_unix.go:243 +0x4e
os.(*File).Write(0xc42009c058, 0xc42017a000, 0x4c, 0x80, 0x103f137, 0xc4201a79d8, 0x100d18a)
/usr/local/go/src/os/file.go:144 +0x6f
fmt.Fprintln(0x11d3380, 0xc42009c058, 0xc4201a7a88, 0x1, 0x1, 0xc4201d8000, 0x4b, 0x18)
/usr/local/go/src/fmt/print.go:255 +0x8b
github.com/lytics/CloudForest.(*ForestWriter).WriteNode(0xc420081020, 0xc420156000, 0x11b18f4, 0x1)
/Users/jaten/go/src/github.com/lytics/CloudForest/forestwriter.go:95 +0x17d
github.com/lytics/CloudForest.(*ForestWriter).WriteNodeAndChildren(0xc420081020, 0xc420156000, 0x11b18f4, 0x1)
/Users/jaten/go/src/github.com/lytics/CloudForest/forestwriter.go:63 +0x4d
github.com/lytics/CloudForest.(*ForestWriter).WriteTree(0xc420081020, 0xc420158000, 0x0)
/Users/jaten/go/src/github.com/lytics/CloudForest/forestwriter.go:38 +0x8b
main.main.func1()
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:705 +0x15b6
created by main.main
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:747 +0x2669
goroutine 23 [runnable]:
github.com/lytics/CloudForest.(*CatBallotBox).Vote(0xc42008a100, 0x2, 0xc4200e7007, 0xb, 0x3ff0000000000000)
/Users/jaten/go/src/github.com/lytics/CloudForest/catballotbox.go:47 +0x13e
github.com/lytics/CloudForest.(*Tree).VoteCases.func1(0xc42009e690, 0xc420146500, 0x15, 0x96, 0x2)
/Users/jaten/go/src/github.com/lytics/CloudForest/tree.go:421 +0x8e
github.com/lytics/CloudForest.(*Node).Recurse(0xc42009e690, 0xc42011fb50, 0xc420092f00, 0xc420146500, 0x15, 0x96, 0x2)
/Users/jaten/go/src/github.com/lytics/CloudForest/node.go:70 +0x7d
github.com/lytics/CloudForest.(*Node).Recurse(0xc42009e5f0, 0xc42011fb50, 0xc420092f00, 0xc420146500, 0x17, 0x96, 0x2)
/Users/jaten/go/src/github.com/lytics/CloudForest/node.go:83 +0x27c
github.com/lytics/CloudForest.(*Node).Recurse(0xc42009e550, 0xc42011fb50, 0xc420092f00, 0xc420146500, 0x36, 0x96, 0x1)
/Users/jaten/go/src/github.com/lytics/CloudForest/node.go:83 +0x27c
github.com/lytics/CloudForest.(*Tree).VoteCases(0xc42008a2a0, 0xc420092f00, 0x11d3d00, 0xc42008a100, 0xc420146500, 0x36, 0x96)
/Users/jaten/go/src/github.com/lytics/CloudForest/tree.go:417 +0xba
main.main.func1()
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:696 +0x16a7
created by main.main
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:747 +0x2669
goroutine 24 [runnable]:
main.main.func1()
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:592
created by main.main
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:747 +0x2669
goroutine 25 [runnable]:
main.main.func1()
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:592
created by main.main
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:747 +0x2669
goroutine 26 [runnable]:
main.main.func1()
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:592
created by main.main
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:747 +0x2669
goroutine 27 [runnable]:
main.main.func1()
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:592
created by main.main
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:747 +0x2669
goroutine 28 [runnable]:
main.main.func1()
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:592
created by main.main
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:747 +0x2669
goroutine 29 [runnable]:
main.main.func1()
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:592
created by main.main
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:747 +0x2669
goroutine 30 [runnable]:
main.main.func1()
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:592
created by main.main
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:747 +0x2669
goroutine 31 [runnable]:
main.main.func1()
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:592
created by main.main
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:747 +0x2669
goroutine 32 [runnable]:
main.main.func1()
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:592
created by main.main
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:747 +0x2669
goroutine 33 [runnable]:
sync.(*Mutex).Lock(0xc420080a90)
/usr/local/go/src/sync/mutex.go:72 +0x2e9
github.com/lytics/CloudForest.(*CatBallotBox).Vote(0xc42008a100, 0x3e, 0xc4200e722d, 0xf, 0x3ff0000000000000)
/Users/jaten/go/src/github.com/lytics/CloudForest/catballotbox.go:43 +0xa7
github.com/lytics/CloudForest.(*Tree).VoteCases.func1(0xc420122280, 0xc42013a578, 0xb, 0x87, 0x3)
/Users/jaten/go/src/github.com/lytics/CloudForest/tree.go:421 +0x8e
github.com/lytics/CloudForest.(*Node).Recurse(0xc420122280, 0xc42011eb50, 0xc420092f00, 0xc42013a578, 0xb, 0x87, 0x3)
/Users/jaten/go/src/github.com/lytics/CloudForest/node.go:70 +0x7d
github.com/lytics/CloudForest.(*Node).Recurse(0xc4201221e0, 0xc42011eb50, 0xc420092f00, 0xc42013a578, 0x11, 0x87, 0x3)
/Users/jaten/go/src/github.com/lytics/CloudForest/node.go:83 +0x27c
github.com/lytics/CloudForest.(*Node).Recurse(0xc420122190, 0xc42011eb50, 0xc420092f00, 0xc42013a578, 0x26, 0x87, 0x2)
/Users/jaten/go/src/github.com/lytics/CloudForest/node.go:83 +0x27c
github.com/lytics/CloudForest.(*Node).Recurse(0xc42009e4b0, 0xc42011eb50, 0xc420092f00, 0xc42013a500, 0x35, 0x96, 0x1)
/Users/jaten/go/src/github.com/lytics/CloudForest/node.go:86 +0x203
github.com/lytics/CloudForest.(*Tree).VoteCases(0xc42008a180, 0xc420092f00, 0x11d3d00, 0xc42008a100, 0xc42013a500, 0x35, 0x96)
/Users/jaten/go/src/github.com/lytics/CloudForest/tree.go:417 +0xba
main.main.func1()
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:696 +0x16a7
created by main.main
/Users/jaten/go/src/github.com/lytics/CloudForest/growforest/growforest.go:747 +0x2669
jaten@jatens-MacBook-Pro ~/go/src/github.com/lytics/CloudForest/data/tmp (master) $ go version
go version go1.10.2 darwin/amd64
jaten@jatens-MacBook-Pro ~/go/src/github.com/lytics/CloudForest/data/tmp (master) $
jaten@jatens-MacBook-Pro ~/go/src/github.com/lytics/CloudForest/data/tmp (master) $ git log
commit 24f133408db30c1c6663d332d684012aed50c299 (HEAD -> master, origin/master, origin/HEAD)
Merge: cd7d62f fb121eb
Author: Nicolas Lanker <[email protected]>
Date: Tue Jun 12 12:58:31 2018 -0700
Merge pull request #17 from lytics/transpose_output_change
changes bug in featurematrix output from transpose to not transpose