|
28 | 28 |
|
29 | 29 | # Code:
|
30 | 30 |
|
| 31 | +import argparse |
31 | 32 | import getpass
|
32 | 33 | import os
|
33 | 34 | import shutil
|
34 | 35 | import socket
|
35 | 36 | import subprocess
|
36 | 37 |
|
37 |
| -from config import get_config, print_usage |
| 38 | +# ---------------------------------------- |
| 39 | +# Global variables within this script |
| 40 | +arg_lists = [] |
| 41 | +parser = argparse.ArgumentParser() |
| 42 | + |
| 43 | + |
| 44 | +def add_argument_group(name): |
| 45 | + arg = parser.add_argument_group(name) |
| 46 | + arg_lists.append(arg) |
| 47 | + return arg |
| 48 | + |
| 49 | + |
| 50 | +# ---------------------------------------- |
| 51 | +# Arguments for training |
| 52 | +global_arg = add_argument_group("Global") |
| 53 | + |
| 54 | + |
| 55 | +global_arg.add_argument( |
| 56 | + "--account", type=str, |
| 57 | + default="def-kyi", |
| 58 | + help="Slurm account to use. " |
| 59 | + "Please change this to your compute canada account") |
| 60 | + |
| 61 | +global_arg.add_argument( |
| 62 | + "--todo_dir", type=str, |
| 63 | + default="./jobs/todo", |
| 64 | + help="Path to directory containing shell scripts to run.") |
| 65 | + |
| 66 | +global_arg.add_argument( |
| 67 | + "--done_dir", type=str, |
| 68 | + default="./jobs/done", |
| 69 | + help="Path to directory that the program will move queued scripts.") |
| 70 | + |
| 71 | +global_arg.add_argument( |
| 72 | + "--output_dir", type=str, |
| 73 | + default="./jobs/output", |
| 74 | + help="Directory that will contain job outputs.") |
| 75 | + |
| 76 | +# ---------------------------------------- |
| 77 | +# Arguments for model |
| 78 | +job_arg = add_argument_group("Job") |
| 79 | + |
| 80 | + |
| 81 | +job_arg.add_argument( |
| 82 | + "--num_jobs", type=int, |
| 83 | + default=1, |
| 84 | + help="Number of shell scripts to queue from the TODO_DIR.") |
| 85 | +job_arg.add_argument( |
| 86 | + "--num_runs", type=int, |
| 87 | + default=5, |
| 88 | + help="Number of times this shell script will be executed. " |
| 89 | + "This is useful when running 3 hour jobs that run multiple times.") |
| 90 | +job_arg.add_argument( |
| 91 | + "--num_gpu", type=int, |
| 92 | + default=1, |
| 93 | + help="Number of GPUs to use. Set zero to not use the gpu node.") |
| 94 | +job_arg.add_argument( |
| 95 | + "--num_cpu", type=str, |
| 96 | + default="auto", |
| 97 | + help="Number of CPU cores to use. Can be infered from the GPU." |
| 98 | + "Set 'auto' to do that.") |
| 99 | +job_arg.add_argument( |
| 100 | + "--mem", type=str, |
| 101 | + default="auto", |
| 102 | + help="Amount of memory to use. See compute canada wiki for details " |
| 103 | + "on large memory nodes. Typically, you don't want to go over 8G per " |
| 104 | + "CPU core") |
| 105 | +job_arg.add_argument( |
| 106 | + "--time_limit", type=str, |
| 107 | + default="0-03:00", |
| 108 | + help="Time limit on the jobs. If you can, 3 hours give you the best " |
| 109 | + "turn around.") |
| 110 | +job_arg.add_argument( |
| 111 | + "--depends_key", type=str, |
| 112 | + default="none", |
| 113 | + help="In case you want to schedule your jobs depending on something. " |
| 114 | + "Set to 'none' if not wanted.") |
| 115 | + |
| 116 | + |
| 117 | +def get_config(): |
| 118 | + config, unparsed = parser.parse_known_args() |
| 119 | + |
| 120 | + return config, unparsed |
| 121 | + |
| 122 | + |
| 123 | +def print_usage(): |
| 124 | + parser.print_usage() |
38 | 125 |
|
39 | 126 |
|
40 | 127 | def main(config):
|
|
0 commit comments