runit: scheduling multiple commands with limited devices
Project description
runit
Rise form ashesa cup of bear.
A simple command line tool for scheduling multiple commands with limited resources similar to GNU parallel.
Install
pip install runit-parallel
Example
For example, I have 4 GPUs and 20 test scripts to execute. Each the script consumes arbitrary time, and need a GPU. I want to process all the jobs with only single command, and to make the GPUs work constantly without rest.
TL;DR
runit -g 0 1 2 3 \
--category \
a b c d e f g h i j \
k l m n o p q r s t \
--log logs/runit/{category}-{g}.log
---
< param groups >
category: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't']
< opt groups >
g: ['0', '1', '2', '3']
Then, type a command to run.
Multi-line command is available by attaching \.
< type command >
CUDA_VISIBLE_DEVICES={g} python test_script.py \
--input {category}
---
[thread 3 [01/20]] CUDA_VISIBLE_DEVICES=3 python test_script.py --input b
[thread 1 [02/20]] CUDA_VISIBLE_DEVICES=1 python test_script.py --input c
[thread 2 [03/20]] CUDA_VISIBLE_DEVICES=2 python test_script.py --input d
[thread 0 [04/20]] CUDA_VISIBLE_DEVICES=0 python test_script.py --input h
---
As soon as the running task is finished, the following tasks continue to run.
[thread 2 [05/20]] CUDA_VISIBLE_DEVICES=2 python test_script.py --input e
[thread 1 [06/20]] CUDA_VISIBLE_DEVICES=1 python test_script.py --input f
[thread 2 [07/20]] CUDA_VISIBLE_DEVICES=2 python test_script.py --input g
[thread 3 [08/20]] CUDA_VISIBLE_DEVICES=3 python test_script.py --input i
[thread 2 [09/20]] CUDA_VISIBLE_DEVICES=2 python test_script.py --input j
[thread 0 [10/20]] CUDA_VISIBLE_DEVICES=0 python test_script.py --input k
[thread 2 [11/20]] CUDA_VISIBLE_DEVICES=2 python test_script.py --input l
[thread 2 [12/20]] CUDA_VISIBLE_DEVICES=2 python test_script.py --input m
[thread 1 [13/20]] CUDA_VISIBLE_DEVICES=1 python test_script.py --input n
[thread 3 [14/20]] CUDA_VISIBLE_DEVICES=3 python test_script.py --input o
[thread 0 [15/20]] CUDA_VISIBLE_DEVICES=0 python test_script.py --input p
[thread 0 [16/20]] CUDA_VISIBLE_DEVICES=0 python test_script.py --input q
[thread 3 [17/20]] CUDA_VISIBLE_DEVICES=3 python test_script.py --input r
[thread 1 [18/20]] CUDA_VISIBLE_DEVICES=1 python test_script.py --input s
[thread 0 [19/20]] CUDA_VISIBLE_DEVICES=0 python test_script.py --input t
[thread 2 [20/20]] CUDA_VISIBLE_DEVICES=2 python test_script.py --input t
- opt (option) group: list of the resources (such as GPU, CPU, e.t.c.).
The option can be set with a-(e.g.-g 1 2 3 4,-cpu 0,1 2,3 4,5 6,7).
Multiple options is possible but every option must have same number. - param groups: list of the parameters.
The parameters can be set with two--(e.g.--docu 1.txt 2.txt 3.txt 4.txt).
Multiple options is possible but every params must have same number. --log: path to save logs. Log file path can contain opt and param
(e.g.--log save/to/logs/logname_{g}_{cpu}_{docu}.log)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file runit-parallel-0.0.3.tar.gz.
File metadata
- Download URL: runit-parallel-0.0.3.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1f249c9a67ef4d232af0c81025491e4b8d1538fb27fadc53ac9e76cb2c2ceba
|
|
| MD5 |
d3659869814b9c37381ef8a8b50195e6
|
|
| BLAKE2b-256 |
b8d58b25b346eaa3465ebdcd22d73f280738ad671890edc9bc1f87b70cd4a30f
|
File details
Details for the file runit_parallel-0.0.3-py3-none-any.whl.
File metadata
- Download URL: runit_parallel-0.0.3-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42ed3a9fde63cb445b439e1eb3a0c8eca5118e287f1764c827930e1adf887fa7
|
|
| MD5 |
46ab74fd6c960d33bb3fe276788f5e92
|
|
| BLAKE2b-256 |
30751212197fd823134a8f2c5072dccf2d25d05f90a1dd12b66b92dc392d5d4b
|