From 8f689c17a589b72800cdc53d77067575a86abe9e Mon Sep 17 00:00:00 2001 From: Ruben Vorderman Date: Tue, 5 Oct 2021 14:17:35 +0200 Subject: [PATCH 1/2] Force xopen to use the main thread when cores==1 --- src/cutadapt/__main__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cutadapt/__main__.py b/src/cutadapt/__main__.py index aebe6ab6..5920ce90 100644 --- a/src/cutadapt/__main__.py +++ b/src/cutadapt/__main__.py @@ -1021,6 +1021,10 @@ def warn_if_en_dashes(args): def estimate_compression_threads(cores: int) -> Optional[int]: + if cores == 1: + # This sets xopen in a mode were only the main thread is used. + # No external programs will be used. + return 0 return max(0, min(cores, 4)) From 02b42c12da687474c7346fab763df1ec14a24611 Mon Sep 17 00:00:00 2001 From: Ruben Vorderman Date: Wed, 6 Oct 2021 09:44:35 +0200 Subject: [PATCH 2/2] Update estimate_compression_threads to use one less than overall cores. --- src/cutadapt/__main__.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/cutadapt/__main__.py b/src/cutadapt/__main__.py index 5920ce90..73ca6307 100644 --- a/src/cutadapt/__main__.py +++ b/src/cutadapt/__main__.py @@ -1021,11 +1021,7 @@ def warn_if_en_dashes(args): def estimate_compression_threads(cores: int) -> Optional[int]: - if cores == 1: - # This sets xopen in a mode were only the main thread is used. - # No external programs will be used. - return 0 - return max(0, min(cores, 4)) + return max(0, min(cores - 1, 4)) def is_any_output_stdout(args):