Difference between revisions of "Modern C Compiler, ROOT, Geant"

From PDP/Grid Wiki
Jump to navigationJump to search
m (Templon@nikhef.nl moved page Modern C Compiler to Modern C Compiler, ROOT, Geant: Renamed)
Line 79: Line 79:
  
 
Change XXX to the right LCG release tag, X.Y.Z to the right gcc version you found, and "platform" to the right platform you found.
 
Change XXX to the right LCG release tag, X.Y.Z to the right gcc version you found, and "platform" to the right platform you found.
 +
 +
'''note: csh users need the setup.csh file'''
 +
We (PDP) assume that the csh setup works correctly, we have no csh users so we don't know for sure ;-)
  
 
=== Compile your code ===
 
=== Compile your code ===

Revision as of 15:24, 8 November 2016

Introduction

So you want a modern C compiler and/or some other tool. As of this writing (2 November 2016) the normal desktop machines have

gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC)

as the default compiler. This is not recent enough for much of the HEP code ecosystem.

Modern C compilers can be found in a repository called "SFT" which is maintained by CERN, and distributed via something called CVMFS which is installed on stoomboot machines and most of the desktop machines (older ones may not have it). You can check whether you have it with:

ls /cvmfs/sft.cern.ch

if you don't get an error (and it says "lcg") then you're good. What you'll need to do to set up the compiler is:

  1. figure out what kind of platform you'll be running on
  2. poke around in SFT to find out what the current release is
  3. run the setup script
  4. compile your code and win the Nobel Prize.

Figure out your platform

You'll generally need to compile for a specific platform; go (one of) the machine(s) on which you'll be running your code and type

cat /etc/issue

Today on one of the stoomboot worker nodes, it says

Scientific Linux CERN SLC release 6.8 (Carbon)
Kernel \r on an \m

Remember that first line, that tells you the platform, you'll need it shortly.

Poke around in SFT and find the relevant release and compiler

stbc-022:lcg> ls /cvmfs/sft.cern.ch/lcg
app	 dev  external	LCG85b	  lcgjenkins  mapfile.txt	    mapfile.txt.05042016  mapfile.txt.16092016	nightlies  releases-javier	   updatemapfile.py
contrib  etc  hepsoft	lcgcmake  mapfile.ts  mapfile.txt.01052016  mapfile.txt.13042016  mapfile.txt.18082016	releases   root-training-setup.sh  views

Note the LCG85b ... this is generally a listing of the latest full release; when there is a new release, the tag gets updated, so you might see LCG91, LCG93c, etc instead. Whatever it is, this is the latest release (there are many older releases available btw).

You can search for gcc in that LCG85b file, but it's easier to look at the file system. Note I've replaced below, "LCG_85b" with "LCG_XXX" in commands to help avoid mistakes made via blind copy-and-pasting. Change the XXX to whatever you find the most recent release to be!

stbc-022:LCG_85b> cd /cvmfs/sft.cern.ch/lcg/releases/LCG_XXX
stbc-022:LCG_85b> ls 
4suite	      curl	       GSL		  jupyter_console			       m4		  oracle	  pylint	   root_numpy	   urllib3
AIDA	      cx_oracle        gtest		  jupyter_core				       MarkupSafe	  pacparser	  pyminuit	   rootpy	   uuid
astroid       cycler	       hepdata_converter  lapack				       matplotlib	  pandas	  pyparsing	   rpy2		   valgrind
autoconf      Davix	       hepdata_validator  LCGCMT				       MCGenerators	  pathlib2	  pyqt		   scikitlearn	   vdt
automake      decorator        HepMC		  lcgenv				       messaging	  pathos	  pyqt5		   scipy	   vectorclass
backports     distribute       hepmc3		  LCG_externals_x86_64-centos7-gcc49-dbg.txt   metakernel	  pcre		  pytest	   setuptools	   wcwidth
blas	      doxygen	       HepPDT		  LCG_externals_x86_64-centos7-gcc49-opt.txt   mistune		  pexpect	  Python	   simplegeneric   wheel
Boost	      eigen	       igprof		  LCG_externals_x86_64-slc6-gcc49-dbg.txt      mock		  pickleshare	  python_dateutil  singledispatch  widgetsnbextension
castor	      elasticsearch    ipykernel	  LCG_externals_x86_64-slc6-gcc49-opt.txt      mpich2		  pip		  pytimber	   sip		   xapian
ccache	      entrypoints      ipython		  LCG_generators_x86_64-centos7-gcc49-dbg.txt  multiprocessing	  pkg_config	  pytools	   six		   XercesC
certifi       expat	       ipython_genutils   LCG_generators_x86_64-centos7-gcc49-opt.txt  mysql		  prettytable	  pytz		   soqt		   xqilla
clhep	      fastjet	       ipywidgets	  LCG_generators_x86_64-slc6-gcc49-dbg.txt     mysql_python	  processing	  pyxml		   spark	   xrootd
CMake	      fftw3	       java		  LCG_generators_x86_64-slc6-gcc49-opt.txt     nbconvert	  prompt_toolkit  pyyaml	   sqlalchemy	   xrootd_python
cmaketools    fjcontrib        jemalloc		  lcov					       nbformat		  ptyprocess	  pyzmq		   sqlite	   yamlcpp
cmmnbuild     freetype	       Jinja2		  lhapdfsets				       networkx		  py		  QMtest	   stomppy	   zeromq
cmt	      frontier_client  joblib		  libaio				       neurobayes	  py2neo	  qt		   storm	   zlib
coin3d	      gcc	       jpype		  libsvm				       neurobayes_expert  py4j		  qt5		   subprocess32
configparser  Geant4	       json		  libtool				       ninja		  pyanalysis	  qtconsole	   swig
COOL	      genshi	       jsonc		  libunwind				       nose		  pyapigitlab	  qwt		   sympy
CORAL	      gmp	       jsoncpp		  libxml2				       notebook		  pydot		  R		   tbb
CouchDB       gperftools       jsonschema	  libxslt				       numexpr		  pygments	  RELAX		   terminado
coverage      graphviz	       jupyter		  logilabcommon				       numpy		  pygraphics	  requests	   tornado
CppUnit       Grid	       jupyter_client	  lxml					       openssl		  pygsi		  ROOT		   traitlets

There is a lot of stuff in here that might be interesting to you (eg ROOT and Geant4). See that gcc is also listed, list that directory to see the options:

stbc-022:LCG_85b> ls gcc
4.9.3
stbc-022:LCG_85b> ls gcc/4.9.3
x86_64-centos7	x86_64-slc6

So gcc 4.9.3 is there, and there are two versions. Now the /etc/issue business above becomes relevant: it said "Scientific Linux CERN SLC release 6.8" which corresponds to the "slc6" version here, so that's the one you want to use in this example.

stbc-022:LCG_85b> ls gcc/4.9.3/x86_64-slc6
bin  include  lib  lib64  libexec  setup.csh  setup.csh~  setup.sh  setup.sh~  share

Run the setup script

You want that setup.sh file ..

source /cvmfs/sft.cern.ch/lcg/releases/LCG_XXX/gcc/X.Y.Z/x86_64-platform/setup.sh

Change XXX to the right LCG release tag, X.Y.Z to the right gcc version you found, and "platform" to the right platform you found.

note: csh users need the setup.csh file We (PDP) assume that the csh setup works correctly, we have no csh users so we don't know for sure ;-)

Compile your code

Now you'll have the right stuff in your path, etc to use this version of gcc:

stbc-022:x86_64-slc6> gcc --version
gcc (GCC) 4.9.3
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

stbc-022:x86_64-slc6> g++ --version
g++ (GCC) 4.9.3
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Enjoy that prize. Don't forget to mention the PDP group in your speech.