Skip to content

Install

StephenJRead edited this page Jun 6, 2020 · 30 revisions

Installation

This wiki provides an umbrella wiki for all emer projects. The emergent repository itself does not contain directly runnable code (except for tests) -- it serves as a toolkit for other specific algorithms.

Currently the only implemented one is in the leabra repository. Thus, you need to install that to see how emergent works.

In general, emergent works by compiling programs into executables which you then run like any other executable. This is very different from the C++ version of emergent which was a single monolithic program attempting to have all functionality built-in. Instead, the new model is the more prevalent approach of writing more specific code to achieve more specific goals, which is more flexible and allows individuals to be more in control of their own destiny..

First, install GoGi

Note: Due to gonum dependencies, you must use Go version 1.13 or newer!

Emergent depends on GoGi, so first follow the installation instructions for it, including building the standard widgets example to make sure everything is working. This is essential especially because there are non-Go elements that need to be installed to support the 3D GUI, and we don't want to maintain multiple copies of that information!

Then install leabra (Modules version)

We're assuming you've read the discussion of go modules in the GoGi install page. In contrast to prior instructions, we now recommend you just use go modules! -- it is much easier for "end user" use..

$ cd <anywhere you want to install>  # you can put the code anywhere you want!
$ git clone https://github.com/emer/leabra   # makes a leabra directory 
$ cd leabra/examples/ra25
$ go build    # this installs all the dependencies for you!  do *not* type go get ./...
$ ./ra25 &

When you do go build above, all of the other packages in emer will be installed into:

  • ~/go/pkg/mod/github.com/emer/ So you can look in there for all the code -- the modules mode names the directories with the specific version that is installed, so look for the most recent version!

Making your own models

To make your own simulations, copy the ra25.go code to your own repository, and modify accordingly. Also see the CCN Textbook sims for many other examples -- finding the closest example in there is probably the best place to start.

Here's an example for starting a new project with ra25.go, in a top-level "mycode" directory:

$ cd ~/
$ mkdir mycode
$ cd mycode
$ cp ~/emer/leabra/examples/ra25/ra25.go .
$ cp ~/emer/leabra/examples/ra25/random_5x5_25.tsv .   # these are the input patterns
$ go mod init github.com/emer/mycode   # making up a fake package name here -- use your own github!
$ go build
$ ./mycode &   # the program will be named after the directory!  not the .go file (see below)

go build options

You can run go build either specifying a particular .go file, or without (i.e., just go build as in above instructions).

  • If you have multiple .go files in same dir that all contribute to one executable, then you have to run go build, and the resulting executable will be named after the directory.

  • If you have multiple .go files and each should be built as a separate executable, then you have to run go build file.go and the executable will be named after the file.

  • If you only have one .go file, you can decide what you prefer.