Name | memtracker JSON |
Version |
0.1.3
JSON |
| download |
home_page | |
Summary | A simple utility to track and log peak CPU and GPU memory usage of a function. |
upload_time | 2023-08-26 06:09:00 |
maintainer | |
docs_url | None |
author | MIBlue119 |
requires_python | |
license | |
keywords |
memory tracking
cpu
gpu
memory usage
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# memtracker
`memtracker` is a simple Python package to track and optionally log the peak CPU and GPU memory usage of a function.
- It would print the result at teminal
```
Peak CPU Memory for main: 491.31 MB
Peak GPU Total Memory for main: 0.00 MB
Runtime for main: 1.81 sec
```
- It would generate a json file, if you set `export_to_json=True`
```
{
"function_name": "main",
"function_runtime_sec": 1.6997389793395996,
"peak_cpu_memory_MB": 490.46875,
"peak_gpu_total_memory_MB": 0
}
```
## Installation
```bash
pip install memtracker
```
## Usage
```python
from memtracker.memory_sampler import track_peak_memory
#Then, use the track_peak_memory decorator on your function:
@track_peak_memory()
def my_function():
# Your function logic here
pass
```
- To export the memory metrics to a JSON file:
```python
@track_peak_memory(export_to_json=True)
def another_function():
# Your function logic here
pass
```
Raw data
{
"_id": null,
"home_page": "",
"name": "memtracker",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "memory tracking,CPU,GPU,memory usage",
"author": "MIBlue119",
"author_email": "miblue119@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/8b/a1/04d20ee01136a5ad63374538bcff0a3f56b0d3cfaf300297cf3ef8a6cbac/memtracker-0.1.3.tar.gz",
"platform": null,
"description": "# memtracker\n\n`memtracker` is a simple Python package to track and optionally log the peak CPU and GPU memory usage of a function.\n\n- It would print the result at teminal\n```\nPeak CPU Memory for main: 491.31 MB\nPeak GPU Total Memory for main: 0.00 MB\nRuntime for main: 1.81 sec\n```\n- It would generate a json file, if you set `export_to_json=True`\n```\n{\n \"function_name\": \"main\",\n \"function_runtime_sec\": 1.6997389793395996,\n \"peak_cpu_memory_MB\": 490.46875,\n \"peak_gpu_total_memory_MB\": 0\n}\n```\n## Installation\n\n```bash\npip install memtracker\n```\n\n## Usage\n```python\n\nfrom memtracker.memory_sampler import track_peak_memory\n\n#Then, use the track_peak_memory decorator on your function:\n\n@track_peak_memory()\ndef my_function():\n # Your function logic here\n pass\n```\n\n- To export the memory metrics to a JSON file:\n```python\n\n@track_peak_memory(export_to_json=True)\ndef another_function():\n # Your function logic here\n pass\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "A simple utility to track and log peak CPU and GPU memory usage of a function.",
"version": "0.1.3",
"project_urls": {
"Bug Reports": "https://github.com/MIBlue119/memtracker/issues",
"Source": "https://github.com/MIBlue119/memtracker"
},
"split_keywords": [
"memory tracking",
"cpu",
"gpu",
"memory usage"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8ba104d20ee01136a5ad63374538bcff0a3f56b0d3cfaf300297cf3ef8a6cbac",
"md5": "ea2cd8eadc2ec1f082aa41f3946b5f57",
"sha256": "452849c3e03427e66f424f232e22a048d84664af00c10401dadc00ff53c26ac5"
},
"downloads": -1,
"filename": "memtracker-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "ea2cd8eadc2ec1f082aa41f3946b5f57",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3994,
"upload_time": "2023-08-26T06:09:00",
"upload_time_iso_8601": "2023-08-26T06:09:00.310573Z",
"url": "https://files.pythonhosted.org/packages/8b/a1/04d20ee01136a5ad63374538bcff0a3f56b0d3cfaf300297cf3ef8a6cbac/memtracker-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-26 06:09:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "MIBlue119",
"github_project": "memtracker",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "memtracker"
}