Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --time to launch.py arguments #244

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions LAUNCH.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ In the following, `$root` refers to the root of the current repository.
```sh
usage: launch.py [-h] [--help-md] [--job_name JOB_NAME] [--outdir OUTDIR]
[--cpus_per_task CPUS_PER_TASK] [--mem MEM] [--gres GRES]
[--partition PARTITION] [--modules MODULES]
[--partition PARTITION] [--time TIME] [--modules MODULES]
[--conda_env CONDA_ENV] [--venv VENV] [--template TEMPLATE]
[--code_dir CODE_DIR] [--git_checkout GIT_CHECKOUT]
[--jobs JOBS] [--dry-run] [--verbose] [--force]

optional arguments:
options:
-h, --help show this help message and exit
--help-md Show an extended help message as markdown. Can be
useful to overwrite LAUNCH.md with `$ python
Expand All @@ -26,6 +26,9 @@ optional arguments:
--gres GRES gres per node (e.g. gpu:1). Defaults to gpu:1
--partition PARTITION
slurm partition to use for the job. Defaults to long
--time TIME wall clock time limit (e.g. 2-12:00:00). See:
https://slurm.schedmd.com/sbatch.html#OPT_time
Defaults to None
--modules MODULES string after 'module load'. Defaults to anaconda/3
cuda/11.3
--conda_env CONDA_ENV
Expand Down Expand Up @@ -69,6 +72,7 @@ modules : anaconda/3 cuda/11.3
outdir : $SCRATCH/gflownet/logs/slurm
partition : long
template : $root/mila/sbatch/template-conda.sh
time : None
venv : None
verbose : False
```
Expand Down
8 changes: 8 additions & 0 deletions mila/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ def code_dir_for_slurm_tmp_dir_checkout(git_checkout):
"outdir": "$SCRATCH/gflownet/logs/slurm",
"partition": "long",
"template": "$root/mila/sbatch/template-conda.sh",
"time": None,
"venv": None,
"verbose": False,
}
Expand Down Expand Up @@ -454,6 +455,13 @@ def code_dir_for_slurm_tmp_dir_checkout(git_checkout):
help="slurm partition to use for the job."
+ f" Defaults to {defaults['partition']}",
)
parser.add_argument(
"--time",
type=str,
help="wall clock time limit (e.g. 2-12:00:00). "
+ "See: https://slurm.schedmd.com/sbatch.html#OPT_time"
+ f" Defaults to {defaults['time']}",
)
parser.add_argument(
"--modules",
type=str,
Expand Down
3 changes: 2 additions & 1 deletion mila/sbatch/template-conda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
#SBATCH --mem={mem}
#SBATCH --gres={gres}
#SBATCH --partition={partition}
#SBATCH --time={time}

module load {modules}
conda activate {conda_env}

cd {code_dir}

python main.py {main_args}
python main.py {main_args}
3 changes: 2 additions & 1 deletion mila/sbatch/template-venv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
#SBATCH --mem={mem}
#SBATCH --gres={gres}
#SBATCH --partition={partition}
#SBATCH --time={time}

module load {modules}
source {venv}/bin/activate

cd {code_dir}

python main.py {main_args}
python main.py {main_args}