{"id":13521803,"url":"https://github.com/spcl/daceml","last_synced_at":"2025-09-10T14:38:39.721Z","repository":{"id":38041107,"uuid":"292278650","full_name":"spcl/daceml","owner":"spcl","description":"A Data-Centric Compiler for Machine Learning","archived":false,"fork":false,"pushed_at":"2024-01-03T22:00:46.000Z","size":4606,"stargazers_count":81,"open_issues_count":22,"forks_count":15,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-11-02T05:32:59.744Z","etag":null,"topics":["compiler","cuda","deep-learning","fpga","high-performance-computing","machine-learning","pytorch"],"latest_commit_sha":null,"homepage":"https://daceml.readthedocs.io","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/spcl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-02T12:37:02.000Z","updated_at":"2024-08-22T12:04:41.000Z","dependencies_parsed_at":"2024-11-02T05:32:09.024Z","dependency_job_id":"cb511ad2-7ecb-46f8-b1a3-6d41307cb36c","html_url":"https://github.com/spcl/daceml","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spcl%2Fdaceml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spcl%2Fdaceml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spcl%2Fdaceml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spcl%2Fdaceml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spcl","download_url":"https://codeload.github.com/spcl/daceml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223283917,"owners_count":17119575,"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":["compiler","cuda","deep-learning","fpga","high-performance-computing","machine-learning","pytorch"],"created_at":"2024-08-01T06:00:38.161Z","updated_at":"2024-11-06T04:27:22.680Z","avatar_url":"https://github.com/spcl.png","language":"Python","funding_links":[],"categories":["Open Source Projects"],"sub_categories":[],"readme":"![CPU CI](https://github.com/spcl/daceml/workflows/CPU%20CI/badge.svg)\n![GPU CI](https://github.com/spcl/daceml/workflows/GPU%20CI/badge.svg)\n[![codecov](https://codecov.io/gh/spcl/daceml/branch/master/graph/badge.svg)](https://codecov.io/gh/spcl/daceml)\n[![Documentation Status](https://readthedocs.org/projects/daceml/badge/?version=latest)](https://daceml.readthedocs.io/en/latest/?badge=latest)\n\n# DaCeML\n\n*Machine learning powered by data-centric parallel programming.*\n\nThis project adds PyTorch and ONNX model loading support to [DaCe](https://github.com/spcl/dace), and adds ONNX\n operator library nodes to the SDFG IR. With access to DaCe's rich transformation library and\nproductive development environment, **DaCeML can generate highly efficient implementations that can be executed on CPUs, GPUs\nand FPGAs.**\n\nThe white box approach allows us to see computation at **all levels of granularity**: from coarse operators, to kernel\nimplementations, and even down to every scalar operation and memory access.\n\nDaCeML can be used to achieve state of the art GPU performance on highly contested layers, such as BERT-fp16 or EfficientNet-B0. For more details, and other performance results, please see our [ICS'22 publication](https://arxiv.org/abs/2110.10802).\n\n![IR visual example](doc/ir.png)\n\n*Read more: [Library Nodes](https://daceml.readthedocs.io/en/latest/overviews/onnx.html#library-nodes)*\n## Integration\nConverting PyTorch modules is as easy as adding a decorator...\n```python\n@dace_module\nclass Model(nn.Module):\n    def __init__(self, kernel_size):\n        super().__init__()\n        self.conv1 = nn.Conv2d(1, 4, kernel_size)\n        self.conv2 = nn.Conv2d(4, 4, kernel_size)\n\n    def forward(self, x):\n        x = F.relu(self.conv1(x))\n        return F.relu(self.conv2(x))\n```\n... and ONNX models can also be directly imported using the model loader:\n```python\nmodel = onnx.load(model_path)\ndace_model = ONNXModel(\"mymodel\", model)\n```\n\n*Read more: [PyTorch Integration](https://daceml.readthedocs.io/en/latest/overviews/pytorch.html) and \n[Importing ONNX models](https://daceml.readthedocs.io/en/latest/overviews/onnx.html#importing-onnx-models).*\n\n## Training\nDaCeML modules support training using a symbolic automatic differentiation engine:\n```python\nimport torch.nn.functional as F\nfrom daceml.torch import dace_module\n\n@dace_module(backward=True)\nclass Net(nn.Module):\n    def __init__(self):\n        super().__init__()\n        self.fc1 = nn.Linear(784, 120)\n        self.fc2 = nn.Linear(120, 32)\n        self.fc3 = nn.Linear(32, 10)\n        self.ls = nn.LogSoftmax(dim=-1)\n\n    def forward(self, x):\n        x = F.relu(self.fc1(x))\n        x = F.relu(self.fc2(x))\n        x = self.fc3(x)\n        x = self.ls(x)\n        return x\n\nx = torch.randn(8, 784)\ny = torch.tensor([0, 1, 2, 3, 4, 5, 6, 7], dtype=torch.long)\n\nmodel = Net()\n\ncriterion = nn.NLLLoss()\nprediction = model(x)\nloss = criterion(prediction, y)\n# gradients can flow through model!\nloss.backward()\n```\n\n*Read more: [Automatic Differentiation](https://daceml.readthedocs.io/en/latest/overviews/autodiff.html)*.\n\n## Library Nodes\nDaCeML extends the DaCe IR with machine learning operators. The added nodes perform computation as specificed by the\nONNX specification. DaCeML leverages high performance kernels from ONNXRuntime, as well as pure SDFG implementations\nthat are introspectable and transformable with data centric transformations.\n\nThe nodes can be used from the DaCe python frontend.\n```python\nimport dace\nimport daceml.onnx as donnx\nimport numpy as np\n\n@dace.program\ndef conv_program(X_arr: dace.float32[5, 3, 10, 10],\n                 W_arr: dace.float32[16, 3, 3, 3]):\n    output = dace.define_local([5, 16, 4, 4], dace.float32)\n    donnx.ONNXConv(X=X_arr, W=W_arr, Y=output, strides=[2, 2])\n    return output\n\nX = np.random.rand(5, 3, 10, 10).astype(np.float32)\nW = np.random.rand(16, 3, 3, 3).astype(np.float32)\n\nresult = conv_program(X_arr=X, W_arr=W)\n```\n\n## Setup\nThe easiest way to get started is to run\n\n    make install\n    \nThis will setup DaCeML in a newly created virtual environment.\n\n*For more detailed instructions, including ONNXRuntime installation, see [Installation](https://daceml.readthedocs.io/en/latest/overviews/installation.html).*\n\n## Development\nCommon development tasks are automated using the `Makefile`. \nSee [Development](https://daceml.readthedocs.io/en/latest/overviews/development.html) for more information.\n\n## Citing\nIf you use DaCeML, please cite us:\n```bibtex\n@inproceedings{daceml,\n  author = {Rausch, Oliver and Ben-Nun, Tal and Dryden, Nikoli and Ivanov, Andrei and Li, Shigang and Hoefler, Torsten},\n  title = {{DaCeML}: A Data-Centric Optimization Framework for Machine Learning},\n  year = {2022},\n  booktitle = {Proceedings of the 36th ACM International Conference on Supercomputing},\n  series = {ICS '22}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspcl%2Fdaceml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspcl%2Fdaceml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspcl%2Fdaceml/lists"}