Re: ?: run ROOT as batch job

Nick van Eijndhoven (Nick@fys.ruu.nl)
Fri, 3 Apr 1998 09:57:19 +0200 (MET DST)


*** Dirk Meier wrote :
>
>
> Hi,
>
> I want to run root as a batch job.
> For that I need to give several macros to root like in the following
> command line (initialization, running and quit root again):
>
> my_root .x Initialization.C .x Run.C .q
>
> unfortunately this syntax seems not to work.
>
> Later I need to pass this command to the Load Sharing Facilty (LSF) on
> an atlas machine at cern. Does anybody has experience using it (or any
> other batch facility with root)?
>
>
> merci
> Dirk Meier
>
>
>
>
>
Hi Dirk,
I think a more appropriate way to run a root batch job is to to the
following (at least I am happy with it) :

* make a (shell) script which you will submit to the batch system
and put in this (shell) script the following line

root -b -q run.cc

* Define in your (shell) script the following code for run.cc
(or put the run.cc somewhere in a directory which is seen by the
batch system).

void run()
{
gSystem->Load("lib1.dll");
gSystem->Load("lib2.dll"); // just load all the libs you need

gROOT->LoadMacro("mac1.cc");
gROOT->LoadMacro("mac1.cc"); // just load all the macros you need

..... // just invoke here your the program you want to run
}

That will do what you want and provides you all the flexibility.

Note that compiled code runs faster than interpreted macros, so
it is better to make a lib out of your macros first and load that
one instead of the macros themselves.

Cheers,

_/_/ _/ _/ _/_/_/_/ _/ _/
_/ _/ _/ _/ _/ _/ _/
_/ _/ _/ _/ _/ _/_/
_/ _/_/ _/ _/ _/ _/
_/ _/ _/ _/_/_/_/ _/ _/

*----------------------------------------------------------------------*
Dr. Nick van Eijndhoven Department of Subatomic Physics
email : nick@fys.ruu.nl Utrecht University / NIKHEF
tel. +31-30-2532331 (direct) P.O. Box 80.000
tel. +31-30-2531492 (secr.) NL-3508 TA Utrecht
fax. +31-30-2518689 The Netherlands
WWW : http://www.fys.ruu.nl/~nick Office : Ornstein lab. 172
----------------------------------------------------------------------
tel. +41-22-7679751 (direct) CERN PPE Division / ALICE exp.
tel. +41-22-7675857 (secr.) CH-1211 Geneva 23
fax. +41-22-7679480 Switzerland
CERN beep : 13+7294 Office : B 160 1-012
*----------------------------------------------------------------------*