diff --git a/src/finn/util/basic.py b/src/finn/util/basic.py index f99a453d05d7cb3c824784e80103b6021f072a79..4eb0e6cb874f80620e3cb25017abcc29368b261b 100644 --- a/src/finn/util/basic.py +++ b/src/finn/util/basic.py @@ -44,6 +44,17 @@ pynq_part_map["Pynq-Z2"] = "xc7z020clg400-1" pynq_part_map["ZCU104"] = "xczu7ev-ffvc1156-2-e" +def get_num_default_workers(): + """Return the number of workers for parallel transformations. Controllable + via the NUM_DEFAULT_WORKERS environment variable. If the env.var. is + undefined, the default value of 1 is returned. + """ + + try: + return int(os.environ["NUM_DEFAULT_WORKERS"]) + except KeyError: + return 1 + def get_finn_root(): "Return the root directory that FINN is cloned into."