diff --git a/CMash/GroundTruth.py b/CMash/GroundTruth.py index 7574809..6065146 100644 --- a/CMash/GroundTruth.py +++ b/CMash/GroundTruth.py @@ -130,7 +130,7 @@ def __return_containment_index(set1: set, set2: set): def __compute_all_training_kmers(self): training_file_to_ksize_to_kmers = dict() num_threads = multiprocessing.cpu_count() - pool = multiprocessing.Pool(processes=num_threads) + pool = multiprocessing.Pool(processes=int(min(num_threads, len(self.training_file_names)))) # res is returned in the same order as self.training_file_names according to the docs res = pool.map(self._return_ksize_to_kmers, self.training_file_names) for (item, file_name) in zip(res, self.training_file_names):