diff --git a/go.mod b/go.mod index 14e8a46a9..d9ae9f13e 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/emer/axon/v2 go 1.22 require ( - cogentcore.org/core v0.3.8-0.20250107202432-e0c4c10448e1 + cogentcore.org/core v0.3.8-0.20250113105110-b73be80edead cogentcore.org/lab v0.0.0-20250109203708-c742f9552551 github.com/anthonynsimon/bild v0.13.0 github.com/cogentcore/yaegi v0.0.0-20240724064145-e32a03faad56 diff --git a/go.sum b/go.sum index d5b7635d6..fe99ebfc4 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -cogentcore.org/core v0.3.8-0.20250107202432-e0c4c10448e1 h1:rLT0EDrIQKABTyChQNTgh7qfUizUCYVywhJTAAvueU4= -cogentcore.org/core v0.3.8-0.20250107202432-e0c4c10448e1/go.mod h1:Ipnb14B+l0qLzjvcvCIhnDucV9H9RyuqS4knZz5kB8A= +cogentcore.org/core v0.3.8-0.20250113105110-b73be80edead h1:aBcVq6+4XbhphORwy1oyZUGbTSkKMkzyxKnM5Oo/O1c= +cogentcore.org/core v0.3.8-0.20250113105110-b73be80edead/go.mod h1:Ipnb14B+l0qLzjvcvCIhnDucV9H9RyuqS4knZz5kB8A= cogentcore.org/lab v0.0.0-20250109203708-c742f9552551 h1:aHaTWuqrsVKnwrcPACwAGy8v0KN5bCxgDqcwfzjtsmA= cogentcore.org/lab v0.0.0-20250109203708-c742f9552551/go.mod h1:cFjKEyMK/eCST7x6sGCGjC12iY+/vcgZime7ASFnM/k= github.com/Bios-Marcel/wastebasket v0.0.4-0.20240213135800-f26f1ae0a7c4 h1:6lx9xzJAhdjq0LvVfbITeC3IH9Fzvo1aBahyPu2FuG8= diff --git a/sims/bgdorsal/bg-dorsal.go b/sims/bgdorsal/bg-dorsal.go index fad7c9c37..ccdd7c760 100644 --- a/sims/bgdorsal/bg-dorsal.go +++ b/sims/bgdorsal/bg-dorsal.go @@ -138,6 +138,7 @@ func (ss *Sim) Run() { ss.RandSeeds.Init(100) // max 100 runs ss.InitRandSeed(0) if ss.Config.Run.GPU { + gpu.SelectAdapter = ss.Config.Run.GPUDevice axon.GPUInit() axon.UseGPU = true } diff --git a/sims/bgdorsal/config.go b/sims/bgdorsal/config.go index c1745d516..f9a2a7eec 100644 --- a/sims/bgdorsal/config.go +++ b/sims/bgdorsal/config.go @@ -72,6 +72,9 @@ type RunConfig struct { // GPU uses the GPU for computation. GPU bool `default:"true"` + // GPUDevice selects the gpu device to use. + GPUDevice int + // NData is the number of data-parallel items to process in parallel per trial. // Is significantly faster for both CPU and GPU. Results in an effective // mini-batch of learning. diff --git a/sims/bgventral/bg-ventral.go b/sims/bgventral/bg-ventral.go index 9d23692be..6822d24c4 100644 --- a/sims/bgventral/bg-ventral.go +++ b/sims/bgventral/bg-ventral.go @@ -19,6 +19,7 @@ import ( "cogentcore.org/core/cli" "cogentcore.org/core/core" "cogentcore.org/core/enums" + "cogentcore.org/core/gpu" "cogentcore.org/core/icons" "cogentcore.org/core/math32" "cogentcore.org/core/tree" @@ -135,6 +136,7 @@ func (ss *Sim) Run() { ss.RandSeeds.Init(100) // max 100 runs ss.InitRandSeed(0) if ss.Config.Run.GPU { + gpu.SelectAdapter = ss.Config.Run.GPUDevice axon.GPUInit() axon.UseGPU = true } diff --git a/sims/bgventral/config.go b/sims/bgventral/config.go index 4f94bf94d..9f69e9ba2 100644 --- a/sims/bgventral/config.go +++ b/sims/bgventral/config.go @@ -62,6 +62,9 @@ type RunConfig struct { // GPU uses the GPU for computation; only for testing in this model -- not faster. GPU bool `default:"true"` + // GPUDevice selects the gpu device to use. + GPUDevice int + // NData is the number of data-parallel items to process in parallel per trial. // Is significantly faster for both CPU and GPU. Results in an effective // mini-batch of learning. diff --git a/sims/choose/choose.go b/sims/choose/choose.go index ff1a8865f..3f80fd65d 100644 --- a/sims/choose/choose.go +++ b/sims/choose/choose.go @@ -18,6 +18,7 @@ import ( "cogentcore.org/core/cli" "cogentcore.org/core/core" "cogentcore.org/core/enums" + "cogentcore.org/core/gpu" "cogentcore.org/core/icons" "cogentcore.org/core/math32" "cogentcore.org/core/tree" @@ -138,6 +139,7 @@ func (ss *Sim) Run() { ss.RandSeeds.Init(100) // max 100 runs ss.InitRandSeed(0) if ss.Config.Run.GPU { + gpu.SelectAdapter = ss.Config.Run.GPUDevice axon.GPUInit() axon.UseGPU = true } diff --git a/sims/choose/config.go b/sims/choose/config.go index c9a5a9db8..afe339a41 100644 --- a/sims/choose/config.go +++ b/sims/choose/config.go @@ -89,6 +89,9 @@ type RunConfig struct { // GPU uses the GPU for computation: not faster in this case. GPU bool `default:"true"` + // GPUDevice selects the gpu device to use. + GPUDevice int + // NData is the number of data-parallel items to process in parallel per trial. // Is significantly faster for both CPU and GPU. Results in an effective // mini-batch of learning. diff --git a/sims/deepfsa/config.go b/sims/deepfsa/config.go index 79f89866c..486942598 100644 --- a/sims/deepfsa/config.go +++ b/sims/deepfsa/config.go @@ -72,6 +72,9 @@ type RunConfig struct { // small models if NData ~16. GPU bool `default:"true"` + // GPUDevice selects the gpu device to use. + GPUDevice int + // NData is the number of data-parallel items to process in parallel per trial. // Is significantly faster for both CPU and GPU. Results in an effective // mini-batch of learning. diff --git a/sims/deepfsa/deep-fsa.go b/sims/deepfsa/deep-fsa.go index 1d8b23060..2f3aea7e0 100644 --- a/sims/deepfsa/deep-fsa.go +++ b/sims/deepfsa/deep-fsa.go @@ -17,6 +17,7 @@ import ( "cogentcore.org/core/cli" "cogentcore.org/core/core" "cogentcore.org/core/enums" + "cogentcore.org/core/gpu" "cogentcore.org/core/icons" "cogentcore.org/core/math32" "cogentcore.org/core/tree" @@ -133,6 +134,7 @@ func (ss *Sim) Run() { ss.RandSeeds.Init(100) // max 100 runs ss.InitRandSeed(0) if ss.Config.Run.GPU { + gpu.SelectAdapter = ss.Config.Run.GPUDevice axon.GPUInit() axon.UseGPU = true } diff --git a/sims/deepmove/config.go b/sims/deepmove/config.go index 2cd51c35f..fc5377ed5 100644 --- a/sims/deepmove/config.go +++ b/sims/deepmove/config.go @@ -59,6 +59,9 @@ type RunConfig struct { //types:add // small models if NData ~16. GPU bool `default:"true"` + // GPUDevice selects the gpu device to use. + GPUDevice int + // NData is the number of data-parallel items to process in parallel per trial. // Is significantly faster for both CPU and GPU. Results in an effective // mini-batch of learning. diff --git a/sims/deepmove/deep-move.go b/sims/deepmove/deep-move.go index 876217d22..9db242364 100644 --- a/sims/deepmove/deep-move.go +++ b/sims/deepmove/deep-move.go @@ -16,6 +16,7 @@ import ( "cogentcore.org/core/cli" "cogentcore.org/core/core" "cogentcore.org/core/enums" + "cogentcore.org/core/gpu" "cogentcore.org/core/icons" "cogentcore.org/core/math32" "cogentcore.org/core/math32/vecint" @@ -136,6 +137,7 @@ func (ss *Sim) Run() { ss.RandSeeds.Init(100) // max 100 runs ss.InitRandSeed(0) if ss.Config.Run.GPU { + gpu.SelectAdapter = ss.Config.Run.GPUDevice axon.GPUInit() axon.UseGPU = true } diff --git a/sims/deepmusic/config.go b/sims/deepmusic/config.go index 41fcd49fe..48ad0e34a 100644 --- a/sims/deepmusic/config.go +++ b/sims/deepmusic/config.go @@ -68,6 +68,9 @@ type RunConfig struct { //types:add // small models if NData ~16. GPU bool `default:"true"` + // GPUDevice selects the gpu device to use. + GPUDevice int + // NData is the number of data-parallel items to process in parallel per trial. // Is significantly faster for both CPU and GPU. Results in an effective // mini-batch of learning. diff --git a/sims/deepmusic/deep-music.go b/sims/deepmusic/deep-music.go index 05f634297..b4c340d33 100644 --- a/sims/deepmusic/deep-music.go +++ b/sims/deepmusic/deep-music.go @@ -17,6 +17,7 @@ import ( "cogentcore.org/core/cli" "cogentcore.org/core/core" "cogentcore.org/core/enums" + "cogentcore.org/core/gpu" "cogentcore.org/core/icons" "cogentcore.org/core/math32" "cogentcore.org/core/tree" @@ -138,6 +139,7 @@ func (ss *Sim) Run() { ss.RandSeeds.Init(100) // max 100 runs ss.InitRandSeed(0) if ss.Config.Run.GPU { + gpu.SelectAdapter = ss.Config.Run.GPUDevice axon.GPUInit() axon.UseGPU = true } diff --git a/sims/hip/config.go b/sims/hip/config.go index 85948c670..337dc3e5e 100644 --- a/sims/hip/config.go +++ b/sims/hip/config.go @@ -75,6 +75,9 @@ type RunConfig struct { // small models if NData ~16. GPU bool `default:"true"` + // GPUDevice selects the gpu device to use. + GPUDevice int + // NData is the number of data-parallel items to process in parallel per trial. // Is significantly faster for both CPU and GPU. Results in an effective // mini-batch of learning. diff --git a/sims/hip/hip.go b/sims/hip/hip.go index c5805c172..22baca577 100644 --- a/sims/hip/hip.go +++ b/sims/hip/hip.go @@ -15,6 +15,7 @@ import ( "cogentcore.org/core/cli" "cogentcore.org/core/core" "cogentcore.org/core/enums" + "cogentcore.org/core/gpu" "cogentcore.org/core/icons" "cogentcore.org/core/math32" "cogentcore.org/core/tree" @@ -133,6 +134,7 @@ func (ss *Sim) Run() { ss.RandSeeds.Init(100) // max 100 runs ss.InitRandSeed(0) if ss.Config.Run.GPU { + gpu.SelectAdapter = ss.Config.Run.GPUDevice axon.GPUInit() axon.UseGPU = true } diff --git a/sims/inhib/config.go b/sims/inhib/config.go index 3f1d6e2a2..09a30dad9 100644 --- a/sims/inhib/config.go +++ b/sims/inhib/config.go @@ -53,6 +53,9 @@ type RunConfig struct { // GPU uses the GPU for computation, largely for testing purposes here. GPU bool `default:"false"` + // GPUDevice selects the gpu device to use. + GPUDevice int + // Trials is the total number of trials of different random patterns to generate. Trials int `default:"10"` diff --git a/sims/inhib/inhib.go b/sims/inhib/inhib.go index b7c836ff3..4a15f006d 100644 --- a/sims/inhib/inhib.go +++ b/sims/inhib/inhib.go @@ -17,6 +17,7 @@ import ( "cogentcore.org/core/cli" "cogentcore.org/core/core" "cogentcore.org/core/enums" + "cogentcore.org/core/gpu" "cogentcore.org/core/icons" "cogentcore.org/core/math32" "cogentcore.org/core/tree" @@ -134,6 +135,7 @@ func (ss *Sim) Run() { ss.RandSeeds.Init(100) // max 100 runs ss.InitRandSeed(0) if ss.Config.Run.GPU { + gpu.SelectAdapter = ss.Config.Run.GPUDevice axon.GPUInit() axon.UseGPU = true } diff --git a/sims/mpi/config.go b/sims/mpi/config.go index b5537e09c..d9d75194b 100644 --- a/sims/mpi/config.go +++ b/sims/mpi/config.go @@ -50,6 +50,9 @@ type RunConfig struct { // small models if NData ~16. GPU bool `default:"true"` + // GPUDevice selects the gpu device to use. + GPUDevice int + // NData is the number of data-parallel items to process in parallel per trial. // Is significantly faster for both CPU and GPU. Results in an effective // mini-batch of learning. diff --git a/sims/mpi/mpi.go b/sims/mpi/mpi.go index 1f9ce96f2..c51e0e86f 100644 --- a/sims/mpi/mpi.go +++ b/sims/mpi/mpi.go @@ -21,6 +21,7 @@ import ( "cogentcore.org/core/cli" "cogentcore.org/core/core" "cogentcore.org/core/enums" + "cogentcore.org/core/gpu" "cogentcore.org/core/icons" "cogentcore.org/core/math32" "cogentcore.org/core/tree" @@ -144,6 +145,7 @@ func (ss *Sim) Run() { ss.RandSeeds.Init(100) // max 100 runs ss.InitRandSeed(0) if ss.Config.Run.GPU { + gpu.SelectAdapter = ss.Config.Run.GPUDevice axon.GPUInit() axon.UseGPU = true } diff --git a/sims/objrec/config.go b/sims/objrec/config.go index 444aebb65..d9860566c 100644 --- a/sims/objrec/config.go +++ b/sims/objrec/config.go @@ -71,6 +71,9 @@ type RunConfig struct { // small models if NData ~16. GPU bool `default:"true"` + // GPUDevice selects the gpu device to use. + GPUDevice int + // NData is the number of data-parallel items to process in parallel per trial. // Is significantly faster for both CPU and GPU. Results in an effective // mini-batch of learning. @@ -102,7 +105,7 @@ type RunConfig struct { PlusCycles int `default:"50"` // CaBinCycles is the number of cycles per CaBin: how fine-grained the synaptic Ca is. - CaBinCycles int `default:"25"` + CaBinCycles int `default:"25"` // no diff for 25 vs. 10 // NZero is how many perfect, zero-error epochs before stopping a Run. NZero int `default:"2"` diff --git a/sims/objrec/objrec.go b/sims/objrec/objrec.go index a5f635051..c0fcb85da 100644 --- a/sims/objrec/objrec.go +++ b/sims/objrec/objrec.go @@ -18,6 +18,7 @@ import ( "cogentcore.org/core/cli" "cogentcore.org/core/core" "cogentcore.org/core/enums" + "cogentcore.org/core/gpu" "cogentcore.org/core/icons" "cogentcore.org/core/math32" "cogentcore.org/core/tree" @@ -139,6 +140,7 @@ func (ss *Sim) Run() { ss.RandSeeds.Init(100) // max 100 runs ss.InitRandSeed(0) if ss.Config.Run.GPU { + gpu.SelectAdapter = ss.Config.Run.GPUDevice axon.GPUInit() axon.UseGPU = true } diff --git a/sims/objrec/params.go b/sims/objrec/params.go index d1efdd934..d07f6caa2 100644 --- a/sims/objrec/params.go +++ b/sims/objrec/params.go @@ -88,7 +88,7 @@ var PathParams = axon.PathSheets{ pt.Learn.DWt.SubMean = 1 // 1 -- faster if 0 until 20 epc -- prevents sig amount of late deterioration pt.SWts.Adapt.LRate = 0.0001 // 0.005 == .1 == .01 pt.SWts.Init.SPct = 1 // 1 >= lower (trace-v11) - pt.Learn.DWt.CaPScale = 0.95 // trace: 0.95 resists late hogging + pt.Learn.DWt.CaPScale = 0.95 // 0.95 essential vs. 1.0 // pt.Learn.DWt.Trace.SetBool(false) // no trace is faster! }}, {Sel: ".BackPath", Doc: "top-down back-pathways MUST have lower relative weight scale, otherwise network hallucinates -- smaller as network gets bigger", diff --git a/sims/pfcmaint/config.go b/sims/pfcmaint/config.go index c3009914e..bfb6c9524 100644 --- a/sims/pfcmaint/config.go +++ b/sims/pfcmaint/config.go @@ -65,6 +65,9 @@ type RunConfig struct { // GPU uses the GPU for computation; only for testing in this model -- not faster. GPU bool `default:"true"` + // GPUDevice selects the gpu device to use. + GPUDevice int + // NData is the number of data-parallel items to process in parallel per trial. // Is significantly faster for both CPU and GPU. Results in an effective // mini-batch of learning. diff --git a/sims/pfcmaint/pfcmaint.go b/sims/pfcmaint/pfcmaint.go index a02c965b0..c58d25f2a 100644 --- a/sims/pfcmaint/pfcmaint.go +++ b/sims/pfcmaint/pfcmaint.go @@ -16,6 +16,7 @@ import ( "cogentcore.org/core/base/reflectx" "cogentcore.org/core/core" "cogentcore.org/core/enums" + "cogentcore.org/core/gpu" "cogentcore.org/core/icons" "cogentcore.org/core/math32" "cogentcore.org/core/tree" @@ -124,6 +125,7 @@ func (ss *Sim) Run() { ss.RandSeeds.Init(100) // max 100 runs ss.InitRandSeed(0) if ss.Config.Run.GPU { + gpu.SelectAdapter = ss.Config.Run.GPUDevice axon.GPUInit() axon.UseGPU = true } diff --git a/sims/pvlv/config.go b/sims/pvlv/config.go index 46cf91a51..52e0af39d 100644 --- a/sims/pvlv/config.go +++ b/sims/pvlv/config.go @@ -71,6 +71,9 @@ type RunConfig struct { // GPU uses the GPU for computation: not faster in this case. GPU bool `default:"false"` + // GPUDevice selects the gpu device to use. + GPUDevice int + // NThreads is the number of parallel threads for CPU computation; // 0 = use default. NThreads int `default:"0"` diff --git a/sims/pvlv/pvlv.go b/sims/pvlv/pvlv.go index 945acbbd9..9e0301aed 100644 --- a/sims/pvlv/pvlv.go +++ b/sims/pvlv/pvlv.go @@ -19,6 +19,7 @@ import ( "cogentcore.org/core/cli" "cogentcore.org/core/core" "cogentcore.org/core/enums" + "cogentcore.org/core/gpu" "cogentcore.org/core/icons" "cogentcore.org/core/math32" "cogentcore.org/core/tree" @@ -132,6 +133,7 @@ func (ss *Sim) Run() { ss.RandSeeds.Init(100) // max 100 runs ss.InitRandSeed(0) if ss.Config.Run.GPU { + gpu.SelectAdapter = ss.Config.Run.GPUDevice axon.GPUInit() axon.UseGPU = true } diff --git a/sims/ra25/config.go b/sims/ra25/config.go index 0b500e665..77de2d40a 100644 --- a/sims/ra25/config.go +++ b/sims/ra25/config.go @@ -52,6 +52,9 @@ type RunConfig struct { // small models if NData ~16. GPU bool `default:"true"` + // GPUDevice selects the gpu device to use. + GPUDevice int + // NData is the number of data-parallel items to process in parallel per trial. // Is significantly faster for both CPU and GPU. Results in an effective // mini-batch of learning. diff --git a/sims/ra25/ra25.go b/sims/ra25/ra25.go index db693074d..2ccbd36e1 100644 --- a/sims/ra25/ra25.go +++ b/sims/ra25/ra25.go @@ -147,6 +147,8 @@ func (ss *Sim) Run() { ss.RandSeeds.Init(100) // max 100 runs ss.InitRandSeed(0) if ss.Config.Run.GPU { + // gpu.DebugAdapter = true + gpu.SelectAdapter = ss.Config.Run.GPUDevice axon.GPUInit() axon.UseGPU = true } diff --git a/sims/ra25x/config.go b/sims/ra25x/config.go index d72555bfe..a180ecb90 100644 --- a/sims/ra25x/config.go +++ b/sims/ra25x/config.go @@ -50,6 +50,9 @@ type RunConfig struct { // small models if NData ~16. GPU bool `default:"true"` + // GPUDevice selects the gpu device to use. + GPUDevice int + // NData is the number of data-parallel items to process in parallel per trial. // Is significantly faster for both CPU and GPU. Results in an effective // mini-batch of learning. diff --git a/sims/ra25x/ra25x.go b/sims/ra25x/ra25x.go index 33fb58a90..307d81a20 100644 --- a/sims/ra25x/ra25x.go +++ b/sims/ra25x/ra25x.go @@ -21,6 +21,7 @@ import ( "cogentcore.org/core/cli" "cogentcore.org/core/core" "cogentcore.org/core/enums" + "cogentcore.org/core/gpu" "cogentcore.org/core/icons" "cogentcore.org/core/math32" "cogentcore.org/core/tree" @@ -144,6 +145,7 @@ func (ss *Sim) Run() { ss.RandSeeds.Init(100) // max 100 runs ss.InitRandSeed(0) if ss.Config.Run.GPU { + gpu.SelectAdapter = ss.Config.Run.GPUDevice axon.GPUInit() axon.UseGPU = true } diff --git a/sims/rl/config.go b/sims/rl/config.go index eedfd79ae..91e3a8e55 100644 --- a/sims/rl/config.go +++ b/sims/rl/config.go @@ -49,6 +49,9 @@ type RunConfig struct { // GPU uses the GPU for computation; only for testing in this model -- not faster. GPU bool `default:"false"` + // GPUDevice selects the gpu device to use. + GPUDevice int + // NData is the number of data-parallel items to process in parallel per trial. // Is significantly faster for both CPU and GPU. Results in an effective // mini-batch of learning. diff --git a/sims/rl/rl.go b/sims/rl/rl.go index b10a6470d..7af9455b3 100644 --- a/sims/rl/rl.go +++ b/sims/rl/rl.go @@ -18,6 +18,7 @@ import ( "cogentcore.org/core/cli" "cogentcore.org/core/core" "cogentcore.org/core/enums" + "cogentcore.org/core/gpu" "cogentcore.org/core/icons" "cogentcore.org/core/math32" "cogentcore.org/core/tree" @@ -131,6 +132,7 @@ func (ss *Sim) Run() { ss.RandSeeds.Init(100) // max 100 runs ss.InitRandSeed(0) if ss.Config.Run.GPU { + gpu.SelectAdapter = ss.Config.Run.GPUDevice axon.GPUInit() axon.UseGPU = true } diff --git a/sims/vspatch/config.go b/sims/vspatch/config.go index 559d1243f..63d8cbb7e 100644 --- a/sims/vspatch/config.go +++ b/sims/vspatch/config.go @@ -58,6 +58,9 @@ type RunConfig struct { // GPU uses the GPU for computation; only for testing in this model -- not faster. GPU bool `default:"true"` + // GPUDevice selects the gpu device to use. + GPUDevice int + // NData is the number of data-parallel items to process in parallel per trial. // Is significantly faster for both CPU and GPU. Results in an effective // mini-batch of learning. diff --git a/sims/vspatch/vspatch.go b/sims/vspatch/vspatch.go index dc6a6d5c8..60609f5cd 100644 --- a/sims/vspatch/vspatch.go +++ b/sims/vspatch/vspatch.go @@ -18,6 +18,7 @@ import ( "cogentcore.org/core/cli" "cogentcore.org/core/core" "cogentcore.org/core/enums" + "cogentcore.org/core/gpu" "cogentcore.org/core/icons" "cogentcore.org/core/math32" "cogentcore.org/core/tree" @@ -136,6 +137,7 @@ func (ss *Sim) Run() { ss.RandSeeds.Init(100) // max 100 runs ss.InitRandSeed(0) if ss.Config.Run.GPU { + gpu.SelectAdapter = ss.Config.Run.GPUDevice axon.GPUInit() axon.UseGPU = true }