CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
How can I convert my script for submitting SLURM jobs from Bash to Perl?

 



erhan
New User

Feb 18, 2015, 2:36 PM

Post #1 of 2 (6075 views)
How can I convert my script for submitting SLURM jobs from Bash to Perl? Can't Post

I have the following Bash script for job submission to SLURM on a cluster:

Code
#!/bin/bash 
#SBATCH -A 1234
#SBATCH -t 2-00:00
#SBATCH -n 24

module add xxx
srun resp.com


The #SBATCH lines are SLURM commands:

#SBATCH -A 1234 is the project number (1234)
#SBATCH -t 2-00:00 is the job time
#SBATCH -n 24 is the number of cores

module add xxx loads the Environment Module xxx (in this case I'm actually using module add gaussian, where gaussian is a computational quantum-chemistry program).

srun is the SLURM command to launch a job. resp.com includes commands for gaussian and atom coordinates.

I tried converting the Bash script to the following Perl script, but it didn't work. How can I do this in Perl?


Code
#!/usr/bin/perl  

use strict;
use warnings;
use diagnostics;

system ("#SBATCH -A 1234");
system ("#SBATCH -t 2-00:00");
system ("#SBATCH -n 24");

system ("module add xxx");
system ("srun resp.com ");



FishMonger
Veteran / Moderator

Feb 18, 2015, 4:11 PM

Post #2 of 2 (6052 views)
Re: [erhan] How can I convert my script for submitting SLURM jobs from Bash to Perl? [In reply to] Can't Post

It's considered polite to inform us that you posted this question on other forums so that we don't waste our time providing answers that you may have received in those other forums. In this case I'm specifically referring to your cross post on perlmnks.
http://www.perlmonks.org/?node_id=1117141

Instead of trying to do a verbatim "conversion", you should search cpan to see if there is a module related to your needs and it appears that there is such a module.

Runner::Slurm http://search.cpan.org/~jillrowe/Runner-Init-2.32/lib/Runner/Slurm.pm

I've never used the module and until now I never heard of SLURM.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives