Skip to main content

fastgpu

A queue service for quickly developing scripts that use all your GPUs efficiently

fastgpu provides a single command, fastgpu_poll, which polls a directory to check for scripts to run, and then runs them on the first available GPU. If no GPUs are available, it waits until one is. If more than one GPU is available, multiple scripts are run in parallel, one per GPU.

An API is also provided for polling programmatically, which is extensible for assigning other resources to processes besides GPUs. For details on the API, see the docs for core.

Install

pip install fastgpu

How to use

--help provides command help:

$ fastgpu_poll --help
usage: fastgpu_poll [-h] [--path PATH] [--exit EXIT]

Poll `path` for scripts using `ResourcePoolGPU.poll_scripts`

optional arguments:
  -h, --help   show this help message and exit
  --path PATH  Path containing `to_run` directory
  --exit EXIT  Exit when `to_run` is empty

path defaults to the current directory. The path should contain a subdirectory to_run containing executable scripts you wish to run. It should not contain any other files, although it can contain subdirectories (which are ignored).

fastgpu_poll will run each script in to_run in sorted order. Each script will be assigned to one GPU. The CUDA_VISIBLE_DEVICES environment variable will be set to the ID of this GPU in the script's subprocess. In addition, the FASTGPU_ID environment variable will also be set to this ID.

Once a script is selected to be run, it is moved into a directory called running. Once it's finished, it's moved into complete or fail as appropriate. stdout and stderr are captured to files with the same name as the script, plus stdout or stderr appended.

If exit is 1 (which is the default), then once all scripts are run, fastgpu_poll will exit. If it is 0 then fastgpu_poll will continue running until it is killed; it will keep polling for any new scripts that are added to to_run.

To limit the GPUs available to fastgpu, set CUDA_VISIBLE_DEVICES before polling, e.g.:

CUDA_VISIBLE_DEVICES=2,3 fastgpu_poll script_dir

Release files for fastgpu 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fastgpu 1.0.1
File Size Uploaded
fastgpu-1.0.1.tar.gz 9.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fastgpu 1.0.1
File Interpreter ABI Platform
fastgpu-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 19.2 kB

Release files / fastgpu-1.0.1.tar.gz

Download URL fastgpu-1.0.1.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
53ee2cbd38102079325ed3faf10160fcce33ab671713b7d25393f866ebdd9378
BLAKE2b-256 checksum
How to use checksums
77bef20b9e2080bbf3824e03a8f846824d267b8787bf16e759ae3531aaf0755d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.7

Release files / fastgpu-1.0.1-py3-none-any.whl

Download URL fastgpu-1.0.1-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e0d9f7e0ef62c8f8216578a6e522a3d2a32db855ec6cab687fe1ee06619abb7
BLAKE2b-256 checksum
How to use checksums
6bf18bcd81c2f3630b9a2cf70b76055630497f104335da7fb9ac6f4b9d1554a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.7

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page