From 20a80562f46ff6aee46dfc9b6b67608d6f23eb7f Mon Sep 17 00:00:00 2001 From: "Silas S. Brown" <ssb22@cam.ac.uk> Date: Sat, 13 Jan 2018 07:31:03 -0600 Subject: [PATCH] Update Annotator Generator --- annogen.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/annogen.py b/annogen.py index 6001c01..cef00ef 100755 --- a/annogen.py +++ b/annogen.py @@ -2973,18 +2973,15 @@ def generate_map(): def setup_parallelism(): if single_core or not checkpoint: return # parallelise only if checkpoint (otherwise could have trouble sharing the normalised corpus and map etc) import commands + args = commands.getoutput("ps -p " + str(os.getpid()) + " -o args") try: - commands.getoutput( - "ps -p " + str(os.getpid()) + " -o args") \ - .index("-m mpi4py.futures") # ValueError if not found + args.index("-m mpi4py.futures") # ValueError if not found import mpi4py.futures # mpi4py v2.1+ import mpi4py.MPI, mpi4py ; assert mpi4py.MPI.COMM_WORLD.size > 1, "mpi4py says world size is 1: likely a symptom of incorrectly-configured MPI. Did you compile mpi4py using the same setup (e.g. MPICH or OpenMPI) as you are running? mpi4py's config is: "+repr(mpi4py.get_config()) return mpi4py.futures.MPIPoolExecutor() except ValueError: pass # but raise all other exceptions: if we're being run within mpi4py.futures then we want to know about MPI problems try: - commands.getoutput( - "ps -p " + str(os.getpid()) + " -o args") \ - .index("-m scoop") # ValueError if not found + args.index("-m scoop") # ValueError if not found import scoop.futures return scoop.futures # submit() is at module level except ValueError: pass @@ -2992,7 +2989,7 @@ def setup_parallelism(): import concurrent.futures # sudo pip install futures (2.7 backport of 3.2 standard library) import multiprocessing num_cpus = multiprocessing.cpu_count() - if num_cpus >= 2: return concurrent.futures.ProcessPoolExecutor(num_cpus-1) # leave one for the CPU-heavy control task + if num_cpus > 1: return concurrent.futures.ProcessPoolExecutor(num_cpus-1) # leave one for the CPU-heavy control task except: pass def get_phrases(): -- GitLab