From 0e75be71b07129178f6a4b41a448809e6a760c67 Mon Sep 17 00:00:00 2001 From: halfwayBraindead Date: Mon, 30 Jul 2018 22:21:35 -0500 Subject: [PATCH 1/4] Additional Slurm grid parameters --- src/pipelines/canu/Defaults.pm | 10 +++++++ src/pipelines/canu/Execution.pm | 48 ++++++++++++++++++++++++++------- 2 files changed, 49 insertions(+), 9 deletions(-) diff --git a/src/pipelines/canu/Defaults.pm b/src/pipelines/canu/Defaults.pm index d7bfd5c81..ace8050fd 100644 --- a/src/pipelines/canu/Defaults.pm +++ b/src/pipelines/canu/Defaults.pm @@ -832,6 +832,16 @@ sub setDefaults () { setDefault("gridEngineArraySubmitID", undef, "Grid engine configuration, not documented"); setDefault("gridEngineJobID", undef, "Grid engine configuration, not documented"); + ##### Slurm-specific parameters for controlling the number of + ##### cores / tasks dispatched per step or globally (WIP) + + setDefault( 'slurmCormhapCoreLimit', undef, 'Maximum number of cores allocated for MHAP pre-computing and alignment within the correction phase' ); + setDefault( 'slurmOvbCoreLimit', undef, 'Maximum number of single-core tasks dispatched for the ovlStore bucketizing step within the trimming phase' ); + setDefault( 'slurmOvsCoreLimit', undef, 'Maximum number of single-core tasks dispatched for the ovlStore sorting step within the trimming phase' ); + setDefault( 'slurmRedCoreLimit', undef, 'Maximum number of cores allocated for read error detection within the unitigging phase' ); + setDefault( 'slurmArrayTaskLimit', undef, 'Maximum number of tasks permitted for each step throughout assembly' ); + setDefault( 'slurmArrayCoreLimit', undef, 'Maximum number of cores allocated for each step throughout assembly' ); + ##### Grid Engine Pipeline setDefault("useGrid", 1, "If 'true', enable grid-based execution; if 'false', run all jobs on the local machine; if 'remote', create jobs for grid execution but do not submit; default 'true'"); diff --git a/src/pipelines/canu/Execution.pm b/src/pipelines/canu/Execution.pm index e5e83a829..f922e5f44 100644 --- a/src/pipelines/canu/Execution.pm +++ b/src/pipelines/canu/Execution.pm @@ -342,10 +342,6 @@ sub skipStage ($$@) { sub getInstallDirectory () { my $installDir = $FindBin::RealBin; - if ($installDir =~ m!^(.*)/\w+-\w+/bin$!) { - $installDir = $1; - } - return($installDir); } @@ -773,8 +769,8 @@ sub submitScript ($$) { -sub buildGridArray ($$$$) { - my ($name, $bgn, $end, $opt) = @_; +sub buildGridArray (@) { + my ( $name, $bgn, $end, $opt, $thr ) = @_; my $off = 0; # In some grids (SGE) this is the maximum size of an array job. @@ -812,8 +808,42 @@ sub buildGridArray ($$$$) { $off = "-F \"$off\""; } - $opt =~ s/ARRAY_NAME/$name/g; # Replace ARRAY_NAME with 'job name' - $opt =~ s/ARRAY_JOBS/$bgn-$end/g; # Replace ARRAY_JOBS with 'bgn-end' + if( $opt =~ m/(ARRAY_NAME)/ ) + { + $opt =~ s/$1/$name/; # Replace ARRAY_NAME with 'job name' + } + elsif( $opt =~ m/(ARRAY_JOBS)/ ) + { + $opt =~ s/$1/$bgn-$end/; # Replace ARRAY_JOBS with 'bgn-end' + + if( lc( getGlobal( 'gridEngine' ) ) eq 'slurm' && $end > 1 ) + { + if( $name =~ m/^cormhap_/i && defined getGlobal( 'slurmCormhapCoreLimit' ) ) + { + $opt .= '%' . int( getGlobal( 'slurmCormhapCoreLimit' ) / $thr ); + } + elsif( $name =~ m/^ovb_/i && defined getGlobal( 'slurmOvbCoreLimit' ) ) + { + $opt .= '%' . getGlobal( 'slurmOvbCoreLimit' ); + } + elsif( $name =~ m/^ovs_/i && defined getGlobal( 'slurmOvsCoreLimit' ) ) + { + $opt .= '%' . getGlobal( 'slurmOvsCoreLimit' ); + } + elsif( $name =~ m/^red_/i && defined getGlobal( 'slurmRedCoreLimit' ) ) + { + $opt .= '%' . int( getGlobal( 'slurmRedCoreLimit' ) / $thr ); + } + elsif( defined getGlobal( 'slurmArrayTaskLimit' ) ) + { + $opt .= '%' . getGlobal( 'slurmArrayTaskLimit' ); + } + elsif( defined getGlobal( 'slurmArrayCoreLimit' ) ) + { + $opt .= '%' . int( getGlobal( 'slurmArrayCoreLimit' ) / $thr ); + } + } + } return($opt, $off); } @@ -962,7 +992,7 @@ sub buildGridJob ($$$$$$$$$) { my $jobNameT = makeUniqueJobName($jobType, $asm); my ($jobName, $jobOff) = buildGridArray($jobNameT, $bgnJob, $endJob, getGlobal("gridEngineArrayName")); - my ($arrayOpt, $arrayOff) = buildGridArray($jobNameT, $bgnJob, $endJob, getGlobal("gridEngineArrayOption")); + my ( $arrayOpt, $arrayOff ) = buildGridArray( $jobNameT, $bgnJob, $endJob, getGlobal( "gridEngineArrayOption" ), $thr ); my $outputOption = buildOutputOption($path, $script); From 2dac29882410718ce83e71f478b729c2053795f6 Mon Sep 17 00:00:00 2001 From: Jason Bacon Date: Tue, 31 Jul 2018 16:15:33 -0500 Subject: [PATCH 2/4] Execution.pm: Restore getInstallDirectory() --- src/pipelines/canu/Execution.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pipelines/canu/Execution.pm b/src/pipelines/canu/Execution.pm index f922e5f44..75efcfbb0 100644 --- a/src/pipelines/canu/Execution.pm +++ b/src/pipelines/canu/Execution.pm @@ -342,6 +342,10 @@ sub skipStage ($$@) { sub getInstallDirectory () { my $installDir = $FindBin::RealBin; + if ($installDir =~ m!^(.*)/\w+-\w+/bin$!) { + $installDir = $1; + } + return($installDir); } From c30d9ec9e3d1a191c83395764519b7b1e5dd9e82 Mon Sep 17 00:00:00 2001 From: Jason Bacon Date: Wed, 8 Aug 2018 11:53:45 -0500 Subject: [PATCH 3/4] Clean up useless diffs --- src/pipelines/canu/Execution.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pipelines/canu/Execution.pm b/src/pipelines/canu/Execution.pm index 75efcfbb0..e6ccdefe0 100644 --- a/src/pipelines/canu/Execution.pm +++ b/src/pipelines/canu/Execution.pm @@ -996,7 +996,7 @@ sub buildGridJob ($$$$$$$$$) { my $jobNameT = makeUniqueJobName($jobType, $asm); my ($jobName, $jobOff) = buildGridArray($jobNameT, $bgnJob, $endJob, getGlobal("gridEngineArrayName")); - my ( $arrayOpt, $arrayOff ) = buildGridArray( $jobNameT, $bgnJob, $endJob, getGlobal( "gridEngineArrayOption" ), $thr ); + my ($arrayOpt, $arrayOff) = buildGridArray( $jobNameT, $bgnJob, $endJob, getGlobal( "gridEngineArrayOption" ), $thr ); my $outputOption = buildOutputOption($path, $script); From afa08fa2a1f15b098f315a4920ac662522815c7b Mon Sep 17 00:00:00 2001 From: Jason Bacon Date: Wed, 8 Aug 2018 11:54:50 -0500 Subject: [PATCH 4/4] Clean up useless diffs --- src/pipelines/canu/Execution.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pipelines/canu/Execution.pm b/src/pipelines/canu/Execution.pm index e6ccdefe0..d8b4b2d2f 100644 --- a/src/pipelines/canu/Execution.pm +++ b/src/pipelines/canu/Execution.pm @@ -996,7 +996,7 @@ sub buildGridJob ($$$$$$$$$) { my $jobNameT = makeUniqueJobName($jobType, $asm); my ($jobName, $jobOff) = buildGridArray($jobNameT, $bgnJob, $endJob, getGlobal("gridEngineArrayName")); - my ($arrayOpt, $arrayOff) = buildGridArray( $jobNameT, $bgnJob, $endJob, getGlobal( "gridEngineArrayOption" ), $thr ); + my ($arrayOpt, $arrayOff) = buildGridArray($jobNameT, $bgnJob, $endJob, getGlobal("gridEngineArrayOption"), $thr); my $outputOption = buildOutputOption($path, $script);