Skip to content
Snippets Groups Projects
Commit 7b1880de authored by Matthew K Defenderfer's avatar Matthew K Defenderfer
Browse files

change ntasks to cores

parent bd36fe86
No related branches found
No related tags found
1 merge request!11Add submit pol wrapper
...@@ -29,7 +29,7 @@ def parse_args(): ...@@ -29,7 +29,7 @@ def parse_args():
sbatch = parser.add_argument_group('sbatch parameters') sbatch = parser.add_argument_group('sbatch parameters')
sbatch.add_argument('-N','--nodes',type=int,default=1, sbatch.add_argument('-N','--nodes',type=int,default=1,
help='Number of nodes to run job across') 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') help='Number of cores to request')
sbatch.add_argument('-p','--partition',type=str,default='amd-hdr100,medium', 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') help='Partition to submit job to. Can be a comma-separated list of multiple partitions')
...@@ -94,9 +94,9 @@ def validate_nodes(n): ...@@ -94,9 +94,9 @@ def validate_nodes(n):
if not isinstance(n,int) and n >= 1 and n <= 4: if not isinstance(n,int) and n >= 1 and n <= 4:
raise ValueError('Nodes must be an integer between 1 and 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: 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. # Need to validate that the output directory exists. This will not create a directory that does not already exist.
def validate_output_directory(outdir): def validate_output_directory(outdir):
...@@ -118,7 +118,7 @@ def main(): ...@@ -118,7 +118,7 @@ def main():
args['device'] = validate_device(args['device']) args['device'] = validate_device(args['device'])
validate_nodes(args['nodes']) validate_nodes(args['nodes'])
validate_ntasks(args['ntasks']) validate_cores(args['cores'])
validate_mem(args['mem_per_cpu']) validate_mem(args['mem_per_cpu'])
validate_time(args['time']) validate_time(args['time'])
args['partition'] = validate_partition(args['partition']) args['partition'] = validate_partition(args['partition'])
...@@ -128,11 +128,13 @@ def main(): ...@@ -128,11 +128,13 @@ def main():
if args['outfile'] is None: if args['outfile'] is None:
args['outfile'] = create_default_outfile(args['device']) 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']: if args['with_dirs']:
cmd = f'{cmd} --with-dirs' cmd = f'{cmd} --with-dirs'
print(cmd) print(f"Command: {cmd}")
proc = subprocess.run(cmd,shell=True)
proc.communicate()
exit() exit()
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -7,7 +7,7 @@ set -euxo pipefail ...@@ -7,7 +7,7 @@ set -euxo pipefail
############################################################ ############################################################
nodes=1 nodes=1
ntasks=16 cores=16
mem_per_cpu="8G" mem_per_cpu="8G"
time="24:00:00" time="24:00:00"
partition="amd-hdr100,medium" partition="amd-hdr100,medium"
...@@ -22,7 +22,7 @@ usage() ...@@ -22,7 +22,7 @@ usage()
{ {
>&2 cat << EOF >&2 cat << EOF
Usage: $0 [ -h ] [ -o | --outdir ] [ -f | --outfile ] [ --with-dirs ] 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 ] [ -t | --time ] [ -m | --mem-per-cpu ]
device device
EOF EOF
...@@ -37,7 +37,7 @@ as root or via the run-submit-pol-job.py script. The default policy file is ...@@ -37,7 +37,7 @@ as root or via the run-submit-pol-job.py script. The default policy file is
./policy/list-path-external ./policy/list-path-external
Usage: $0 [ -h ] [ -o | --outdir ] [ -f | --outfile ] [ --with-dirs ] 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 ] [ -t | --time ] [ -m | --mem ]
device device
...@@ -60,7 +60,7 @@ Policy Options: ...@@ -60,7 +60,7 @@ Policy Options:
sbatch options: sbatch options:
-N|--nodes Number of nodes to run the job on (default: 1) -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 -p|--partition Partition to submit tasks to
(default: amd-hdr100,medium) (default: amd-hdr100,medium)
-t|--time Max walltime (default: 24:00:00) -t|--time Max walltime (default: 24:00:00)
...@@ -69,7 +69,7 @@ EOF ...@@ -69,7 +69,7 @@ EOF
exit 0 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 if [[ $? -gt 0 ]]; then
usage usage
...@@ -85,7 +85,7 @@ do ...@@ -85,7 +85,7 @@ do
-f | --outfile) outfile=$2 ; shift 2 ;; -f | --outfile) outfile=$2 ; shift 2 ;;
--with-dirs) policy="./policy/list-path-dirplus" ; shift 1 ;; --with-dirs) policy="./policy/list-path-dirplus" ; shift 1 ;;
-N | --nodes) nodes=$2 ; shift 2 ;; -N | --nodes) nodes=$2 ; shift 2 ;;
-n | --ntasks) ntasks=$2 ; shift 2 ;; -c | --cores) cores=$2 ; shift 2 ;;
-p | --partition) partition=$2 ; shift 2 ;; -p | --partition) partition=$2 ; shift 2 ;;
-t | --time) time=$2 ; shift 2 ;; -t | --time) time=$2 ; shift 2 ;;
-m | --mem-per-cpu) mem_per_cpu=$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} && \ ...@@ -111,7 +111,7 @@ DIR=$outdir POLICYFILE=$policy FILESYSTEM=${device} OUTFILE=${outfile} && \
DIR=$DIR POLICYFILE=$POLICYFILE FILESYSTEM=${FILESYSTEM} OUTFILE=${OUTFILE} \ DIR=$DIR POLICYFILE=$POLICYFILE FILESYSTEM=${FILESYSTEM} OUTFILE=${OUTFILE} \
sbatch \ sbatch \
-N $nodes \ -N $nodes \
-n $ntasks \ -c $cores \
-t $time \ -t $time \
--mem-per-cpu=$mem_per_cpu \ --mem-per-cpu=$mem_per_cpu \
-p $partition \ -p $partition \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment