Skip to content

Commit 30251e0

Browse files
authored
Updated Documentation and Added force_adjustment_voltage and failure_iteration_threshold Arguments for 1.1.6 Release (#128)
- Updated ReadTheDocs Documentation. - Updated README.md. - Added BiBTeX entry for the paper which can be used to cite the corresponding OSP paper. - Added `force_adjustment_voltage` and `failure_iteration_threshold` Arguments to `memtorch.bh.Crossbar.write_conductance_matrix` and associated bindings.
1 parent 4ce968b commit 30251e0

File tree

15 files changed

+739
-509
lines changed

15 files changed

+739
-509
lines changed

.github/workflows/build_release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ jobs:
4545
- name: Build wheels
4646
run: python -m cibuildwheel --output-dir wheelhouse
4747
env:
48-
CIBW_BEFORE_BUILD_WINDOWS: pip3 install torch==1.9.0+cpu -f https://download.pytorch.org/whl/torch_stable.html --ignore-installed
49-
CIBW_BEFORE_BUILD_MACOS: pip3 install torch==1.9.0 -f https://download.pytorch.org/whl/torch_stable.html --ignore-installed
50-
CIBW_BEFORE_BUILD_LINUX: pip3 install torch==1.9.0+cpu -f https://download.pytorch.org/whl/torch_stable.html --ignore-installed
48+
CIBW_BEFORE_BUILD_WINDOWS: pip3 install torch==1.10.0+cpu -f https://download.pytorch.org/whl/torch_stable.html --ignore-installed
49+
CIBW_BEFORE_BUILD_MACOS: pip3 install torch==1.10.0 -f https://download.pytorch.org/whl/torch_stable.html --ignore-installed
50+
CIBW_BEFORE_BUILD_LINUX: pip3 install torch==1.10.0+cpu -f https://download.pytorch.org/whl/torch_stable.html --ignore-installed
5151
CIBW_REPAIR_WHEEL_COMMAND: ""
5252
CIBW_BUILD: cp37-* cp38-* cp39-*
5353
CIBW_SKIP: "*-manylinux_i686 *-win32"

CHANGELOG.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
## Added
2-
3-
1. Partial support for the `groups` argument for convolutional layers.
2+
1. The `random_crossbar_init` argument to memtorch.bh.Crossbar. If true, this is used to initialize crossbars to random device conductances in between 1/Ron and 1/Roff.
3+
2. `CUDA_device_idx` to `setup.py` to allow users to specify the `CUDA` device to use when installing `MemTorch` from source.
4+
3. Implementations of CUDA accelerated passive crossbar programming routines for the 2021 Data-Driven model.
5+
4. A BiBTeX entry, which can be used to cite the corresponding OSP paper.
46

57
## Fixed
6-
7-
1. Patching procedure in `memtorch.mn.module.patch_model` and `memtorch.bh.nonideality.apply_nonidealities` to fix semantic error in `Tutorial.ipynb`.
8-
2. Import statement in `Exemplar_Simulations.ipynb`.
8+
1. In the getting started tutorial, Section 4.1 was a code cell. This has since been converted to a markdown cell.
9+
2. OOM errors encountered when modeling passive inference routines of crossbars.
910

1011
## Enhanced
1112

12-
1. Further modularized patching logic in `memtorch.bh.nonideality.NonIdeality` and `memtorch.mn.Module`.
13-
2. Modified default number of worker in `memtorch.utils` from 2 to 1.
13+
1. Templated quantize bindings and fixed semantic error in `memtorch.bh.nonideality.FiniteConductanceStates`.
14+
2. The memory consumption when modeling passive inference routines.
15+
3. The sparse factorization method used to solve sparse linear matrix systems.
16+
4. The `naive_program` routine for crossbar programming. The maximum number of crossbar programming iterations is now configurable.
17+
5. Updated ReadTheDocs documentation for `memtorch.bh.Crossbar`.
18+
6. Updated the version of `PyTorch` used to build Python wheels from `1.9.0` to `1.10.0`.

README.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
[![codecov](https://codecov.io/gh/coreylammie/MemTorch/branch/master/graph/badge.svg)](https://codecov.io/gh/coreylammie/MemTorch)
1414
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
1515

16-
MemTorch is a _Simulation Framework for Memristive Deep Learning Systems_, which integrates directly with the well-known PyTorch Machine Learning (ML) library. MemTorch is formally described in _MemTorch: An Open-source Simulation Framework for Memristive Deep Learning Systems_, which is openly accessible [here](https://arxiv.org/abs/2004.10971).
16+
MemTorch is a _Simulation Framework for Memristive Deep Learning Systems_, which integrates directly with the well-known PyTorch Machine Learning (ML) library. MemTorch is formally described in _MemTorch: An Open-source Simulation Framework for Memristive Deep Learning Systems_, which is openly accessible [here](https://arxiv.org/abs/2004.10971).
17+
18+
_MemTorch: An Open-source Simulation Framework for Memristive Deep Learning Systems_ has been published as an Original Software Publication (OSP) in the *Neurocomputing* journal [here](https://doi.org/10.1016/j.neucom.2022.02.043). We kindly ask that the following [BibTeX entry](https://github.com/coreylammie/MemTorch/blob/master/citation.bib?raw=True) is used to cite MemTorch, if you use it in your work.
1719

1820
![Overview](https://github.com/coreylammie/MemTorch/blob/master/overview.svg)
1921

@@ -81,14 +83,15 @@ _Be sure to merge the latest from 'upstream' before making a pull request_. This
8183
To cite _MemTorch: An Open-source Simulation Framework for Memristive Deep Learning Systems_, use the following BibTex entry:
8284

8385
```
84-
@misc{lammie2020memtorch,
85-
title={{MemTorch: An Open-source Simulation Framework for Memristive Deep Learning Systems}},
86-
author={Corey Lammie and Wei Xiang and Bernab\'e Linares-Barranco and Mostafa Rahimi Azghadi},
87-
month=Apr.,
88-
year={2020},
89-
eprint={2004.10971},
90-
archivePrefix={arXiv},
91-
primaryClass={cs.ET}
86+
@Article{Lammie2022,
87+
author = {Corey Lammie and Wei Xiang and Bernabé Linares-Barranco and Mostafa Rahimi Azghadi},
88+
title = {{MemTorch: An Open-source Simulation Framework for Memristive Deep Learning Systems}},
89+
journal = {Neurocomputing},
90+
year = {2022},
91+
issn = {0925-2312},
92+
doi = {https://doi.org/10.1016/j.neucom.2022.02.043},
93+
keywords = {Memristors, RRAM, Non-Ideal Device Characteristics, Deep Learning, Simulation Framework},
94+
url = {https://www.sciencedirect.com/science/article/pii/S0925231222002053},
9295
}
9396
```
9497

citation.bib

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@Article{Lammie2022,
2+
author = {Corey Lammie and Wei Xiang and Bernabé Linares-Barranco and Mostafa Rahimi Azghadi},
3+
title = {{MemTorch: An Open-source Simulation Framework for Memristive Deep Learning Systems}},
4+
journal = {Neurocomputing},
5+
year = {2022},
6+
issn = {0925-2312},
7+
doi = {https://doi.org/10.1016/j.neucom.2022.02.043},
8+
keywords = {Memristors, RRAM, Non-Ideal Device Characteristics, Deep Learning, Simulation Framework},
9+
url = {https://www.sciencedirect.com/science/article/pii/S0925231222002053},
10+
}

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
# -- Project information -----------------------------------------------------
1818

1919
project = "MemTorch"
20-
copyright = "2021, Corey Lammie"
20+
copyright = "2022, Corey Lammie"
2121
author = "Corey Lammie"
2222

2323
# The full version, including alpha/beta/rc tags
24-
release = "1.1.5"
24+
release = "1.1.6"
2525
autodoc_inherit_docstrings = False
2626

2727
# -- General configuration ---------------------------------------------------

docs/memtorch.bh.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ Class used to model memristor crossbars and to manage modular crossbar tiles.
3030
.. note::
3131
**use_bindings** is enabled by default, to accelerate operation using C++/CUDA (if supported) bindings.
3232

33+
.. warning::
34+
As of version 1.1.6, the **write_conductance_matrix** method exhibits different behavior when **self.use_bindings** is True, **CUDA** operation is enabled, and the **Data_Driven2021** memristor model is used.
35+
36+
When **self.use_bindings** is True, **CUDA** operation is enabled, and the **Data_Driven2021** memristor model is used, the programming voltage is force adjusted by **force_adjustment_voltage** when a device becomes stuck.
37+
For all others models, or when **CUDA** operation is not enabled or **self.use_bindings** is false, the conductance state of the device being modelled is adjusted using **force_adjustment** when it becomes stuck.
38+
39+
This behavior will made consistent across Python, C++, and CUDA bindings, in a future release.
40+
3341
.. automodule:: memtorch.bh.crossbar.Crossbar
3442
:members:
3543
:undoc-members:

memtorch/bh/crossbar/Crossbar.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ def write_conductance_matrix(
210210
)
211211
else:
212212
raise Exception("Unsupported crossbar shape.")
213+
213214
if self.tile_shape is not None:
214215
conductance_matrix, tiles_map = gen_tiles(
215216
conductance_matrix,
@@ -232,7 +233,7 @@ def write_conductance_matrix(
232233
conductance_matrix = torch.max(
233234
torch.min(conductance_matrix.to(self.device), max), min
234235
)
235-
if transistor or programming_routine is None:
236+
if transistor:
236237
self.conductance_matrix = conductance_matrix
237238
self.max_abs_conductance = (
238239
torch.abs(self.conductance_matrix).flatten().max()
@@ -265,6 +266,9 @@ def write_conductance_matrix(
265266
)
266267
self.update(from_devices=False)
267268
else:
269+
assert (
270+
programming_routine is not None
271+
), "If memtorch_cuda_bindings.simulate_passive is not used, a programming routine must be provided."
268272
if self.tile_shape is not None:
269273
for i in range(0, self.devices.shape[0]):
270274
for j in range(0, self.devices.shape[1]):

memtorch/bh/crossbar/Program.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def naive_program(
2222
force_adjustment_rel_tol=1e-1,
2323
force_adjustment_pos_voltage_threshold=0,
2424
force_adjustment_neg_voltage_threshold=0,
25+
failure_iteration_threshold=1000,
2526
simulate_neighbours=True,
2627
):
2728
"""Method to program (alter) the conductance of a given device within a crossbar.
@@ -54,6 +55,8 @@ def naive_program(
5455
Positive voltage level threshold (V) to enable force adjustment.
5556
force_adjustment_neg_voltage_threshold : float
5657
Negative voltage level threshold (V) to enable force adjustment.
58+
failure_iteration_threshold : int
59+
Failure iteration threshold.
5760
simulate_neighbours : bool
5861
Simulate neighbours (True).
5962
@@ -142,7 +145,7 @@ def naive_program(
142145
)
143146

144147
iterations += 1
145-
if iterations % 100 == 0 and time.time() > timeout:
148+
if iterations >= failure_iteration_threshold and time.time() > timeout:
146149
warnings.warn("Failed to program device to rel_tol (%f)." % rel_tol)
147150
break
148151

0 commit comments

Comments
 (0)