Skip to content

Commit

Permalink
checksum: handle DPU_ALLOCATE_ALL as a value of the nr_dpus parameter
Browse files Browse the repository at this point in the history
It is notably used in the README example
  • Loading branch information
Jordi Chauzi committed Jul 16, 2020
1 parent a2dc69e commit 938fbcd
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions checksum/host/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@


from dpu import DpuSet
from dpu import ALLOCATE_ALL
import argparse
import os
import random
Expand Down Expand Up @@ -90,8 +91,17 @@ def create_test_file():

if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('nr_dpus', type=int)
parser.add_argument('nr_dpus')
parser.add_argument('nr_tasklets', type=int)
args = parser.parse_args()

main(args.nr_dpus, args.nr_tasklets)
if args.nr_dpus == 'DPU_ALLOCATE_ALL':
nr_dpus = ALLOCATE_ALL
else:
try:
nr_dpus = int(args.nr_dpus)
except ValueError:
parser.error("argument nr_dpus: invalid value: '{}'".format(args.nr_dpus))
sys.exit(os.EX_USAGE)

main(nr_dpus, args.nr_tasklets)

0 comments on commit 938fbcd

Please sign in to comment.