tf_alloc
Simpliying GPU allocation for Tensorflow
⭐️ Why tf_alloc? Problems?
- Compare to pytorch, tensorflow allocate all GPU memory to single training.
- However, it is too much waste because, some training does not use whole GPU memory.
- To solve this problem, TF engineers use two methods.
- Limit to use only single GPU
- Limit the use of only a certain percentage of GPUs.
- However, these methods require complex code and memory management.
⭐️ Why tf_alloc? How to solve?
tf_alloc simplfy and automate GPU allocation using two methods.
⭐️ How to allocate?
- Before using tf_alloc, you have to install tensorflow fits for your environment.
- This library does not install specific tensorflow version.
# On the top of the code
from tf_alloc import allocate as talloc
talloc(gpu=1, percentage=0.5)
import tensorflow as tf
""" your code"""
It is only code for allocating GPU in certain percentage.
Parameters:
- gpu = which gpu you want to use (if you have two gpu than [0, 1] is possible)
- percentage = the percentage of memory usage on single gpu. 1.0 for maximum use.
⭐️ Additional Function.
GET GPU Objects
gpu_objs = get_gpu_objects()
- To use this code, you can get gpu objects that contains gpu information.
- You can set GPU backend by using this function.
GET CURRENT STATE
Defualt
current(
gpu_id = False,
total_memory=False,
used = False,
free = False,
percentage_of_use = False,
percentage_of_free = False,
)
- You can use this functions to see current GPU state and possible maximum allocation percentage.
- Without any parameters, than it only visualize possible maximum allocation percentage.
- It is cmd line visualizer. It doesn't return values.
Parameters
- gpu_id = visualize the gpu id number
- total_memory = visualize the total memory of GPU
- used = visualize the used memory of GPU
- free = visualize the free memory of GPU
- percentage_of_used = visualize the percentage of used memory of GPU
- percentage_of_free = visualize the percentage of free memory of GPU
Metadata
Release files for tf-alloc 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| tf_alloc-0.0.3.tar.gz | 5.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tf_alloc-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.4 kB
Release files / tf_alloc-0.0.3.tar.gz
| Download URL | tf_alloc-0.0.3.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
23de50f38934bcfc77cc809f1e6fd3abc48ca49c2e37d88755b0c8487f8bf097
|
|
BLAKE2b-256 checksum How to use checksums |
7f3dcef94db03038214598eb10b687f9ba4e5f17207d4d6709135d3c8515ead9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|
Release files / tf_alloc-0.0.3-py3-none-any.whl
| Download URL | tf_alloc-0.0.3-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
30d121647ea9d66f946d4447d5d4ff26b6d6867941ce50f48216163e6853d809
|
|
BLAKE2b-256 checksum How to use checksums |
511ee3fafbbb7ab35d331c1f724cc6c2dbc4d842d712da8b35310aff863c5dbf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|
Security for tf-alloc 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.