TWiki> LHCb Web>TipsAndTricks (14 Feb 2019, _47DC_61ch_47DC_61cern_47OU_61Organic_32Units_47OU_61Users_47CN_61kzarebsk_47CN_61763242_47CN_61Kristian_32Alexander_32Zarebski? ) EditAttach

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

echo "Hello World! Hello $1!" >> hello.txt
Then a submission script hello_world.sub:
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:

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

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:

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/
LbLogin -c x86_64-slc6-gcc49-opt &&    #In this example the version of Gauss requires gcc49
SetupProject Gauss/v49r11 && $APPCONFIGOPTS/Gauss/ $APPCONFIGOPTS/Gauss/ $GAUSSOPTS/ $DECFILESROOT/options/ $LBPYTHIA8ROOT/options/

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 $APPCONFIGOPTS/...
will not work as environment variables are not read until after the run command has completed. Instead the SetupProject can be used:
SetupProject <app-name>/<version> --user-area  /location/of/app && 

however if this fails to find your local application, the application is no longer compatible and will need to be run using the run
command within the project folder by firstly dumping the environment variables into a file:

/my/app/run --sh >
note the variables can also be exported as a python dictionary using --py. This script is then sourced within the main bash script to be run
by condor prior to running the LHCb software, make sure you firstly set the correct platform for your application.


Error Code 8 'Exec format error'

This can occur because Condor does not know how to execute the script it has been handed, be sure to check that the very first line of the file has a shebang (e.g. #!/bin/bash or #!/bin/python3 etc.), also make sure it is executable using:

chmod +x <script> 

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

Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r8 - 14 Feb 2019 - _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