Sweep to int to arguments. Map parameter sweeps to ints to program arguments. Specifically useful for compute canada.
Project description
litreview
Maps a parameter sweep to an int and then back again.
Install
pip3 install s2i2a
Usage
s2i2a <direction> <command> <sweep arguments>
The goal is to support all the sweep syntax used by hydra's default sweeper.
But for now, s2i2a just supports sweeps of the shape arg=val1,val2,val3,....
A help message is also provided
s2i2a --help
Sample usage
Call s2i2a s2i with all the shell arguments necessary to run your script, plus your script's arguments, plus your sweeps.
s2i2a s2i python3 train.py \
'non-sweep argument' another_non-sweep_arg \
arg1=val1,val2 arg2=val3,val4,val5
This generates a s2i.txt file in your local directory containing
arg1=val1 arg2=val3
arg1=val1 arg2=val4
arg1=val1 arg2=val5
arg1=val2 arg2=val3
arg1=val2 arg2=val4
arg1=val2 arg2=val5
python3 train.py 'non-sweep argument' another_non-sweep_arg
You then build a Docker/Singularity image containing said file, and you install s2i2a inside that image.
Then you can call at the end of a .sh file (say, an SBATCH script containing $SLURM_ARRAY_TASK_ID):
s2i2a i2a 3
This calls execvp, and replaces s2i2a's process by
python3 train.py 'non-sweep argument' another_non-sweep_arg arg1=val2 arg2=val3
Quick debugging
You probably don't want to mess up your sweeps after uploading to the cluster.
Instead, you can invoke test_s2i2a.py. This will run a dummy execvp invokation and will print
what arguments got passed to the script. Be aware that it will rewrite the path of the script to point to s2i2a's installation folder.
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 Distributions
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 s2i2a-0.0.9-py3-none-any.whl.
File metadata
- Download URL: s2i2a-0.0.9-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f24e020214379c5adc598285c247854a892f238132639f4b99a32106e5453341
|
|
| MD5 |
b42676e221742962cb2bfd005bbeefa8
|
|
| BLAKE2b-256 |
c345e5a1e62724d47544b0910a0e1f2e679ea4419ad0f652ac2ec84a9aead755
|