{"id":19863476,"url":"https://github.com/sandialabs/fugu","last_synced_at":"2025-05-02T04:31:06.152Z","repository":{"id":39606759,"uuid":"465425461","full_name":"sandialabs/Fugu","owner":"sandialabs","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-01T16:31:58.000Z","size":194384,"stargazers_count":25,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-01T17:45:31.116Z","etag":null,"topics":["computation-graphs","neuromorphic","neuromorphic-computing","scr-2708","snl-comp-science-libs","snl-other","snl-prog-models-runtimes","spiking-circuits","spiking-neural-network"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sandialabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-03-02T18:33:07.000Z","updated_at":"2025-04-10T14:10:12.000Z","dependencies_parsed_at":"2025-04-24T16:38:33.101Z","dependency_job_id":"732f80b6-ab72-4441-b065-d4124a97f078","html_url":"https://github.com/sandialabs/Fugu","commit_stats":null,"previous_names":["sandialabs/fugu"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandialabs%2FFugu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandialabs%2FFugu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandialabs%2FFugu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandialabs%2FFugu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sandialabs","download_url":"https://codeload.github.com/sandialabs/Fugu/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251986754,"owners_count":21675951,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["computation-graphs","neuromorphic","neuromorphic-computing","scr-2708","snl-comp-science-libs","snl-other","snl-prog-models-runtimes","spiking-circuits","spiking-neural-network"],"created_at":"2024-11-12T15:14:48.410Z","updated_at":"2025-05-02T04:31:01.144Z","avatar_url":"https://github.com/sandialabs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fugu\nA python library for computational neural graphs.\n\n# Install\n\n## Dependencies\nA full list of dependencies is listed in requirements.txt.  The high level dependencies are:\n\n- Numpy\n- NetworkX\n- Pandas\n\n### A Note on Running Examples\n\nSome of the examples additionally require Jupyter and matplotlib.\n\n\n## Using Pip\n```bash\ngit clone https://github.com/sandialabs/Fugu.git\ncd Fugu\npip install --upgrade pip\npip install -e .[examples]\n```\n\n## Using Conda\nLet's install the requirements for Fugu.\n```bash\ngit clone https://github.com/sandialabs/Fugu.git\ncd Fugu\nconda env create -f fugu_conda_environment.yml\nconda activate fugu\nconda develop $PWD\n```\n\n## [OPTIONAL] STACS Backend\nThe Simulation Tool for Asynchronous Cortical Streams (STACS) is an optional simulator backend that may be used with Fugu. Developed to be parallel from the ground up, STACS leverages the highly portable Charm++ parallel programming framework. In addition to the parallel runtime, STACS also implements a memory-efficient distributed network data structure for network construction, simulation, and serialization. This provides a scalable simulation backend to support both large-scale and long running SNN experiments (e.g. on HPC systems).\n\nWhile STACS is developed as a stand-alone simulator, through the use of a template network model and specially developed neuron and synapse models, users of Fugu may interface with STACS simply through Fugu's backend API. To utilize the STACS backend, some additional software tools are necessary. This section describes the installation of these tools from source for the STACS backend usage.\n\n### Prerequisite Packages\nFirst, install essential (linux) packages.\n```\nsudo apt-get install build-essential gfortran cmake cmake-curses-gui\nsudo apt-get install libyaml-cpp-dev libfftw3-dev zlib1g-dev\nsudo apt-get install mpich\n```\n\n### Charm++\nDownload Charm++ (v7.0.0) and untar the package.\n```\nwget http://charm.cs.illinois.edu/distrib/charm-7.0.0.tar.gz\ntar -zxvf charm-7.0.0.tar.gz\n\nmkdir charm\nmv charm-7.0.0.tar.gz charm/\nmv charm-v7.0.0/ charm/7.0.0\n```\n\nBuild Charm++\n```\ncd charm/7.0.0\n./build charm++ mpi-linux-x86_64 --with-production -j2\n```\n\nAdd Charm++ to PATH variable (target=mpi-linux-x86_64 here)\n```\nexport CHARM_ROOTDIR=/path/to/charm/version/target\nexport PATH=${CHARM_ROOTDIR}/bin:$PATH\n```\nReplace `/path/to/charm/version/target` with the directory path to your Charm++. Alternatively, add the above two lines to your `~/.bashrc` file for a variables to be persistent between linux sessions.\n\nNext, install STACS repository\n```\ngit clone https://github.com/sandialabs/STACS.git\ncd STACS\nmake -j2\n```\n\n# Documentation\nDocumentation is currently spread across several files and directories.  We are working on including docstrings on all the classes and methods.\n\nFor now, you can check:\n- https://sandialabs.github.io/Fugu/\n- This `README.md`\n- The `examples` folder\n\n\nAdditional documentation can be generated from the `docs` folder. Use the following instructions to generate it on your system.\n\n```bash\npip install -U Sphinx\n```\nor\n```bash\nconda install Sphinx\n```\n\nNavigate to the `docs` folder.  Use the `sphinx-build` command with the `html` option to generate the HTML files on your system.\n```\nsphinx-build -b html -a source/ build/html\n```\nThe documentation will be in `docs/build/html`.\nOpen `introduction.html`.  From this page you can you can navigate through the full website, Fugu Module, etc.\n\n# Developers\nThe information below is for Fugu developers.\n\n## Pre-commit hooks\nPre-commit is used to enforce a code standard thoughout Fugu's codebase. For now, the pre-commit hooks enforce \n\n1. Code formatting (via `black`)\n2. Import sorting (via `isort`)\n\nThe following packages are required for the pre-commit hooks\n\n1. black\n2. isort\n3. pre-commit\n\n### Installation and setup\n\nFirst install the necessary python packages using\n\n`pip install black isort pre-commit`\n\nor \n\n`conda install -c conda-forge black isort pre-commit`\n\nNext, we install the pre-commit hooks with\n`pre-commit install --install-hooks`\n*Note:* `.pre-commit-config.yaml` must be present in the top level of Fugu for the pre-commit installation. For the pre-commit installs to work properly for me, I had to disconnect from the Sandia VPN. Lastly, these instructions have been tested using a conda environment.\n\nNow the pre-commit hooks will be installed. The next time you commit a file to the repository, `isort` and `black` will check that the file conforms to the new code standards. If the file passes the checks then you will be prompted to enter a commit message. Otherwise, the pre-commit will display if one or both commands failed. To fix the problem run one or both of these commands on the culprit file:\n\n`isort /path/to/culprit/file`\n`black /path/to/culprit/file`\n\n## Formatters\n\nIn order to homogenize the code base, we are including a couple of tools to help code formatting: `isort` for formatting imports and `black` for formatting code. The tools can be added with the following pip command:\n```bash\npip install black isort\n```\n\n__Note: the convention is only being enforced for the following paths:__\n- __`tests`__\n- __`fugu/utils/validation.py`__\n- __`fugu/simulators`__\n\n__Note: exclude the following modules from automated formatting:__\n- `fugu/backends`\n\nYou can run CI pipeline checks locally to check first:\n```bash\nisort --check --filter-files tests fugu/utils/validation.py fugu/simulators\nblack --check tests fugu/utils/validation.py fugu/simulators\n```\n\nThe `filter-files` option ensures that files and directories are still skipped when specified into `isort` inputs.\n\nThere are various ways to automate these tools as part of your development: look up instructions for your text editor, IDE, etc. as well as Git pre-commit hooks.\n\n_If you would like to exclude your source code from the auto-formatters, you can add the following at the top of your file(s):_\n```python\n\"\"\"\nisort:skip_file\n\"\"\"\n\n# fmt: off\n```\n\n__Caution: if you are working with existing code that hasn't been formatted yet, please commit the updates from the formatting tools as a single commit before doing actual work and record the SHA as a new line in the file `.git-blame-ignore-revs`. This helps with more accurate information from the `git blame` command and prevent polluting the record with your username from the updates from the formatters. To configure `git` to use this file automatically, run the command `git config blame.ignoreRevsFile .git-blame-ignore-revs`.__\n\n## Testing\n\nClick [here](tests/README.md) for more information and instructions on Fugu's test suite.\n\n## Branches\n\nWe suggest the following convention for naming branches: `username/##-branch-name`, where:\n- `username`: your GitLab username\n- `##`: issue number (can be omitted if branch is not tied to an issue)\n- `branch-name`: a short descrition of the work\n\n# Basic concepts\n\n## Scaffold\n\nThe `Scaffold` object is a graph that contains bricks at each node.  In reality, the Scaffold is only responsible for the organization of bricks.  All functionality is held in the bricks themselves.\n\n\n## Bricks\n\nEach `Brick` represents one computational function.  Bricks are attached to a Scaffold.  Bricks have certain key properties:\n\n- metadata:  A dictionary containing information such as the input and output sizes, circuit depth (if defined), and the types of codings.\n- upported_codings:  A list of supported codings for this brick. A complete list of codings is avialable at input_coding_types .\n- is_built:  A simple boolean saying whether or not the brick as been built\n- name: A string representing the brick\n\n### Brick.build(self, graph, metadata, complete_node, input_lists, input_codings)\n\nThis function forms the section of the graph corresponding to the brick.\n\nInput parameters:\n- graph: graph that is being built\n- metadata: dictionary containing relevant dimensionality information\n- control_nodes: A list of dictionaries of neurons that transmit control signals. A 'done' signal (Generally one from each input) is included in `control_nodes[i]['complete']`.\n- input_lists: A list of lists of input neurons.  Each neuron is marked with a local index used for encodings.\n- input_codings: A list of types of input codings.  See input_coding_types\n\nOutput:\nA tuple (graph, metadata, complete_node, output_lists, output_codings)\n- graph: Graph that is being built\n- metadata: Dictionary containing relevant metadata information\n- control_nodes: A dictionary of lists of neurons that transmists control information (see below)\n- output_lists: A list of lists of output neurons.  Each neuron is marked with a local index used for encodings.\n- output_codings: A list of types of codings.  See input_coding_types\n\n### Details on `control_nodes`\nWe've seen through experience that it can be extremely helpful to have neurons relay control\ninformation between bricks.  These neurons should be included in the `control_nodes`.  Regular\nrules apply to these neurons (e.g. naming must be globally unique and indices are locally unique).\n\n`control_nodes` is a *list* of *dictionaries*.  Each entry in the list corresponds with\nan input (if calling `Brick.build`) or an output (if returning from `Brick.build`).\n\n| Key | Required | Description |\n| ------ | ------ | ------ |\n| 'complete' | All Inputs/Outputs | A neuron that fires when a brick is done processing. |\n| 'begin' | Temporally-coded Inputs/Outputs | A neuron that fires when a brick begins providing output. |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandialabs%2Ffugu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsandialabs%2Ffugu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandialabs%2Ffugu/lists"}