mnt.nanoplacer


Namemnt.nanoplacer JSON
Version 0.2.1 PyPI version JSON
download
home_page
SummaryNanoPlaceR - An open-source framework for placement and routing of Field-coupled Nanotechnologies based on reinforcement learning.
upload_time2024-01-18 16:54:49
maintainer
docs_urlNone
author
requires_python<=3.12
licenseMIT License Copyright (c) 2023 Chair for Design Automation, TU Munich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords fcn physical design
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PyPI](https://img.shields.io/pypi/v/mnt.nanoplacer?logo=pypi&style=flat-square)](https://pypi.org/project/mnt.nanoplacer/)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://opensource.org/licenses/MIT)
[![Bindings](https://img.shields.io/github/actions/workflow/status/cda-tum/mnt-nanoplacer/deploy.yml?branch=main&style=flat-square&logo=github&label=python)](https://github.com/cda-tum/mnt-nanoplacer/actions/workflows/deploy.yml)
[![Code style: black][black-badge]][black-link]

# NanoPlaceR: Placement and Routing for Field-coupled Nanocomputing (FCN) based on Reinforcement Learning

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/cda-tum/mnt-nanoplacer/main/docs/_static/mnt_light.svg" width="60%">
    <img src="https://raw.githubusercontent.com/cda-tum/mnt-nanoplacer/main/docs/_static/mnt_dark.svg" width="60%">
  </picture>
</p>

NanoPlaceR is a tool for the physical design of FCN circuitry based on Reinforcement Learning.
It can generate layouts for logic networks up to ~200 gates, while requiring ~50% less area than the state-of-the-art heuristic approach.

Related publication presented at DAC: [paper](https://www.cda.cit.tum.de/files/eda/2023_dac_late_breaking_results_from_hybrid_design_automation_for_field_coupled_nanotechnologies.pdf)

Inspired by recent developments in the field of machine learning-aided design automation, this tool combines reinforcement learning with efficient path routing algorithms based on established algorithms such as A\* search.
Masked Proximal Policy Optimization (PPO) is used to learn the placement of logic elements, which is further accelerated by incorporating an action mask computed based on the netlist structure and the last partial placement, ensuring valid and compact solutions.
To minimize the occurrence of unpromising partial placements, several checks constantly ensure the early termination of sub-par solutions.
Furthermore, the routing of placed gates is incorporated directly into the placement step using established routing strategies.
The following figure outlines the methodology:

![](https://raw.githubusercontent.com/cda-tum/mnt-nanoplacer/main/docs/_static/lbr.png)

# Usage of NanoPlaceR

Currently, due to the Open-AI gym dependency, only python versions up to 3.10 are supported.

If you do not have a virtual environment set up, the following steps outline one possible way to do so.
First, install virtualenv:

```console
$ pip install virtualenv
```

Then create a new virtual environment in your project folder and activate it:

```console
$ mkdir nano_placement
$ cd nano_placement
$ python -m venv venv
$ source venv/bin/activate
```

NanoPlaceR can be installed via pip:

```console
(venv) $ pip install mnt.nanoplacer
```

You can then create the desired layout based on specified parameters (e.g. logic function, clocking scheme, layout width etc.) directly in your pyhon project:

```
from mnt import nanoplacer

if __name__ == "__main__":
    nanoplacer.create_layout(
        benchmark="trindade16",
        function="mux21",
        clocking_scheme="2DDWave",
        technology="QCA",
        minimal_layout_dimension=False,
        layout_width=3,
        layout_height=4,
        time_steps=10000,
        reset_model=True,
        verbose=1,
        optimize=True,
    )
```

or via the command:

```
(venv) $ mnt.nanoplacer
usage: mnt.nanoplacer [-h] [-b {fontes18,trindade16,EPFL,TOY,ISCAS85}] [-f FUNCTION] [-c {2DDWave,USE, RES, ESR}] [-t {QCA,SiDB, Gate-level}] [-l] [-lw LAYOUT_WIDTH] [-lh LAYOUT_HEIGHT] [-ts TIME_STEPS] [-r] [-v {0,1, 2, 3}]
Optional arguments:
  -h, --help                       Show this help message and exit.
  -b, --benchmark                  Benchmark set.
  -f, --function                   Logic function to generate layout for.
  -c, --clocking_scheme            Underlying clocking scheme.
  -t, --technology                 Underlying technology (QCA, SiDB or technology-independent Gate-level layout).
  -l, --minimal_layout_dimension   If True, experimentally found minimal layout dimensions are used (defautls to False).
  -lw, --layout_width              User defined layout width.
  -lh, --layout_height             User defined layout height.
  -ts, --time_steps                Number of time steps to train the RL agent.
  -r,  --reset_model               If True, reset saved model and train from scratch (defautls to False).
  -v,  --verbosity                 0: No information. 1: Print layout after every new best placement. 2: Print training metrics. 3: 1 and 2 combined.
```

For example to create the gate-level layout for the mux21 function from trindade16 on the 2DDWave clocking scheme using the best found layout dimensions (by training for a maximum of 10000 timesteps):

```
mnt.nanoplacer -b "trindade16" -f "mux21" -c "2DDWave" -t "gate-level" -l -ts 10000 -v 1
```

# Repository Structure

```
.
├── docs/
├── src/
│ ├── mnt/
│   └── nanoplacer/
│     ├── main.py                         # entry point for mnt.bench script
│     ├── benchmarks/                     # common benchmark sets
│     ├── placement_envs/
│     │ └── utils/
│     │   ├── placement_utils/          # placement util functions
│     │   └── layout_dimenions/         # predefined layout dimensions for certain functions
│     └── nano_placement_env.py           # placement environment
```

# Monitoring Training

Training can be monitored using [Tensorboard](https://www.tensorflow.org/tensorboard).

Install it via

```console
(venv) $ pip install tensorboard
```

and run the following command from within the NanoPlaceR directory:

```console
(venv) $ tensorboard --logdir="tensorboard/{Insert function name here}"
```

# References

In case you are using NanoPlaceR in your work, we would be thankful if you referred to it by citing the following publication:

```bibtex
@INPROCEEDINGS{hofmann2023nanoplacer,
  author        = {S. Hofmann and M. Walter and L. Servadei and R. Wille},
  title         = {{Late Breaking Results From Hybrid Design Automation for Field-coupled Nanotechnologies}},
  booktitle     = {{Design Automation Conference (DAC)}},
  year          = {2023},
}
```

[black-badge]: https://img.shields.io/badge/code%20style-black-000000.svg
[black-link]: https://github.com/psf/black

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "mnt.nanoplacer",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "<=3.12",
    "maintainer_email": "",
    "keywords": "FCN,physical design",
    "author": "",
    "author_email": "Simon Hofmann <simon.t.hofmann@tum.de>",
    "download_url": "https://files.pythonhosted.org/packages/41/df/79e26294cce32f2f7453ce9b050bfd706781b82f16b6ea22df45aa0bee5f/mnt.nanoplacer-0.2.1.tar.gz",
    "platform": null,
    "description": "[![PyPI](https://img.shields.io/pypi/v/mnt.nanoplacer?logo=pypi&style=flat-square)](https://pypi.org/project/mnt.nanoplacer/)\n[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://opensource.org/licenses/MIT)\n[![Bindings](https://img.shields.io/github/actions/workflow/status/cda-tum/mnt-nanoplacer/deploy.yml?branch=main&style=flat-square&logo=github&label=python)](https://github.com/cda-tum/mnt-nanoplacer/actions/workflows/deploy.yml)\n[![Code style: black][black-badge]][black-link]\n\n# NanoPlaceR: Placement and Routing for Field-coupled Nanocomputing (FCN) based on Reinforcement Learning\n\n<p align=\"center\">\n  <picture>\n    <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/cda-tum/mnt-nanoplacer/main/docs/_static/mnt_light.svg\" width=\"60%\">\n    <img src=\"https://raw.githubusercontent.com/cda-tum/mnt-nanoplacer/main/docs/_static/mnt_dark.svg\" width=\"60%\">\n  </picture>\n</p>\n\nNanoPlaceR is a tool for the physical design of FCN circuitry based on Reinforcement Learning.\nIt can generate layouts for logic networks up to ~200 gates, while requiring ~50% less area than the state-of-the-art heuristic approach.\n\nRelated publication presented at DAC: [paper](https://www.cda.cit.tum.de/files/eda/2023_dac_late_breaking_results_from_hybrid_design_automation_for_field_coupled_nanotechnologies.pdf)\n\nInspired by recent developments in the field of machine learning-aided design automation, this tool combines reinforcement learning with efficient path routing algorithms based on established algorithms such as A\\* search.\nMasked Proximal Policy Optimization (PPO) is used to learn the placement of logic elements, which is further accelerated by incorporating an action mask computed based on the netlist structure and the last partial placement, ensuring valid and compact solutions.\nTo minimize the occurrence of unpromising partial placements, several checks constantly ensure the early termination of sub-par solutions.\nFurthermore, the routing of placed gates is incorporated directly into the placement step using established routing strategies.\nThe following figure outlines the methodology:\n\n![](https://raw.githubusercontent.com/cda-tum/mnt-nanoplacer/main/docs/_static/lbr.png)\n\n# Usage of NanoPlaceR\n\nCurrently, due to the Open-AI gym dependency, only python versions up to 3.10 are supported.\n\nIf you do not have a virtual environment set up, the following steps outline one possible way to do so.\nFirst, install virtualenv:\n\n```console\n$ pip install virtualenv\n```\n\nThen create a new virtual environment in your project folder and activate it:\n\n```console\n$ mkdir nano_placement\n$ cd nano_placement\n$ python -m venv venv\n$ source venv/bin/activate\n```\n\nNanoPlaceR can be installed via pip:\n\n```console\n(venv) $ pip install mnt.nanoplacer\n```\n\nYou can then create the desired layout based on specified parameters (e.g. logic function, clocking scheme, layout width etc.) directly in your pyhon project:\n\n```\nfrom mnt import nanoplacer\n\nif __name__ == \"__main__\":\n    nanoplacer.create_layout(\n        benchmark=\"trindade16\",\n        function=\"mux21\",\n        clocking_scheme=\"2DDWave\",\n        technology=\"QCA\",\n        minimal_layout_dimension=False,\n        layout_width=3,\n        layout_height=4,\n        time_steps=10000,\n        reset_model=True,\n        verbose=1,\n        optimize=True,\n    )\n```\n\nor via the command:\n\n```\n(venv) $ mnt.nanoplacer\nusage: mnt.nanoplacer [-h] [-b {fontes18,trindade16,EPFL,TOY,ISCAS85}] [-f FUNCTION] [-c {2DDWave,USE, RES, ESR}] [-t {QCA,SiDB, Gate-level}] [-l] [-lw LAYOUT_WIDTH] [-lh LAYOUT_HEIGHT] [-ts TIME_STEPS] [-r] [-v {0,1, 2, 3}]\nOptional arguments:\n  -h, --help                       Show this help message and exit.\n  -b, --benchmark                  Benchmark set.\n  -f, --function                   Logic function to generate layout for.\n  -c, --clocking_scheme            Underlying clocking scheme.\n  -t, --technology                 Underlying technology (QCA, SiDB or technology-independent Gate-level layout).\n  -l, --minimal_layout_dimension   If True, experimentally found minimal layout dimensions are used (defautls to False).\n  -lw, --layout_width              User defined layout width.\n  -lh, --layout_height             User defined layout height.\n  -ts, --time_steps                Number of time steps to train the RL agent.\n  -r,  --reset_model               If True, reset saved model and train from scratch (defautls to False).\n  -v,  --verbosity                 0: No information. 1: Print layout after every new best placement. 2: Print training metrics. 3: 1 and 2 combined.\n```\n\nFor example to create the gate-level layout for the mux21 function from trindade16 on the 2DDWave clocking scheme using the best found layout dimensions (by training for a maximum of 10000 timesteps):\n\n```\nmnt.nanoplacer -b \"trindade16\" -f \"mux21\" -c \"2DDWave\" -t \"gate-level\" -l -ts 10000 -v 1\n```\n\n# Repository Structure\n\n```\n.\n\u251c\u2500\u2500 docs/\n\u251c\u2500\u2500 src/\n\u2502 \u251c\u2500\u2500 mnt/\n\u2502   \u2514\u2500\u2500 nanoplacer/\n\u2502     \u251c\u2500\u2500 main.py                         # entry point for mnt.bench script\n\u2502     \u251c\u2500\u2500 benchmarks/                     # common benchmark sets\n\u2502     \u251c\u2500\u2500 placement_envs/\n\u2502     \u2502 \u2514\u2500\u2500 utils/\n\u2502     \u2502   \u251c\u2500\u2500 placement_utils/          # placement util functions\n\u2502     \u2502   \u2514\u2500\u2500 layout_dimenions/         # predefined layout dimensions for certain functions\n\u2502     \u2514\u2500\u2500 nano_placement_env.py           # placement environment\n```\n\n# Monitoring Training\n\nTraining can be monitored using [Tensorboard](https://www.tensorflow.org/tensorboard).\n\nInstall it via\n\n```console\n(venv) $ pip install tensorboard\n```\n\nand run the following command from within the NanoPlaceR directory:\n\n```console\n(venv) $ tensorboard --logdir=\"tensorboard/{Insert function name here}\"\n```\n\n# References\n\nIn case you are using NanoPlaceR in your work, we would be thankful if you referred to it by citing the following publication:\n\n```bibtex\n@INPROCEEDINGS{hofmann2023nanoplacer,\n  author        = {S. Hofmann and M. Walter and L. Servadei and R. Wille},\n  title         = {{Late Breaking Results From Hybrid Design Automation for Field-coupled Nanotechnologies}},\n  booktitle     = {{Design Automation Conference (DAC)}},\n  year          = {2023},\n}\n```\n\n[black-badge]: https://img.shields.io/badge/code%20style-black-000000.svg\n[black-link]: https://github.com/psf/black\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Chair for Design Automation, TU Munich  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "NanoPlaceR - An open-source framework for placement and routing of Field-coupled Nanotechnologies based on reinforcement learning.",
    "version": "0.2.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/cda-tum/NanoPlaceR/issues",
        "Discussions": "https://github.com/cda-tum/NanoPlaceR/discussions",
        "Homepage": "https://github.com/cda-tum/NanoPlaceR",
        "Research": "https://www.cda.cit.tum.de/research/fcn/"
    },
    "split_keywords": [
        "fcn",
        "physical design"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "41df79e26294cce32f2f7453ce9b050bfd706781b82f16b6ea22df45aa0bee5f",
                "md5": "47e692afa4815a9be8dd6134da0375c2",
                "sha256": "85135f0a2b452ee72d1a54a29ccf2b6e9921ee51696dc18941f2413624b3010d"
            },
            "downloads": -1,
            "filename": "mnt.nanoplacer-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "47e692afa4815a9be8dd6134da0375c2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<=3.12",
            "size": 4245138,
            "upload_time": "2024-01-18T16:54:49",
            "upload_time_iso_8601": "2024-01-18T16:54:49.032531Z",
            "url": "https://files.pythonhosted.org/packages/41/df/79e26294cce32f2f7453ce9b050bfd706781b82f16b6ea22df45aa0bee5f/mnt.nanoplacer-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-18 16:54:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cda-tum",
    "github_project": "NanoPlaceR",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "mnt.nanoplacer"
}
        
Elapsed time: 0.18554s