#!/usr/bin/perl use strict; use warnings; #Cambiar aqui el tiempo maximo de ejecucion my $time = '3:0:0'; my $ifile = $ARGV[0]; my $wdir = 'slurm'; mkdir $wdir; my $count = 0; open IPDF, "<$ifile" or die "Could not open input file\n$!\n"; while () { $count++; my $ofile = sprintf ("%s_%04d", 'sorder', $count); $ofile = $wdir.'/'.$ofile; open ORD, ">$ofile"; print ORD '#!/bin/bash'."\n"; print ORD '#SBATCH -J '.$ifile."\n"; print ORD '#SBATCH -c 8'."\n"; print ORD '#SBATCH --mem-per-cpu=4G'."\n"; print ORD '#SBATCH --time='.$time."\n"; #si no ha terminado en X horas matalo print ORD '#SBATCH --mail-type=FAIL,TIME_LIMIT,STAGE_OUT'."\n"; #que mande email solo cuando falle print ORD '#SBATCH --mail-user='."$ENV{'USER'}\n"; print ORD '#SBATCH -p fast'."\n"; print ORD '#SBATCH -o '.$wdir.'/'.$ifile.'-%j'."\n"; print ORD "srun $_\n"; close ORD; system("sbatch $ofile"); } close IPDF; my $orderfile = $wdir.'/'.$ifile.'_end.sh'; open ORD, ">$orderfile"; print ORD '#!/bin/bash'."\n"; print ORD '#SBATCH -J '.$ifile."\n"; print ORD '#SBATCH --mail-type=END'."\n"; #email cuando termine print ORD '#SBATCH --mail-user='."$ENV{'USER'}\n"; print ORD '#SBATCH -o '.$wdir.'/'.$ifile.'_end-%j'."\n"; print ORD ":\n"; close ORD; my $xorder = 'sbatch --dependency=singleton'.' '.$orderfile; exec($xorder);