diff --git a/cmd/obitools/obipcr/main.go b/cmd/obitools/obipcr/main.go index bd86d6c..b7714b1 100644 --- a/cmd/obitools/obipcr/main.go +++ b/cmd/obitools/obipcr/main.go @@ -25,8 +25,9 @@ func main() { // trace.Start(ftrace) // defer trace.Stop() - obioptions.SetWorkerPerCore(1) - + obioptions.SetWorkerPerCore(2) + obioptions.SetReadWorkerPerCore(0.5) + optionParser := obioptions.GenerateOptionParser(obipcr.OptionSet) _, args := optionParser(os.Args) diff --git a/pkg/obioptions/options.go b/pkg/obioptions/options.go index ce29519..6e810a7 100644 --- a/pkg/obioptions/options.go +++ b/pkg/obioptions/options.go @@ -14,7 +14,8 @@ import ( ) var _Debug = false -var _WorkerPerCore = 2 +var _WorkerPerCore = 2.0 +var _ReadWorkerPerCore = 1.0 var _MaxAllowedCPU = runtime.NumCPU() var _BatchSize = 5000 var _Pprof = false @@ -92,9 +93,14 @@ func CLIIsDebugMode() bool { // CLIParallelWorkers returns the number of parallel workers requested by // the command line option --workers|-w. func CLIParallelWorkers() int { - return _MaxAllowedCPU * _WorkerPerCore + return int(float64(_MaxAllowedCPU) * float64(_WorkerPerCore)) } +func CLIReadParallelWorkers() int { + return int(float64(_MaxAllowedCPU) * float64(_ReadWorkerPerCore)) +} + + // CLIParallelWorkers returns the number of parallel workers requested by // the command line option --workers|-w. func CLIMaxCPU() int { @@ -116,14 +122,22 @@ func DebugOff() { _Debug = false } -func SetWorkerPerCore(n int) { +func SetWorkerPerCore(n float64) { _WorkerPerCore = n } -func WorkerPerCore() int { +func SetReadWorkerPerCore(n float64) { + _ReadWorkerPerCore = n +} + +func WorkerPerCore() float64 { return _WorkerPerCore } +func ReadWorkerPerCore() float64 { + return _ReadWorkerPerCore +} + func SetBatchSize(n int) { _BatchSize = n } diff --git a/pkg/obitools/obiconvert/sequence_reader.go b/pkg/obitools/obiconvert/sequence_reader.go index 42f2bbb..a37d482 100644 --- a/pkg/obitools/obiconvert/sequence_reader.go +++ b/pkg/obitools/obiconvert/sequence_reader.go @@ -90,7 +90,7 @@ func CLIReadBioSequences(filenames ...string) (obiiter.IBioSequence, error) { opts = append(opts, obiformats.OptionsFastSeqHeaderParser(obiformats.ParseGuessedFastSeqHeader)) } - nworkers := obioptions.CLIParallelWorkers() + nworkers := obioptions.CLIReadParallelWorkers() if nworkers < 2 { nworkers = 2 } diff --git a/pkg/obitools/obimultiplex/demultiplex.go b/pkg/obitools/obimultiplex/demultiplex.go index 14d6beb..fee1408 100644 --- a/pkg/obitools/obimultiplex/demultiplex.go +++ b/pkg/obitools/obimultiplex/demultiplex.go @@ -56,5 +56,5 @@ func IExtractBarcode(iterator obiiter.IBioSequence) (obiiter.IBioSequence, error } log.Printf("Sequence demultiplexing using %d workers\n", obioptions.CLIParallelWorkers()) - return newIter.Speed("Demultiplexing"), nil + return newIter, nil } diff --git a/pkg/obitools/obitag/obitag.go b/pkg/obitools/obitag/obitag.go index 27950cb..460bcdb 100644 --- a/pkg/obitools/obitag/obitag.go +++ b/pkg/obitools/obitag/obitag.go @@ -1,11 +1,12 @@ package obitag import ( - "log" "math" "strconv" "strings" + log "github.com/sirupsen/logrus" + "git.metabarcoding.org/lecasofts/go/obitools/pkg/obialign" "git.metabarcoding.org/lecasofts/go/obitools/pkg/obiiter" "git.metabarcoding.org/lecasofts/go/obitools/pkg/obikmer"