From 0a03ec67f7326b986c59ebb8929afba06468f3b7 Mon Sep 17 00:00:00 2001
From: Cedric Cabau <cedric.cabau@inra.fr>
Date: Mon, 2 Oct 2017 13:54:23 +0000
Subject: [PATCH] Fix bug for shifting to hypermemq: totalMem=h_vmem*n_cpu

---
 tags/drap-v1.91/bin/submitJob | 7 +++++--
 trunk/bin/submitJob           | 7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/tags/drap-v1.91/bin/submitJob b/tags/drap-v1.91/bin/submitJob
index ca23159..d4cc85b 100755
--- a/tags/drap-v1.91/bin/submitJob
+++ b/tags/drap-v1.91/bin/submitJob
@@ -90,8 +90,11 @@ if ($command) {
 }
 
 (my $h_vmem = $opt->{resources}) =~ s/.*h_vmem=(\d+)G.*/$1/;
-($h_vmem ||= $opt->{options}) =~ s/.*h_vmem=(\d+)G.*/$1/;
-$opt->{queue} ||= $h_vmem && $h_vmem > $node_max_mem ? $mem_queue : $default_queue;
+(my $n_cpu) = $opt->{resources} =~ /.*-pe parallel_\w+ (\d+).*/;
+($h_vmem = $opt->{options}) =~ s/.*h_vmem=(\d+)G.*/$1/ unless ($h_vmem);
+($n_cpu) = $opt->{options} =~ /.*-pe parallel_\w+ (\d+).*/ unless ($n_cpu);
+$n_cpu ||= 1;
+$opt->{queue} ||= $h_vmem && $h_vmem * $n_cpu > $node_max_mem ? $mem_queue : $default_queue;
 $opt->{sync} = 'y' if (defined($opt->{sync}));
 my @arguments;
 foreach my $option (@sge_opt_order) {
diff --git a/trunk/bin/submitJob b/trunk/bin/submitJob
index ca23159..d4cc85b 100755
--- a/trunk/bin/submitJob
+++ b/trunk/bin/submitJob
@@ -90,8 +90,11 @@ if ($command) {
 }
 
 (my $h_vmem = $opt->{resources}) =~ s/.*h_vmem=(\d+)G.*/$1/;
-($h_vmem ||= $opt->{options}) =~ s/.*h_vmem=(\d+)G.*/$1/;
-$opt->{queue} ||= $h_vmem && $h_vmem > $node_max_mem ? $mem_queue : $default_queue;
+(my $n_cpu) = $opt->{resources} =~ /.*-pe parallel_\w+ (\d+).*/;
+($h_vmem = $opt->{options}) =~ s/.*h_vmem=(\d+)G.*/$1/ unless ($h_vmem);
+($n_cpu) = $opt->{options} =~ /.*-pe parallel_\w+ (\d+).*/ unless ($n_cpu);
+$n_cpu ||= 1;
+$opt->{queue} ||= $h_vmem && $h_vmem * $n_cpu > $node_max_mem ? $mem_queue : $default_queue;
 $opt->{sync} = 'y' if (defined($opt->{sync}));
 my @arguments;
 foreach my $option (@sge_opt_order) {
-- 
GitLab