Skip to content

Commit

Permalink
Merge pull request #244 from alexhernandezgarcia/launch-time
Browse files Browse the repository at this point in the history
Add --time to launch.py arguments
  • Loading branch information
carriepl authored Nov 13, 2023
2 parents 96f1eaf + 75413bb commit 0440190
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
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}

0 comments on commit 0440190

Please sign in to comment.