# PyTorch Perf
<p align="left">
<a href="https://opensource.org/licenses/BSD-3-Clause"><img alt="License" src="https://img.shields.io/badge/License-BSD_3--Clause-blue.svg"></a>
<a href="https://pypi.org/project/pytorch-perf/"><img alt="PyPI" src="https://img.shields.io/pypi/v/pytorch-perf"></a>
<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
<a href="https://colab.research.google.com/drive/1g2U51MqC-MjO1zeCg9X5koWLYuzt4aFr?usp=sharing"><img alt="Colab Demo" src="https://colab.research.google.com/assets/colab-badge.svg"></a>
</p>
## Install
```
pip install -U pytorch-perf
```
To verify a successful installation:
```
python -c "from torchperf import info; info.show()"
```
## Usage
```python
import torch
from torchperf import perf, info
info.show()
N = 100
x = torch.rand(N, N, device="cuda")
results = []
repeats = 100
@perf(o=results, n=repeats)
def mul(x, y):
return x * y
z = mul(x, x)
print(results[:5])
print("avg:", sum(results)/len(results))
@perf(n=repeats)
def mul(x, y):
return x * y
z = mul(x, x)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/yhren/torchperf",
"name": "pytorch-perf",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "decorator cuda performance perf pytorch",
"author": "Yihui Ren",
"author_email": "yren@bnl.gov",
"download_url": "https://files.pythonhosted.org/packages/3d/c0/f765a6763cd9a3e13bdfca7ff6459de25175e6da6abcae357ae1a54e51be/pytorch-perf-0.0.3.tar.gz",
"platform": null,
"description": "# PyTorch Perf\n\n<p align=\"left\">\n<a href=\"https://opensource.org/licenses/BSD-3-Clause\"><img alt=\"License\" src=\"https://img.shields.io/badge/License-BSD_3--Clause-blue.svg\"></a>\n<a href=\"https://pypi.org/project/pytorch-perf/\"><img alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/pytorch-perf\"></a>\n<a href=\"https://github.com/psf/black\"><img alt=\"Code style: black\" src=\"https://img.shields.io/badge/code%20style-black-000000.svg\"></a>\n<a href=\"https://colab.research.google.com/drive/1g2U51MqC-MjO1zeCg9X5koWLYuzt4aFr?usp=sharing\"><img alt=\"Colab Demo\" src=\"https://colab.research.google.com/assets/colab-badge.svg\"></a>\n</p>\n\n\n## Install\n\n```\npip install -U pytorch-perf\n```\n\nTo verify a successful installation:\n```\npython -c \"from torchperf import info; info.show()\"\n```\n\n## Usage\n\n```python\nimport torch\nfrom torchperf import perf, info\n\ninfo.show()\n\nN = 100\nx = torch.rand(N, N, device=\"cuda\")\nresults = []\nrepeats = 100\n\n@perf(o=results, n=repeats)\ndef mul(x, y):\n return x * y\n\nz = mul(x, x)\nprint(results[:5])\nprint(\"avg:\", sum(results)/len(results))\n\n\n@perf(n=repeats)\ndef mul(x, y):\n return x * y\n\nz = mul(x, x)\n\n```\n\n",
"bugtrack_url": null,
"license": "BSD-3",
"summary": "A pytorch perf decorator",
"version": "0.0.3",
"project_urls": {
"Homepage": "https://github.com/yhren/torchperf"
},
"split_keywords": [
"decorator",
"cuda",
"performance",
"perf",
"pytorch"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f1832a5ee03fa224d124e8ef161e59a3f389ec2b6b1b30545000e64af1172049",
"md5": "8e11cb9992e381ce489ddc7b3eac9535",
"sha256": "32c407cee223e93b713bb43878712048e954ca5ea7e09991fa236a60bf940a5c"
},
"downloads": -1,
"filename": "pytorch_perf-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8e11cb9992e381ce489ddc7b3eac9535",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 5379,
"upload_time": "2023-07-21T20:32:36",
"upload_time_iso_8601": "2023-07-21T20:32:36.502897Z",
"url": "https://files.pythonhosted.org/packages/f1/83/2a5ee03fa224d124e8ef161e59a3f389ec2b6b1b30545000e64af1172049/pytorch_perf-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3dc0f765a6763cd9a3e13bdfca7ff6459de25175e6da6abcae357ae1a54e51be",
"md5": "b58680bfbe4205bb923f6b3e897b1938",
"sha256": "77372c9c008a5c1725c62322cecbb2e58270b54f9787536fa61c01b7d6de0777"
},
"downloads": -1,
"filename": "pytorch-perf-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "b58680bfbe4205bb923f6b3e897b1938",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 5613,
"upload_time": "2023-07-21T20:32:37",
"upload_time_iso_8601": "2023-07-21T20:32:37.931927Z",
"url": "https://files.pythonhosted.org/packages/3d/c0/f765a6763cd9a3e13bdfca7ff6459de25175e6da6abcae357ae1a54e51be/pytorch-perf-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-21 20:32:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "yhren",
"github_project": "torchperf",
"github_not_found": true,
"lcname": "pytorch-perf"
}