Skip to main content

gpu device moniter and automaticly run command if device available, just for nvidia gpu.

Project description

gpu-waiter

1. Overview

gpu device moniter and automaticly run commond if device available, just for nvidia gpu.

2. Install & Usage

2.1 install

pip install gpu-waiter

2.2 usage

$ waiter -g 2 -m 40G ls -alh /usr/local
$ waiter -g 2 -m 40G -c ls -alh /usr/local
$ waiter -g 2 -m 40G -c "ls -alh /usr/local"
$ waiter -c "ls -alh /usr/local" -g 2 -m 40G

$ waiter -h
usage: waiter [-h] [-c CMD] [-g GPU] [-m MEM] [-s] [-t TIME] [-vvv]

options:
  -h, --help            show this help message and exit.
  -c CMD, --cmd CMD     command to run; -c could to be not specified; -c could be ignored but command should be posed at the end of shell setence; command
                        could be not string only if -c is ignored.
  -g GPU, --gpu GPU     amount of gpu required.
  -m MEM, --mem MEM     memory size required.
  -s, --single_user     not use gpu if already has user.
  -t TIME, --time TIME  time of peried between check.
  -vvv, --verbose       dump all log.
#/bin/python3
from gpu_waiter import Tasker, Waiter
from gpu_waiter import NVGPU

if __name__ == "__main__":
    nv = NVGPU(2, "23GiB", False)
    nv.check()

    task = Tasker(
        [
            "ls",
            "-alh",
            "/usr/local/",
        ],
        msg_level=1,
        devices=nv
    )

    wt = Waiter(3, task)
    wt.do_wait()
    
    wt = Waiter(3)
    wt.add_task(task)
    wt.do_wait()

3. Develop

git clone https://github.com/lijunjie2232/gpu_waiter.git
cd gpu_waiter
pip install -e .

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gpu_waiter-0.1.2.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

gpu_waiter-0.1.2-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file gpu_waiter-0.1.2.tar.gz.

File metadata

  • Download URL: gpu_waiter-0.1.2.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for gpu_waiter-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ee4b20d56f74ed39eb4aff3acd00c7da85c9bb30e8084fdaa7e86027575df17e
MD5 bee50987607158f28764fa42106c1be1
BLAKE2b-256 ad724e055cbf40e2ebb8bb76b5f68f3e3c13871cd7c52cf4ff158be192fca543

See more details on using hashes here.

File details

Details for the file gpu_waiter-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: gpu_waiter-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for gpu_waiter-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 34b52f077bd4a619da8feb720fc34f312e01813981dd5515b68127524aa6e261
MD5 07981bfb13fb864f55cfabe47509aad2
BLAKE2b-256 b5d407d01c3a296add4fd931ec3cfaf5c08640a9ed5f2daf9b1d0d1ed36adbe4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page