diff --git a/src/run-submit-pol-job.py b/src/run-submit-pol-job.py index 21be17f3ea8f0eb406f2d5f1883e570850efb231..4ab3f91685d7ddeae4b16e8471991c788c44e58e 100755 --- a/src/run-submit-pol-job.py +++ b/src/run-submit-pol-job.py @@ -29,7 +29,7 @@ def parse_args(): sbatch = parser.add_argument_group('sbatch parameters') sbatch.add_argument('-N','--nodes',type=int,default=1, help='Number of nodes to run job across') - sbatch.add_argument('-n','--ntasks',type=int,default=16, + sbatch.add_argument('-c','--cores',type=int,default=16, help='Number of cores to request') sbatch.add_argument('-p','--partition',type=str,default='amd-hdr100,medium', help='Partition to submit job to. Can be a comma-separated list of multiple partitions') @@ -94,9 +94,9 @@ def validate_nodes(n): if not isinstance(n,int) and n >= 1 and n <= 4: raise ValueError('Nodes must be an integer between 1 and 4') -def validate_ntasks(n): +def validate_cores(n): if not isinstance(n,int) and n >= 1 and n <= 48: - raise ValueError('Ntasks must be an integer between 1 and 48') + raise ValueError('Cores must be an integer between 1 and 48') # Need to validate that the output directory exists. This will not create a directory that does not already exist. def validate_output_directory(outdir): @@ -118,7 +118,7 @@ def main(): args['device'] = validate_device(args['device']) validate_nodes(args['nodes']) - validate_ntasks(args['ntasks']) + validate_cores(args['cores']) validate_mem(args['mem_per_cpu']) validate_time(args['time']) args['partition'] = validate_partition(args['partition']) @@ -128,11 +128,13 @@ def main(): if args['outfile'] is None: args['outfile'] = create_default_outfile(args['device']) - cmd = "./submit-pol-job -o {outdir} -f {outfile} -N {nodes} -n {ntasks} -p {partition} -t {time} -m {mem_per_cpu} {device}".format(**args) + cmd = "./submit-pol-job -o {outdir} -f {outfile} -N {nodes} -c {cores} -p {partition} -t {time} -m {mem_per_cpu} {device}".format(**args) if args['with_dirs']: cmd = f'{cmd} --with-dirs' - - print(cmd) + + print(f"Command: {cmd}") + proc = subprocess.run(cmd,shell=True) + proc.communicate() exit() if __name__ == '__main__': diff --git a/src/submit-pol-job b/src/submit-pol-job index bb92af7f2ed6c7acb3e553428bf8126231842e54..ecba3262d3ab8b9ef7cce3d3a2dcccacd717d394 100755 --- a/src/submit-pol-job +++ b/src/submit-pol-job @@ -7,7 +7,7 @@ set -euxo pipefail ############################################################ nodes=1 -ntasks=16 +cores=16 mem_per_cpu="8G" time="24:00:00" partition="amd-hdr100,medium" @@ -22,7 +22,7 @@ usage() { >&2 cat << EOF Usage: $0 [ -h ] [ -o | --outdir ] [ -f | --outfile ] [ --with-dirs ] - [ -N | --nodes ] [ -n | --ntasks ] [ -p | --partition] + [ -N | --nodes ] [ -c | --cores ] [ -p | --partition] [ -t | --time ] [ -m | --mem-per-cpu ] device EOF @@ -37,7 +37,7 @@ as root or via the run-submit-pol-job.py script. The default policy file is ./policy/list-path-external Usage: $0 [ -h ] [ -o | --outdir ] [ -f | --outfile ] [ --with-dirs ] - [ -N | --nodes ] [ -n | --ntasks ] [ -p | --partition ] + [ -N | --nodes ] [ -c | --cores ] [ -p | --partition ] [ -t | --time ] [ -m | --mem ] device @@ -60,7 +60,7 @@ Policy Options: sbatch options: -N|--nodes Number of nodes to run the job on (default: 1) - -n|--ntasks Number of tasks (default: 16) + -c|--cores Number of cores (default: 16) -p|--partition Partition to submit tasks to (default: amd-hdr100,medium) -t|--time Max walltime (default: 24:00:00) @@ -69,7 +69,7 @@ EOF exit 0 } -args=$(getopt -a -o ho:f:N:n:p:t:m: --long help,outdir:,outfile:,with-dirs,nodes:,ntasks:,partition:,time:,mem: -- "$@") +args=$(getopt -a -o ho:f:N:c:p:t:m: --long help,outdir:,outfile:,with-dirs,nodes:,cores:,partition:,time:,mem: -- "$@") if [[ $? -gt 0 ]]; then usage @@ -85,7 +85,7 @@ do -f | --outfile) outfile=$2 ; shift 2 ;; --with-dirs) policy="./policy/list-path-dirplus" ; shift 1 ;; -N | --nodes) nodes=$2 ; shift 2 ;; - -n | --ntasks) ntasks=$2 ; shift 2 ;; + -c | --cores) cores=$2 ; shift 2 ;; -p | --partition) partition=$2 ; shift 2 ;; -t | --time) time=$2 ; shift 2 ;; -m | --mem-per-cpu) mem_per_cpu=$2 ; shift 2 ;; @@ -111,7 +111,7 @@ DIR=$outdir POLICYFILE=$policy FILESYSTEM=${device} OUTFILE=${outfile} && \ DIR=$DIR POLICYFILE=$POLICYFILE FILESYSTEM=${FILESYSTEM} OUTFILE=${OUTFILE} \ sbatch \ -N $nodes \ - -n $ntasks \ + -c $cores \ -t $time \ --mem-per-cpu=$mem_per_cpu \ -p $partition \