Tips and Tricks

Running lxplus in a Screen Session

To run a screen session on lxplus the simplest way is to add the following line to your bashrc and then use the newly created krb5screen command :

alias krb5screen="pagsh.krb -c 'kinit && screen'" 

This will prompt you for your password and then open a screen session. By default running screen on lxplus will lead to a timeout and your progress will be lost, you will no longer have write access within the session.
Don't forget to make a note of the node you are using (e.g. lxplus012) so you can return to it later.

Running Software without Knowing the Platform

If you are unsure what platform an application has been built on you can state the option "best" when choosing which to use:

lb-run -c best LHCbDirac/prod bash

this is especially useful for applications such as Dirac where, for example, we do not care necessarily version details, we just want to download files from bookkeeping.

Using the Local Batch System

At HEP Birmingham the local batch system is handled by Condor system. Jobs can be run by creating a submission script in which the executable to be run is stated along with any additional options such as file transfer.

Condor Submission Script

The submission script contains a set of parameters:

  • Universe: What style of job (usually set to "vanilla").
  • Initial_dir: The directory from which to start the job from (this is where any output files produced will be sent).
  • Executable: The script to run.
  • Error: Name and location of the error log file.
  • Output: Name and location of the job command output log file.
  • Log: Name and location of the job condor log.
  • stream_output: send the stdout live to the output file, True/False (as opposed to at the end of the job, default is False).
  • stream_error: send the stderror live to the error file, True/False (as opposed to at the end of the job, default is False).
  • should_transfer_files: Optional argument, if "YES" then files are downloaded to the Initial_dir location.
  • when_to_transfer_output: When the files should be downloaded (usually when the job is finished so "ON_EXIT").
  • arguments: Any arguments to pass to the script.
  • Queue: The number of subjobs to run.

As a simple example if we wanted to create a text file containing "Hello World!" 50 times in parallel (not recommended!), we would create a bash script hello_word.sh:

#!/bin/bash 
echo "Hello World! Hello $1!" >> hello.txt
Then a submission script hello_world.sub:
Universe=vanilla 
Initial_dir=/disk/moose/lhcb/lhcb_bham_user/my_condor_output 
Executable=/home/lhcb_bham_user/my_scripts/hello_world.sh 
Error=/disk/moose/lhcb/lhcb_bham_user/my_condor_output/hello_world_$(process).err 
Output=/disk/moose/lhcb/lhcb_bham_user/my_condor_output/hello_world_$(process).out 
Log=/disk/moose/lhcb/lhcb_bham_user/my_condor_output/hello_world_$(process).log 
should_transfer_files = YES 
when_to_transfer_files = ON_EXIT 
arguments = "LHCb Bham User" 
Queue 50

Note the use of the variable $(process) which returns the job number. To submit this job to condor first access the slc6 environment:

sl6 
condor_submit hello_world.sub 

We can then list our jobs using condor_q, and view the output live using condor_tail -f .

Using a Bash Script to Run LHCb Software

The best way to run an LHCb application is to create a bash script, this should also be made executable so Condor is able to run it:

chmod +x my_script.sh

An example script is given below in which a Gauss job is created to generate events, note it is important to assign the correct path variables and source the LHCb environment:

#!/bin/bash
shopt -s expand_aliases
export PATH="/bin:/usr/local/bin:/usr/bin:$PATH"
export HOME="/home/your_hep_bham_username"
export USER="your_hep_bham_username"
source /cvmfs/lhcb.cern.ch/group_login.sh
LbLogin -c x86_64-slc6-gcc49-opt &&    #In this example the version of Gauss requires gcc49
SetupProject Gauss/v49r11 &&
gaudirun.py $APPCONFIGOPTS/Gauss/Gauss-Job.py $APPCONFIGOPTS/Gauss/DataType-2016.py $GAUSSOPTS/GenStandAlone.py $DECFILESROOT/options/14103021.py $LBPYTHIA8ROOT/options/Pythia8.py

Using a Local Version of an LHCb Application

When it comes to running your own local development version of an LHCb app in a Condor job issues occur as using:

/my/app/run bash 

leads to the environment entered then immediately exited before commands can be executed, and alternatively:

/my/app/run gaudirun.py $APPCONFIGOPTS/...

will not work as environment variables are not read until after the run command has completed. Instead the old method of SetupProject must be used in the following way:

SetupProject <app-name>/<version> --user-area  /location/of/app && 

Adding/Removing Content to EOS on Lxplus

You can mount eos on the lxplus system to easily modify files, to mount it to your home directory:

eos -b fuse mount ~/eos 

Now you can access content for the mounted location and add/remove files, when you have finished remember to unmount after:

eos -b fuse unmount ~/eos

-- KristianAlexanderZarebski? - 29 Oct 2018


This topic: LHCb > TipsAndTricks
Topic revision: r5 - 21 Nov 2018 - _47DC_61ch_47DC_61cern_47OU_61Organic_32Units_47OU_61Users_47CN_61kzarebsk_47CN_61763242_47CN_61Kristian_32Alexander_32Zarebski
 
This site is powered by the TWiki collaboration platform Powered by Perl This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback