Skip to content

Commit

Permalink
moved empi / mpi to cogent core
Browse files Browse the repository at this point in the history
  • Loading branch information
rcoreilly committed May 3, 2024
1 parent 15a9ca2 commit 9ca69f9
Show file tree
Hide file tree
Showing 67 changed files with 147 additions and 4,769 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ The following all work together to provide a convenient layer of abstraction for

* [efuns](efuns) has misc special functions such as Gaussian and Sigmoid.

* [erand](erand) has misc random-number generation support functionality, including `erand.RndParams` for parameterizing the type of random noise to add to a model, and easier support for making permuted random lists, etc.
* [randx](randx) has misc random-number generation support functionality, including `randx.RandParams` for parameterizing the type of random noise to add to a model, and easier support for making permuted random lists, etc.

* [esg](esg) is the *emergent stochastic / sentence generator* -- parses simple grammars that generate random events (sentences) -- can be a good starting point for generating more complex environments.

Expand Down
8 changes: 4 additions & 4 deletions actrf/mpi.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
package actrf

import (
"github.com/emer/emergent/v2/empi"
"github.com/emer/emergent/v2/empi/mpi"
"cogentcore.org/core/base/mpi"
"cogentcore.org/core/tensor/tensormpi"
)

// MPISum aggregates RF Sum data across all processors in given mpi communicator.
Expand All @@ -15,9 +15,9 @@ func (af *RF) MPISum(comm *mpi.Comm) {
if mpi.WorldSize() == 1 {
return
}
empi.ReduceTensor(&af.MPITmp, &af.SumProd, comm, mpi.OpSum)
tensormpi.ReduceTensor(&af.MPITmp, &af.SumProd, comm, mpi.OpSum)
af.SumProd.CopyFrom(&af.MPITmp)
empi.ReduceTensor(&af.MPITmp, &af.SumSrc, comm, mpi.OpSum)
tensormpi.ReduceTensor(&af.MPITmp, &af.SumSrc, comm, mpi.OpSum)
af.SumSrc.CopyFrom(&af.MPITmp)
}

Expand Down
2 changes: 1 addition & 1 deletion decoder/linear.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ package decoder
import (
"fmt"

"cogentcore.org/core/base/mpi"
"cogentcore.org/core/math32"
"cogentcore.org/core/tensor"
"github.com/emer/emergent/v2/empi/mpi"
)

type ActivationFunc func(float32) float32
Expand Down
2 changes: 1 addition & 1 deletion decoder/softmax.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import (
"path/filepath"
"sort"

"cogentcore.org/core/base/mpi"
"cogentcore.org/core/math32"
"cogentcore.org/core/tensor"
"github.com/emer/emergent/v2/emer"
"github.com/emer/emergent/v2/empi/mpi"
)

// SoftMax is a softmax decoder, which is the best choice for a 1-hot classification
Expand Down
4 changes: 2 additions & 2 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ in algorithm-specific code, including things like MinMax and AvgMax, and also th
parameter-styling infrastructure (emer.Params, emer.ParamStyle, emer.ParamSet and
emer.ParamSets).
* erand has misc random-number generation support functionality, including
erand.RndParams for parameterizing the type of random noise to add to a model,
* randx has misc random-number generation support functionality, including
randx.RandParams for parameterizing the type of random noise to add to a model,
and easier support for making permuted random lists, etc.
* netview provides the NetView interactive 3D network viewer, implemented in the Cogent Core 3D framework.
Expand Down
2 changes: 1 addition & 1 deletion ecmd/std.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ package ecmd
import (
"os"

"cogentcore.org/core/base/mpi"
"github.com/emer/emergent/v2/elog"
"github.com/emer/emergent/v2/emer"
"github.com/emer/emergent/v2/empi/mpi"
"github.com/emer/emergent/v2/etime"
)

Expand Down
6 changes: 3 additions & 3 deletions econfig/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Docs: [GoDoc](https://pkg.go.dev/github.com/emer/emergent/econfig)
The [Cogent Core](https://cogentcore.org/core) GUI processes `default:"value"` struct tags to highlight values that are not at their defaults. econfig uses these same tags to auto-initialize fields as well, ensuring that the tag and the actual initial value are the same. The value for strings or numbers is just the string representation. For more complex types, here ar some examples:

* `struct`: specify using standard Go literal expression as a string, with single-quotes `'` used instead of double-quotes around strings, such as the name of the fields:
+ `evec.Vector2i`: `default:"{'X':10,'Y':10}"`
+ `vecint.Vector2i`: `default:"{'X':10,'Y':10}"`

* `slice`: comma-separated list of values in square braces -- use `'` for internal string boundaries:
+ `[]float32`: `default:"[1, 2.14, 3.14]"`
Expand All @@ -80,10 +80,10 @@ type ParamConfig struct {
Network map[string]any

// size of hidden layer -- can use emer.LaySize for 4D layers
Hidden1Size evec.Vector2i `default:"{'X':10,'Y':10}" nest:"+"`
Hidden1Size vecint.Vector2i `default:"{'X':10,'Y':10}" nest:"+"`

// size of hidden layer -- can use emer.LaySize for 4D layers
Hidden2Size evec.Vector2i `default:"{'X':10,'Y':10}" nest:"+"`
Hidden2Size vecint.Vector2i `default:"{'X':10,'Y':10}" nest:"+"`

// Extra Param Sheet name(s) to use (space separated if multiple) -- must be valid name as listed in compiled-in params or loaded params
Sheet string
Expand Down
2 changes: 1 addition & 1 deletion econfig/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"strings"

"cogentcore.org/core/base/iox/tomlx"
"cogentcore.org/core/base/mpi"
"cogentcore.org/core/base/reflectx"
"github.com/emer/emergent/v2/empi/mpi"
"github.com/iancoleman/strcase"
)

Expand Down
2 changes: 1 addition & 1 deletion econfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"reflect"

"cogentcore.org/core/base/dirs"
"github.com/emer/emergent/v2/empi/mpi"
"cogentcore.org/core/base/mpi"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion econfig/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"

"cogentcore.org/core/base/iox/tomlx"
"github.com/emer/emergent/v2/empi/mpi"
"cogentcore.org/core/base/mpi"
)

// OpenWithIncludes reads config from given config file,
Expand Down
8 changes: 4 additions & 4 deletions elog/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (
"path/filepath"
"strconv"

"cogentcore.org/core/base/mpi"
"cogentcore.org/core/tensor/table"
"cogentcore.org/core/tensor/tensormpi"
"github.com/emer/emergent/v2/emer"
"github.com/emer/emergent/v2/empi"
"github.com/emer/emergent/v2/empi/mpi"
"github.com/emer/emergent/v2/estats"
"github.com/emer/emergent/v2/etime"
)
Expand Down Expand Up @@ -308,7 +308,7 @@ func (lg *Logs) ResetLog(mode etime.Modes, time etime.Times) {
lt.ResetIndexViews()
}

// MPIGatherTableRows calls empi.GatherTableRows on the given log table
// MPIGatherTableRows calls tensormpi.GatherTableRows on the given log table
// using an "MPI" suffixed MiscTable that is then switched out with the main table,
// so that any subsequent aggregation etc operates as usual on the full set of data.
// IMPORTANT: this switch means that the number of rows in the table MUST be reset
Expand All @@ -323,7 +323,7 @@ func (lg *Logs) MPIGatherTableRows(mode etime.Modes, time etime.Times, comm *mpi
if !has {
mt = &table.Table{}
}
empi.GatherTableRows(mt, dt, comm)
tensormpi.GatherTableRows(mt, dt, comm)
lt.Table = mt
lg.MiscTables[skm] = dt // note: actual underlying tables are always being swapped
lt.ResetIndexViews()
Expand Down
2 changes: 1 addition & 1 deletion emer/netparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"log"
"strings"

"github.com/emer/emergent/v2/empi/mpi"
"cogentcore.org/core/base/mpi"
"github.com/emer/emergent/v2/netparams"
"github.com/emer/emergent/v2/params"
)
Expand Down
24 changes: 0 additions & 24 deletions empi/README.md

This file was deleted.

26 changes: 0 additions & 26 deletions empi/alloc.go

This file was deleted.

18 changes: 0 additions & 18 deletions empi/doc.go

This file was deleted.

16 changes: 0 additions & 16 deletions empi/mpi/doc.go

This file was deleted.

Loading

0 comments on commit 9ca69f9

Please sign in to comment.