Skip to content

Commit

Permalink
update to latest core app bar changes, and vgpu benchmarks prior to gosl
Browse files Browse the repository at this point in the history
  • Loading branch information
rcoreilly committed Sep 2, 2024
1 parent 603fed7 commit 20c7d23
Show file tree
Hide file tree
Showing 36 changed files with 1,184 additions and 1,083 deletions.
2 changes: 1 addition & 1 deletion axon/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ func LayerActsLogAvg(net *Network, lg *elog.Logs, gui *egui.GUI, recReset bool)
}
ix := table.NewIndexView(dtRec)
spl := split.GroupBy(ix, "Layer")
split.AggAllNumericCols(spl, stats.Mean)
split.AggAllNumericColumns(spl, stats.Mean)

Check failure on line 685 in axon/logging.go

View workflow job for this annotation

GitHub Actions / build

undefined: split.AggAllNumericColumns
ags := spl.AggsToTable(table.ColumnNameOnly)
cols := []string{"Nominal", "ActM", "ActP", "MaxGeM", "MaxGeP"}
for li, ly := range net.Layers {
Expand Down
3 changes: 2 additions & 1 deletion axon/threads.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"runtime"
"sort"
"sync"
"time"

"cogentcore.org/core/base/timer"
)
Expand Down Expand Up @@ -132,7 +133,7 @@ func (nt *Network) TimerReport() {
pcts := make([]float64, nfn)
tot := 0.0
for i, fn := range fnms {
pcts[i] = float64(nt.FunTimes[fn].Total)
pcts[i] = float64(nt.FunTimes[fn].Total) / float64(time.Second)
tot += pcts[i]
}
for i, fn := range fnms {
Expand Down
14 changes: 8 additions & 6 deletions chans/ak_plot/ak_plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,14 @@ func (ss *Sim) ConfigGUI() *core.Body {

split.SetSplits(.3, .7)

b.AddAppBar(func(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.VmRun).SetIcon(icons.PlayArrow)
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.TimeRun).SetIcon(icons.PlayArrow)
b.AddTopBar(func(bar *core.Frame) {

Check failure on line 307 in chans/ak_plot/ak_plot.go

View workflow job for this annotation

GitHub Actions / build

cannot use func(bar *core.Frame) {…} (value of type func(bar *core.Frame)) as func(parent core.Widget) value in argument to b.AddTopBar
core.NewToolbar(bar).Maker(func(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.VmRun).SetIcon(icons.PlayArrow)
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.TimeRun).SetIcon(icons.PlayArrow)
})
})
})

Expand Down
20 changes: 11 additions & 9 deletions chans/gabab_plot/gabab_plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,15 +322,17 @@ func (ss *Sim) ConfigGUI() *core.Body {

split.SetSplits(.3, .7)

b.AddAppBar(func(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.VGRun).SetIcon(icons.PlayArrow)
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.SGRun).SetIcon(icons.PlayArrow)
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.TimeRun).SetIcon(icons.PlayArrow)
b.AddTopBar(func(bar *core.Frame) {

Check failure on line 325 in chans/gabab_plot/gabab_plot.go

View workflow job for this annotation

GitHub Actions / build

cannot use func(bar *core.Frame) {…} (value of type func(bar *core.Frame)) as func(parent core.Widget) value in argument to b.AddTopBar
core.NewToolbar(bar).Maker(func(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.VGRun).SetIcon(icons.PlayArrow)
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.SGRun).SetIcon(icons.PlayArrow)
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.TimeRun).SetIcon(icons.PlayArrow)
})
})
})

Expand Down
14 changes: 8 additions & 6 deletions chans/kir_plot/kir_plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,14 @@ func (ss *Sim) ConfigGUI() *core.Body {

split.SetSplits(.3, .7)

b.AddAppBar(func(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.VmRun).SetIcon(icons.PlayArrow)
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.TimeRun).SetIcon(icons.PlayArrow)
b.AddTopBar(func(bar *core.Frame) {

Check failure on line 250 in chans/kir_plot/kir_plot.go

View workflow job for this annotation

GitHub Actions / build

cannot use func(bar *core.Frame) {…} (value of type func(bar *core.Frame)) as func(parent core.Widget) value in argument to b.AddTopBar
core.NewToolbar(bar).Maker(func(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.VmRun).SetIcon(icons.PlayArrow)
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.TimeRun).SetIcon(icons.PlayArrow)
})
})
})

Expand Down
14 changes: 8 additions & 6 deletions chans/mahp_plot/mahp_plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,14 @@ func (ss *Sim) ConfigGUI() *core.Body {

split.SetSplits(.3, .7)

b.AddAppBar(func(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.VmRun).SetIcon(icons.PlayArrow)
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.TimeRun).SetIcon(icons.PlayArrow)
b.AddTopBar(func(bar *core.Frame) {

Check failure on line 248 in chans/mahp_plot/mahp_plot.go

View workflow job for this annotation

GitHub Actions / build

cannot use func(bar *core.Frame) {…} (value of type func(bar *core.Frame)) as func(parent core.Widget) value in argument to b.AddTopBar
core.NewToolbar(bar).Maker(func(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.VmRun).SetIcon(icons.PlayArrow)
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.TimeRun).SetIcon(icons.PlayArrow)
})
})
})

Expand Down
14 changes: 8 additions & 6 deletions chans/nmda_plot/nmda_plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,14 @@ func (ss *Sim) ConfigGUI() *core.Body {

split.SetSplits(.3, .7)

b.AddAppBar(func(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.Run).SetIcon(icons.PlayArrow)
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.TimeRun).SetIcon(icons.PlayArrow)
b.AddTopBar(func(bar *core.Frame) {

Check failure on line 256 in chans/nmda_plot/nmda_plot.go

View workflow job for this annotation

GitHub Actions / build

cannot use func(bar *core.Frame) {…} (value of type func(bar *core.Frame)) as func(parent core.Widget) value in argument to b.AddTopBar
core.NewToolbar(bar).Maker(func(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.Run).SetIcon(icons.PlayArrow)
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.TimeRun).SetIcon(icons.PlayArrow)
})
})
})

Expand Down
14 changes: 8 additions & 6 deletions chans/sahp_plot/sahp_plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,14 @@ func (ss *Sim) ConfigGUI() *core.Body {

split.SetSplits(.3, .7)

b.AddAppBar(func(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.CaRun).SetIcon(icons.PlayArrow)
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.TimeRun).SetIcon(icons.PlayArrow)
b.AddTopBar(func(bar *core.Frame) {

Check failure on line 224 in chans/sahp_plot/sahp_plot.go

View workflow job for this annotation

GitHub Actions / build

cannot use func(bar *core.Frame) {…} (value of type func(bar *core.Frame)) as func(parent core.Widget) value in argument to b.AddTopBar
core.NewToolbar(bar).Maker(func(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.CaRun).SetIcon(icons.PlayArrow)
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.TimeRun).SetIcon(icons.PlayArrow)
})
})
})

Expand Down
14 changes: 8 additions & 6 deletions chans/skca_plot/skca_plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,14 @@ func (ss *Sim) ConfigGUI() *core.Body {

split.SetSplits(.3, .7)

b.AddAppBar(func(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.CamRun).SetIcon(icons.PlayArrow)
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.TimeRun).SetIcon(icons.PlayArrow)
b.AddTopBar(func(bar *core.Frame) {

Check failure on line 234 in chans/skca_plot/skca_plot.go

View workflow job for this annotation

GitHub Actions / build

cannot use func(bar *core.Frame) {…} (value of type func(bar *core.Frame)) as func(parent core.Widget) value in argument to b.AddTopBar
core.NewToolbar(bar).Maker(func(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.CamRun).SetIcon(icons.PlayArrow)
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.TimeRun).SetIcon(icons.PlayArrow)
})
})
})

Expand Down
14 changes: 8 additions & 6 deletions chans/vgcc_plot/vgcc_plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,14 @@ func (ss *Sim) ConfigGUI() *core.Body {

split.SetSplits(.3, .7)

b.AddAppBar(func(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.VmRun).SetIcon(icons.PlayArrow)
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.TimeRun).SetIcon(icons.PlayArrow)
b.AddTopBar(func(bar *core.Frame) {

Check failure on line 252 in chans/vgcc_plot/vgcc_plot.go

View workflow job for this annotation

GitHub Actions / build

cannot use func(bar *core.Frame) {…} (value of type func(bar *core.Frame)) as func(parent core.Widget) value in argument to b.AddTopBar
core.NewToolbar(bar).Maker(func(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.VmRun).SetIcon(icons.PlayArrow)
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.TimeRun).SetIcon(icons.PlayArrow)
})
})
})

Expand Down
7 changes: 4 additions & 3 deletions examples/bench_lvis/bench_lvis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"runtime"
"testing"

"cogentcore.org/core/base/errors"
"cogentcore.org/core/tensor"
"cogentcore.org/core/tensor/table"
"github.com/emer/axon/v2/axon"
Expand All @@ -17,7 +18,7 @@ import (

var gpu = flag.Bool("gpu", false, "whether to run gpu or not")
var maxProcs = flag.Int("maxProcs", 0, "GOMAXPROCS value to set -- 0 = use current default -- better to set threads instead, as long as it is < GOMAXPROCS")
var threads = flag.Int("threads", 2, "number of goroutines for parallel processing -- 2, 4 give good results typically")
var threads = flag.Int("threads", 16, "number of goroutines for parallel processing -- 16 best")
var ndata = flag.Int("ndata", 1, "number of inputs to run in parallel")
var numEpochs = flag.Int("epochs", 1, "number of epochs to run")
var numPats = flag.Int("pats", 10, "number of patterns per epoch")
Expand Down Expand Up @@ -54,8 +55,8 @@ func BenchmarkBenchNetFull(b *testing.B) {
inLay := net.LayerByName("V1_0")
outLay := net.LayerByName("Output")

inPats := pats.ColumnByName("Input").(*tensor.Float32)
outPats := pats.ColumnByName("Output").(*tensor.Float32)
inPats := errors.Log1(pats.ColumnByName("Input")).(*tensor.Float32)
outPats := errors.Log1(pats.ColumnByName("Output")).(*tensor.Float32)

require.Equal(b, inLay.Shape.Len(), inPats.Len() / *numPats)
require.Equal(b, outLay.Shape.Len(), outPats.Len() / *numPats)
Expand Down
61 changes: 61 additions & 0 deletions examples/bench_lvis/bench_results.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,67 @@ Lvis: Neurons: 47,872 NeurMem: 16.8 MB Syns: 31,316,128 SynMem: 2.2 GB

and performance is roughly similar.

# v2.0.0-dev0.2.1 vgpu final 09/02/24 (linear SynCa approx)

## MacBook Pro M3

### GPU

`go test -gpu -verbose=false -ndata=1 -bench=. -run not` reporting Total Secs

* ndata=1 (371mb): 2.13
* ndata=2 (742mb): 2.49 = 1.7x
* ndata=4 (1.5gb): 3.44 = 2.5x
* ndata=8 (2.9gb): 5.65 = 3x

Output for -ndata=8:

```
P0: Running on GPU: Apple M3 Max: id=235275249 idx=0
Total Secs: 5.647090249s
TimerReport: LVisBench 2 threads
Function Name Secs Pct
GPU:ApplyExts 0.026 0.5
GPU:Cycles 4.805 91.6
GPU:DWt 0.257 4.9
GPU:MinusPhase 0.043 0.8
GPU:PlusPhase 0.040 0.8
GPU:PlusStart 0.003 0.0
GPU:WtFromDWt 0.074 1.4
WtFromDWtLayer 0.001 0.0
Total 5.248
```

### CPU

`go test -threads=16 -verbose=false -ndata=1 -bench=. -run not`

* ndata=1: 5.77
* ndata=2: 9.94
* ndata=4: 18.56 -- 2x no gain
* ndata=8: 35.76 -- ditto
* ndata=8, threads=32: 35.52
* ndata=8, threads=8: 41.5

For ndata=8 (very consistent %s across ndata):

```
Total Secs: 35.764117s
TimerReport: LVisBench 16 threads
Function Name Secs Pct
CycleNeuron 16.031 45.3
DWt 7.016 19.8
DWtSubMean 0.001 0.0
GatherSpikes 1.369 3.9
GiFromSpikes 4.241 12.0
PoolGiFromSpikes 0.382 1.1
PostSpike 0.973 2.8
SendSpike 4.904 13.9
WtFromDWt 0.440 1.2
WtFromDWtLayer 0.001 0.0
Total 35.358
```

# 1.8.2 PoolGi and SynCas access fixes: works for large models (Lvis)

## MacBook Pro M1
Expand Down
82 changes: 42 additions & 40 deletions examples/choose/armaze/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,47 +286,49 @@ func (vw *GUI) ConfigWorldGUI(ev *Env) *core.Body {

split.SetSplits(.4, .6)

b.AddAppBar(func(p *tree.Plan) {
tree.Add(p, func(w *core.Button) {
w.SetText("Init").SetIcon(icons.ClearAll).
SetTooltip("Init env").
OnClick(func(e events.Event) {
vw.Env.Init(0)
})
b.AddTopBar(func(bar *core.Frame) {
core.NewToolbar(bar).Maker(func(p *tree.Plan) {
tree.Add(p, func(w *core.Button) {
w.SetText("Init").SetIcon(icons.ClearAll).
SetTooltip("Init env").
OnClick(func(e events.Event) {
vw.Env.Init(0)
})
})
tree.Add(p, func(w *core.Button) {
w.SetText("Reset Trace").SetIcon(icons.Undo).
SetTooltip("Reset trace of position, etc, shown in 2D View").
OnClick(func(e events.Event) {
vw.Trace = nil
})
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(vw.Forward).SetText("Fwd").SetIcon(icons.SkipNext).
Styler(func(s *styles.Style) {
s.SetAbilities(true, abilities.RepeatClickable)
})
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(vw.Left).SetText("Left").SetIcon(icons.KeyboardArrowLeft).
Styler(func(s *styles.Style) {
s.SetAbilities(true, abilities.RepeatClickable)
})
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(vw.Right).SetText("Right").SetIcon(icons.KeyboardArrowRight).
Styler(func(s *styles.Style) {
s.SetAbilities(true, abilities.RepeatClickable)
})
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(vw.Consume).SetText("Consume").SetIcon(icons.SentimentExcited).
Styler(func(s *styles.Style) {
s.SetAbilities(true, abilities.RepeatClickable)
})
})

tree.Add(p, func(w *core.Separator) {})
})
tree.Add(p, func(w *core.Button) {
w.SetText("Reset Trace").SetIcon(icons.Undo).
SetTooltip("Reset trace of position, etc, shown in 2D View").
OnClick(func(e events.Event) {
vw.Trace = nil
})
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(vw.Forward).SetText("Fwd").SetIcon(icons.SkipNext).
Styler(func(s *styles.Style) {
s.SetAbilities(true, abilities.RepeatClickable)
})
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(vw.Left).SetText("Left").SetIcon(icons.KeyboardArrowLeft).
Styler(func(s *styles.Style) {
s.SetAbilities(true, abilities.RepeatClickable)
})
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(vw.Right).SetText("Right").SetIcon(icons.KeyboardArrowRight).
Styler(func(s *styles.Style) {
s.SetAbilities(true, abilities.RepeatClickable)
})
})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(vw.Consume).SetText("Consume").SetIcon(icons.SentimentExcited).
Styler(func(s *styles.Style) {
s.SetAbilities(true, abilities.RepeatClickable)
})
})

tree.Add(p, func(w *core.Separator) {})
})
return b
}
Expand Down
Loading

0 comments on commit 20c7d23

Please sign in to comment.