# cumm
CUda Matrix Multiply library.
[![Build Status](https://github.com/FindDefinition/cumm/workflows/build/badge.svg)](https://github.com/FindDefinition/cumm/actions?query=workflow%3Abuild)
```cumm``` is developed during learning of [CUTLASS](https://github.com/NVIDIA/cutlass), which use too much c++ template and make code unmaintainable. So I develop [pccm](https://github.com/FindDefinition/PCCM), use python as meta programming language, to replace c++ template meta programming.
Now ```pccm``` become a foundational framework of ```cumm``` and my other c++ project such as [spconv](https://github.com/traveller59/spconv).
```cumm``` also contains a python asyncio-based gemm simulator that **share same meta program** with CUDA code, enable gemm visualization and easy debug experience.
## BREAKING CHANGES
* 0.3.1: tv::DType enum value changed, this will affect all binary code of tv::Tensor user. you must recompile all code if upgrade to cumm >= 0.3.1.
## News
* Ampere feature support (by [EvernightAurora](https://github.com/EvernightAurora))
## Install
### Prebuilt
We offer python 3.7-3.11 and cuda 10.2/11.3/11.4/11.7/12.0 prebuilt binaries for linux (manylinux).
We offer python 3.7-3.11 and cuda 10.2/11.3/11.4/11.7/12.0 prebuilt binaries for windows 10/11.
```pip install cumm``` for CPU-only
```pip install cumm-cu102``` for CUDA 10.2
```pip install cumm-cu113``` for CUDA 11.3
```pip install cumm-cu114``` for CUDA 11.4
```pip install cumm-cu117``` for CUDA 11.7
```pip install cumm-cu120``` for CUDA 12.0
### Build from source for development (JIT, recommend for develop)
**WARNING** Use code in [tags](https://github.com/FindDefinition/cumm/releases)!!! code in main branch may contain bugs.
The c++ code will be built automatically when you change c++ code in project.
#### Linux
0. uninstall cumm installed by pip. you must ensure no "cumm" exists in ```pip list | grep cumm```
1. install build-essential, install CUDA
2. ```git clone https://github.com/FindDefinition/cumm```, ```cd ./cumm```, ```git checkout tags/<tag_name>```, ```pip install -e .```
3. in python, ```import cumm``` and wait for build finish.
#### Windows
0. uninstall spconv and cumm installed by pip. you must ensure no "cumm" exists in ```pip list | grep cumm```
1. install visual studio 2019 or newer. make sure C++ development component is installed. install CUDA
2. set [powershell script execution policy](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.1)
3. start a new powershell, run ```tools/msvc_setup.ps1```
4. ```git clone https://github.com/FindDefinition/cumm```, ```cd ./cumm```, ```git checkout tags/<tag_name>```, ```pip install -e .```
5. in python, ```import cumm``` and wait for build finish.
### Build wheel from source
**WARNING** Use code in [tags](https://github.com/FindDefinition/cumm/releases)!!! code in main branch may contain bugs.
**WARNING**: If ```CUMM_CUDA_VERSION``` is set with a CUDA version, following steps will create a wheel named "cumm-cuxxx", not "cumm", this means you must use ```cumm-cuxxx``` in dependency of your project which depend on cumm, not ```cumm```. If ```CUMM_CUDA_VERSION``` isn't set, ```cumm``` will always built with CUDA, so the CUDA must exists in your system. The wheel name will be ```cumm``` even if it is built with cuda.
#### Linux
It's recommend to build Linux packages in [official build docker](https://github.com/FindDefinition/cumm/blob/main/.github/workflows/build.yaml). Build with CUDA support don't need a real GPU.
##### Build in Official Docker
1. select a cuda version. available: CUDA 11.1, 11.3, 11.4, 11.5, 12.0
2. (Example for CUDA 11.4) ```git clone https://github.com/FindDefinition/cumm```, ```cd ./cumm```, ```docker run --rm -e PLAT=manylinux2014_x86_64 -e CUMM_CUDA_VERSION=114 -v `pwd`:/io scrin/manylinux2014-cuda:cu114-devel-1.0.0 bash -c "source /etc/bashrc && /io/tools/build-wheels.sh"```
##### Build in your environment
1. install build-essential, install CUDA
2. set env for installed cuda version. for example, ```export CUMM_CUDA_VERSION="11.4"```. If you want to build CPU-only, run ```export CUMM_CUDA_VERSION=""```. If ```CUMM_CUDA_VERSION``` isn't set, you need to ensure cuda libraries are inside OS search path, and the built wheel name will be ```cumm```, otherwise ```cumm-cuxxx```
3. run ```export CUMM_DISABLE_JIT="1"```
4. run ```python setup.py bdist_wheel```+```pip install dists/xxx.whl```
#### Windows 10/11
1. install visual studio 2019 or newer. make sure C++ development package is installed. install CUDA
2. set [powershell script execution policy](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.1)
3. start a new powershell, run ```tools/msvc_setup.ps1```
4. set env for installed cuda version. for example, ```$Env:CUMM_CUDA_VERSION = "11.4"```. If you want to build CPU-only, run ```$Env:CUMM_CUDA_VERSION = ""```. . If ```CUMM_CUDA_VERSION``` isn't set, you need to ensure cuda libraries are inside OS search path, and the built wheel name will be ```cumm```, otherwise ```cumm-cuxxx```
4. run ```$Env:CUMM_DISABLE_JIT = "1"```
5. run ```python setup.py bdist_wheel```+```pip install dists/xxx.whl```
## Contributers
* [EvernightAurora](https://github.com/EvernightAurora): add ampere feature.
## Note
The work is done when the author is an employee at [Tusimple](https://www.tusimple.com/).
## LICENSE
Apache 2.0
Raw data
{
"_id": null,
"home_page": "https://github.com/FindDefinition/cumm",
"name": "cumm-cu121",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "",
"author": "Yan Yan",
"author_email": "yanyan.sub@outlook.com",
"download_url": "",
"platform": null,
"description": "\r\n# cumm\r\nCUda Matrix Multiply library.\r\n\r\n[![Build Status](https://github.com/FindDefinition/cumm/workflows/build/badge.svg)](https://github.com/FindDefinition/cumm/actions?query=workflow%3Abuild)\r\n\r\n```cumm``` is developed during learning of [CUTLASS](https://github.com/NVIDIA/cutlass), which use too much c++ template and make code unmaintainable. So I develop [pccm](https://github.com/FindDefinition/PCCM), use python as meta programming language, to replace c++ template meta programming. \r\nNow ```pccm``` become a foundational framework of ```cumm``` and my other c++ project such as [spconv](https://github.com/traveller59/spconv). \r\n```cumm``` also contains a python asyncio-based gemm simulator that **share same meta program** with CUDA code, enable gemm visualization and easy debug experience.\r\n\r\n## BREAKING CHANGES\r\n\r\n* 0.3.1: tv::DType enum value changed, this will affect all binary code of tv::Tensor user. you must recompile all code if upgrade to cumm >= 0.3.1.\r\n\r\n## News\r\n\r\n* Ampere feature support (by [EvernightAurora](https://github.com/EvernightAurora))\r\n\r\n## Install\r\n\r\n### Prebuilt\r\n\r\nWe offer python 3.7-3.11 and cuda 10.2/11.3/11.4/11.7/12.0 prebuilt binaries for linux (manylinux).\r\n\r\nWe offer python 3.7-3.11 and cuda 10.2/11.3/11.4/11.7/12.0 prebuilt binaries for windows 10/11.\r\n\r\n```pip install cumm``` for CPU-only\r\n\r\n```pip install cumm-cu102``` for CUDA 10.2\r\n\r\n```pip install cumm-cu113``` for CUDA 11.3\r\n\r\n```pip install cumm-cu114``` for CUDA 11.4\r\n\r\n```pip install cumm-cu117``` for CUDA 11.7\r\n\r\n```pip install cumm-cu120``` for CUDA 12.0\r\n\r\n### Build from source for development (JIT, recommend for develop)\r\n\r\n**WARNING** Use code in [tags](https://github.com/FindDefinition/cumm/releases)!!! code in main branch may contain bugs.\r\n\r\nThe c++ code will be built automatically when you change c++ code in project.\r\n\r\n#### Linux\r\n\r\n0. uninstall cumm installed by pip. you must ensure no \"cumm\" exists in ```pip list | grep cumm```\r\n1. install build-essential, install CUDA\r\n2. ```git clone https://github.com/FindDefinition/cumm```, ```cd ./cumm```, ```git checkout tags/<tag_name>```, ```pip install -e .```\r\n3. in python, ```import cumm``` and wait for build finish.\r\n\r\n#### Windows\r\n0. uninstall spconv and cumm installed by pip. you must ensure no \"cumm\" exists in ```pip list | grep cumm```\r\n1. install visual studio 2019 or newer. make sure C++ development component is installed. install CUDA\r\n2. set [powershell script execution policy](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.1)\r\n3. start a new powershell, run ```tools/msvc_setup.ps1```\r\n4. ```git clone https://github.com/FindDefinition/cumm```, ```cd ./cumm```, ```git checkout tags/<tag_name>```, ```pip install -e .```\r\n5. in python, ```import cumm``` and wait for build finish.\r\n\r\n### Build wheel from source \r\n\r\n**WARNING** Use code in [tags](https://github.com/FindDefinition/cumm/releases)!!! code in main branch may contain bugs.\r\n\r\n**WARNING**: If ```CUMM_CUDA_VERSION``` is set with a CUDA version, following steps will create a wheel named \"cumm-cuxxx\", not \"cumm\", this means you must use ```cumm-cuxxx``` in dependency of your project which depend on cumm, not ```cumm```. If ```CUMM_CUDA_VERSION``` isn't set, ```cumm``` will always built with CUDA, so the CUDA must exists in your system. The wheel name will be ```cumm``` even if it is built with cuda.\r\n\r\n#### Linux\r\n\r\nIt's recommend to build Linux packages in [official build docker](https://github.com/FindDefinition/cumm/blob/main/.github/workflows/build.yaml). Build with CUDA support don't need a real GPU.\r\n\r\n##### Build in Official Docker\r\n\r\n1. select a cuda version. available: CUDA 11.1, 11.3, 11.4, 11.5, 12.0\r\n2. (Example for CUDA 11.4) ```git clone https://github.com/FindDefinition/cumm```, ```cd ./cumm```, ```docker run --rm -e PLAT=manylinux2014_x86_64 -e CUMM_CUDA_VERSION=114 -v `pwd`:/io scrin/manylinux2014-cuda:cu114-devel-1.0.0 bash -c \"source /etc/bashrc && /io/tools/build-wheels.sh\"```\r\n\r\n##### Build in your environment\r\n\r\n1. install build-essential, install CUDA\r\n2. set env for installed cuda version. for example, ```export CUMM_CUDA_VERSION=\"11.4\"```. If you want to build CPU-only, run ```export CUMM_CUDA_VERSION=\"\"```. If ```CUMM_CUDA_VERSION``` isn't set, you need to ensure cuda libraries are inside OS search path, and the built wheel name will be ```cumm```, otherwise ```cumm-cuxxx```\r\n3. run ```export CUMM_DISABLE_JIT=\"1\"```\r\n4. run ```python setup.py bdist_wheel```+```pip install dists/xxx.whl```\r\n\r\n#### Windows 10/11\r\n\r\n1. install visual studio 2019 or newer. make sure C++ development package is installed. install CUDA\r\n2. set [powershell script execution policy](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.1)\r\n3. start a new powershell, run ```tools/msvc_setup.ps1```\r\n4. set env for installed cuda version. for example, ```$Env:CUMM_CUDA_VERSION = \"11.4\"```. If you want to build CPU-only, run ```$Env:CUMM_CUDA_VERSION = \"\"```. . If ```CUMM_CUDA_VERSION``` isn't set, you need to ensure cuda libraries are inside OS search path, and the built wheel name will be ```cumm```, otherwise ```cumm-cuxxx```\r\n4. run ```$Env:CUMM_DISABLE_JIT = \"1\"```\r\n5. run ```python setup.py bdist_wheel```+```pip install dists/xxx.whl```\r\n\r\n## Contributers\r\n\r\n* [EvernightAurora](https://github.com/EvernightAurora): add ampere feature.\r\n\r\n## Note\r\nThe work is done when the author is an employee at [Tusimple](https://www.tusimple.com/).\r\n\r\n## LICENSE\r\n\r\nApache 2.0\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "CUda Matrix Multiply library",
"version": "0.5.1",
"project_urls": {
"Homepage": "https://github.com/FindDefinition/cumm"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "dc5aec904529783cffd7b5e92a60f488fbaf9d291f819fc7e682cc64927b0cf8",
"md5": "fc9631b2e7fc5037bf982b9b79f9262b",
"sha256": "baa8b6c6922f6a7948f0ea66ae1b787f06a1c17637a733bb294bb4e70b80602a"
},
"downloads": -1,
"filename": "cumm_cu121-0.5.1-cp310-cp310-win_amd64.whl",
"has_sig": false,
"md5_digest": "fc9631b2e7fc5037bf982b9b79f9262b",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.6",
"size": 1160831,
"upload_time": "2023-12-26T04:13:48",
"upload_time_iso_8601": "2023-12-26T04:13:48.308154Z",
"url": "https://files.pythonhosted.org/packages/dc/5a/ec904529783cffd7b5e92a60f488fbaf9d291f819fc7e682cc64927b0cf8/cumm_cu121-0.5.1-cp310-cp310-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "09df73554f94e2a4a1e3d5db71ccf47209dc0d2be6804535d6a37c61918c75b4",
"md5": "5c466bcb50b512b212b46e79531577b2",
"sha256": "266c4b81d071ec6bce5cd8b51263935417dff012c6e4ba0dd499b6cb28a3de5b"
},
"downloads": -1,
"filename": "cumm_cu121-0.5.1-cp311-cp311-win_amd64.whl",
"has_sig": false,
"md5_digest": "5c466bcb50b512b212b46e79531577b2",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.6",
"size": 1162238,
"upload_time": "2023-12-26T04:11:39",
"upload_time_iso_8601": "2023-12-26T04:11:39.997775Z",
"url": "https://files.pythonhosted.org/packages/09/df/73554f94e2a4a1e3d5db71ccf47209dc0d2be6804535d6a37c61918c75b4/cumm_cu121-0.5.1-cp311-cp311-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "fece7e6d0335911a9e4e394e57b574e16e01b25a3e6e91c670a15380f3e7fe15",
"md5": "3f5b21c384000a836898c8027fddeee9",
"sha256": "77de8523466bf3092bc1021ef137f6610f063653662221645e227d8007961c34"
},
"downloads": -1,
"filename": "cumm_cu121-0.5.1-cp312-cp312-win_amd64.whl",
"has_sig": false,
"md5_digest": "3f5b21c384000a836898c8027fddeee9",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": ">=3.6",
"size": 1160832,
"upload_time": "2023-12-26T04:10:43",
"upload_time_iso_8601": "2023-12-26T04:10:43.866672Z",
"url": "https://files.pythonhosted.org/packages/fe/ce/7e6d0335911a9e4e394e57b574e16e01b25a3e6e91c670a15380f3e7fe15/cumm_cu121-0.5.1-cp312-cp312-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "81d994faab4482e7aa144e238ce9f988c953c9b8a6fdbdfcc93daf11a29cc1a1",
"md5": "5c67970e62189fe1c88719a6c73c45eb",
"sha256": "351a2ba043f783e6989aabe9a5e7de848deb0004a9385e3505f7a067f0ef1657"
},
"downloads": -1,
"filename": "cumm_cu121-0.5.1-cp38-cp38-win_amd64.whl",
"has_sig": false,
"md5_digest": "5c67970e62189fe1c88719a6c73c45eb",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.6",
"size": 1160623,
"upload_time": "2023-12-26T04:12:03",
"upload_time_iso_8601": "2023-12-26T04:12:03.771584Z",
"url": "https://files.pythonhosted.org/packages/81/d9/94faab4482e7aa144e238ce9f988c953c9b8a6fdbdfcc93daf11a29cc1a1/cumm_cu121-0.5.1-cp38-cp38-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "27fcc93f6abbe426a19da4c5d5ae15dae231fe63ce3875074951f317e445042d",
"md5": "e5f8ddc3af6b9a14de5cafa687b524fb",
"sha256": "25c2b98eb71ff94ac0c2859088dc994e4403df8e91beb99b951e58ca8c1cba2a"
},
"downloads": -1,
"filename": "cumm_cu121-0.5.1-cp39-cp39-win_amd64.whl",
"has_sig": false,
"md5_digest": "e5f8ddc3af6b9a14de5cafa687b524fb",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.6",
"size": 1161025,
"upload_time": "2023-12-26T04:12:43",
"upload_time_iso_8601": "2023-12-26T04:12:43.317116Z",
"url": "https://files.pythonhosted.org/packages/27/fc/c93f6abbe426a19da4c5d5ae15dae231fe63ce3875074951f317e445042d/cumm_cu121-0.5.1-cp39-cp39-win_amd64.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-26 04:13:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "FindDefinition",
"github_project": "cumm",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "cumm-cu121"
}