On Tue, 26 Mar 2013 11:09:14 -0400
[email protected] [email protected] wrote:
Hi,
> => I'm migrating a bash jsv script to perl and adding some
> => modifications, but I have some doubts:
>
> I'd really like to see your finished script, if you don't mind. I'm
> currently using a bash JSV, and one of the things on my ToDo list is
> to convert it to perl...
I don't find the document where this is explained, but jsv script
performance in bash/perl is a problem (I've seen it in a VM), so the
change is a MUST!
the script is something like:
#!/usr/bin/perl
use strict;
use warnings;
no warnings qw/uninitialized/;
use Env qw(SGE_ROOT);
use lib "$SGE_ROOT/util/resources/jsv";
use JSV qw( :DEFAULT jsv_send_env jsv_log_info );
use Data::Dumper;
use Storable;
# my $sge_root = $ENV{SGE_ROOT};
# my $sge_arch = qx{$sge_root/util/arch};
jsv_on_start(sub {
jsv_send_env();
});
jsv_on_verify(sub {
my %params = jsv_get_param_hash();
my $do_correct = 0;
#if ($params{GROUP};
# You must ask for a queue
if (!(exists $params{q_hard})) {
jsv_log_info ('No queue specified, your job will be submitted
to short queue');
jsv_sub_add_param('q_hard','short');
$do_correct = 1;
}
# You must ask for time limit
if (!(exists $params{l_hard}{h_rt})) {
jsv_sub_add_param('l_hard','h_rt','6:00:00');
jsv_log_info ('No time requested, default is 6h');
$do_correct = 1;
}
# Binding strategy: we don't want user to specify it. Reject job if
someone ask for some stragety
if (exists $params{binding_strategy}) {
jsv_log_info ('Are you sure you want to specify binding
startegy?');
jsv_reject ('contact us: XXXX');
return;
}else{
# If not specified we will add it:
# No PE:
if (!(exists $params{pe_name})) {
# -------------------------------------------
# in case no parallel environment was chosen
# add a default request of one processor core
# -------------------------------------------
# set the binding strategy to linear (without given
start point: linear)
jsv_sub_add_param('binding_type','set');
jsv_sub_add_param('binding_amount','1');
jsv_sub_add_param('binding_strategy','linear');
jsv_log_info ('Core binding added');
}elsif ($params{pe_name} eq 'smp'){
# This is a SMP job. First, add Reservation:
jsv_sub_add_param('R','y');
jsv_log_info ('Parallel Job needs a reservation');
# --------------------------------------------
# "smp" was requested but no core binding
# -> set linear allocation with pe max slots
# --------------------------------------------
# max amount of requested slots (smp)
jsv_sub_add_param('binding_type','set');
jsv_sub_add_param('binding_amount',"$params{pe_max}");
jsv_sub_add_param('binding_strategy','linear');
}elsif ($params{pe_name} eq 'ompi'){
# This is a SMP job. First, add Reservation:
jsv_sub_add_param('R','y');
jsv_log_info ('Parallel Job needs a reservation');
# --------------------------------------------
# "ompi" was requested but no core binding
# -> set linear allocation with pe max slots
# --------------------------------------------
# max amount of requested slots (smp)
#jsv_sub_add_param('binding_type','set');
#jsv_sub_add_param('binding_amount',"$params{pe_max}");
#jsv_sub_add_param('binding_strategy','linear');
}
}
if ($do_correct) {
jsv_log_info ('Your jobs has been corrected, it means you
missed some params at submit time. Please read http://www.linux.crg.es');
}
jsv_correct('Job is corrected');
jsv_accept('Job is accepted');
});
jsv_main();
Based on
https://github.com/HPCKP/JSV-for-Grid-Engine/blob/master/jsv_core_binding.sh
comments are welcome!
Cheers,
Arnau
_______________________________________________
users mailing list
[email protected]
https://gridengine.org/mailman/listinfo/users