from tqdm.contrib.concurrent import process_map
from multiprocessing import cpu_count
def my_func(param):
# do stuff - param will be one of [1,2,3,4,5]
return some_val
if __name__ == '__main__':
my_vals = process_map(my_func, [1,2,3,4,5], max_workers=cpu_count())