Skip to main content

Systolic CNN AcceLerator Simulator

Project description

Systolic CNN AcceLErator Simulator (SCALE Sim) v2

Documentation Status

SCALE Sim is a simulator for systolic array based accelerators for Convolution, Feed Forward, and any layer that uses GEMMs. This is a refreshed version of the simulator with feature enhancements, restructured code to aid feature additions, and ease of distribution.

scalesim overview

The previous version of the simulator can be found here.

Getting started in 30 seconds

Installing the package

Getting started is simple! SCALE-Sim is completely written in python and is available both as a package and could be run from source.

You can install SCALE-Sim in your environment using the following command

$ pip3 install scalesim

Alternatively you can install the package from the source as well

$ python3 setup.py install

Launching a run

SCALE-Sim can be run by using the scale.py script from the repository and providing the paths to the architecture configuration, and the topology descriptor csv file.

$ python3 scale.py -c <path_to_config_file> -t <path_to_topology_file> -p <path_to_output_log_dir>

Try it now in this jupyter notebook.

Running from source

The above method uses the installed package for running the simulator. In cases where you would like to run directly from the source, the following command should be used instead.

$ python3 <scale_sim_repo_root>/scalesim/scale.py -c <path_to_config_file> -t <path_to_topology_file>

If you are running from sources for the first time and do not have all the dependencies installed, please install them first using the following command.

$ pip3 install -r <scale_sim_repo_root>/requirements.txt

Tool inputs

SCALE-Sim uses two input files to run, a configuration file and a topology file.

Configuration file

The configuration file is used to specify the architecture and run parameters for the simulations. The following shows a sample config file:

sample config

The config file has three sections. The "general" section specifies the run name, which is user specific. The "architecture_presets" section describes the parameter of the systolic array hardware to simulate. The "run_preset" section specifies if the simulator should run with user specified bandwidth, or should it calculate the optimal bandwidth for stall free execution.

The detailed documentation for the config file could be found here (TBD)

Topology file

The topology file is a CSV file which decribes the layers of the workload topology. The layers are typically described as convolution layer parameters as shown in the example below.

sample topo

For other layer types, SCALE-Sim also accepts the workload desciption in M, N, K format of the equivalent GEMM operation as shown in the example below.

sample mnk topo

The tool however expects the inputs to be in the convolution format by default. When using the mnk format for input, please specify using the -i gemm switch, as shown in the example below.

$ python3 <scale sim repo root>/scalesim/scale.py -c <path_to_config_file> -t <path_to_mnk_topology_file> -i gemm

Output

Here is an example output dumped to stdout when running Yolo Tiny (whose configuration is in yolo_tiny.csv): screen_out

Also, the simulator generates read write traces and summary logs at <run_dir>/../scalesim_outputs/. The user can also provide a custom location using -p <custom_output_directory> when using scalesim.py file. There are three summary logs:

  • COMPUTE_REPORT.csv: Layer wise logs for compute cycles, stalls, utilization percentages etc.
  • BANDWIDTH_REPORT.csv: Layer wise information about average and maximum bandwidths for each operand when accessing SRAM and DRAM
  • DETAILED_ACCESS_REPORT.csv: Layer wise information about number of accesses and access cycles for each operand for SRAM and DRAM.

In addition cycle accurate SRAM/DRAM access logs are also dumped and could be accesses at <outputs_dir>/<run_name>/ eg <run_dir>/../scalesim_outputs/<run_name>

Detailed Documentation

Detailed documentation about the tool can be found here.

We also recommend referring to the following papers for insights on SCALE-Sim's potential.

[1] Samajdar, A., Zhu, Y., Whatmough, P., Mattina, M., & Krishna, T.; "Scale-sim: Systolic cnn accelerator simulator." arXiv preprint arXiv:1811.02883 (2018). [pdf]

[2] Samajdar, A., Joseph, J. M., Zhu, Y., Whatmough, P., Mattina, M., & Krishna, T.; "A systematic methodology for characterizing scalability of DNN accelerators using SCALE-sim". In 2020 IEEE International Symposium on Performance Analysis of Systems and Software (ISPASS). [pdf]

Citing this work

If you found this tool useful, please use the following bibtex to cite us

@article{samajdar2018scale,
  title={SCALE-Sim: Systolic CNN Accelerator Simulator},
  author={Samajdar, Ananda and Zhu, Yuhao and Whatmough, Paul and Mattina, Matthew and Krishna, Tushar},
  journal={arXiv preprint arXiv:1811.02883},
  year={2018}
}

@inproceedings{samajdar2020systematic,
  title={A systematic methodology for characterizing scalability of DNN accelerators using SCALE-sim},
  author={Samajdar, Ananda and Joseph, Jan Moritz and Zhu, Yuhao and Whatmough, Paul and Mattina, Matthew and Krishna, Tushar},
  booktitle={2020 IEEE International Symposium on Performance Analysis of Systems and Software (ISPASS)},
  pages={58--68},
  year={2020},
  organization={IEEE}
}

Contributing to the project

We are happy for your contributions and would love to merge new features into our stable codebase. To ensure continuity within the project, please consider the following workflow.

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a build. Please do not commit temporary files to the repo.
  2. Update the documentation in the documentation/-folder with details of changes to the interface, this includes new environment variables, exposed ports, useful file locations and container parameters.
  3. Add a tutorial how to use your new feature in form of a jupyter notebook to the documentation, as well. This makes sure that others can use your code!
  4. Add test cases to our unit test system for your contribution.
  5. Increase the version numbers in any example’s files and the README.md to the new version that this Pull Request would represent. The versioning scheme we use is SemVer. Add your changes to the CHANGELOG.md. Address the issue numbers that you are solving.
  6. You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you.

Developers

Main devs:

  • Ananda Samajdar (@AnandS09)
  • Jan Moritz Joseph (@jmjos)

Contributers:

  • Ritik Raj (@ritikraj7)

Maintainers and Advisors

  • Yuhao Zhu
  • Paul Whatmough
  • Tushar Krishna

Past contributors

  • Vineet Nadella
  • Sachit Kuhar

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scalesim-2.0.2.tar.gz (37.4 kB view details)

Uploaded Source

Built Distribution

scalesim-2.0.2-py3-none-any.whl (48.9 kB view details)

Uploaded Python 3

File details

Details for the file scalesim-2.0.2.tar.gz.

File metadata

  • Download URL: scalesim-2.0.2.tar.gz
  • Upload date:
  • Size: 37.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for scalesim-2.0.2.tar.gz
Algorithm Hash digest
SHA256 9440edeb68201963e47ae141479fc1f3011036769be9fa3c73ecc7c6c5c48013
MD5 28419f0ff69d577a68f995194ed61141
BLAKE2b-256 ea5a2104378a041580b1fe3f766a2b3992fbb9b7ce8b01e4ca115761400c3f8c

See more details on using hashes here.

File details

Details for the file scalesim-2.0.2-py3-none-any.whl.

File metadata

  • Download URL: scalesim-2.0.2-py3-none-any.whl
  • Upload date:
  • Size: 48.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for scalesim-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 513924810c5191b69c74084839bb378df9b83628ee07067a3e390e5f3ff2afc1
MD5 2e3bf2ea628ae56aee36462a388ead1b
BLAKE2b-256 7d463c4c29a5f00a9748399f983bf83dd7d021c436d69a011a2d18241977a597

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page