META TOPICPARENT |
name="CMSPublic" |
1.4 CMS Computing Concepts: Programming, GitHub, etc
Complete:
Detailed Review status
Goals of this page
You will learn what programming language(s) you are expected to know, what software packages you should be familiar with, and how to access software from the
code repository.
Note that in 2013, the CMS software repository was moved from CVS to git. CMS no longer uses CVS. The new git software repository is hosted at a website called
GitHub , which provides extra features beyond git's file version control.
Contents
Operating Systems
Familiarity with Linux is necessary. Current versions of the CMS Offline software, CMSSW, run on Scientific Linux CERN 6 (SLC6) (which
is built on Scientific Linux 6 (SL6), which is in turn built on Red Hat Enterprise Linux 6 (RHEL6)). Run I (2010-2012) was based on SL*5. (The upgrading process, from
versions SL*5 to SL*6, started in 2014, and the 7_0_0 release).
Programming Languages
CMSSW code is written in C++. You will need to be able to write compatible code in C++. There are many good text books available. See Walter Brown's (of
FNAL) book recommendations for C++ Programmers
.
Analysis Packages
You will need to know how to use ROOT. It is an object-oriented data analysis framework.
GitHub
CMS software, including CMSSW, is now maintained in a GitHub software repository.
You'll need to use GitHub to check out code and configuration files to your area so that you can modify and use them. There
are lots of working examples in GitHub for you to try; various workbook tutorials point you to specific directories. Since
CMSSW is such a large project we use the sparse check-out features of git. Because of this it is highly recommended that you look at the CMS git
tutorials to understand how this is done.
Here we give instructions on checking out code from GitHub. When you are working in the CMS environment, you can run any of the CMS code
in the release without checking it out. You only need to "check out" code that you need to modify, code that has been modified by someone else, or code that
depends on modified code. Then that code can be rebuilt.
A "release" is a set of software which has a version number and has been thoroughly tested to all work together. The CMS code evolves with stable, working
releases numbered and advertised from time to time as a recommended set of code to use.
Git Documentation
The primary documentation for usage of git in CMS is at
the following locations:
The information located there is much more detailed and complete that
the information that follows.
(Warning: Early in the introduction of git into CMS, CMS created a thing called the Topic Collector which some documentation still references. The Topic
Collector is no longer used for any purpose. GitHub directly offers features that replace that functionality and now we use them. If you see references or
links to the Topic Collector, you should understand you are looking at obsolete documentation that needs to be updated)
Obtaining a personal GitHub account:
If you want to modify code and then have your modifications merged
into the official repository of CMSSW code, you will need a personal
GitHub account. You would first edit the code and commit it to a git
repository on the machine where you work (maybe the machine on your
desk or lxplus). Then you would push the changes to the repository in
your personal GitHub account. Then you would issue a pull request to
have the modifications pulled from your personal GitHub repository
to the official CMSSW GitHub repository by a release manager.
A personal GitHub account has other uses. It is also a useful
way to send your code modifications to other people or groups. It can
also be used as a way to backup code modifications that you make
and maintain version control of your own personal code.
But a personal GitHub account is only mandatory if you want to merge code
into the official CMSSW code repository. You can download code,
build it, and run it locally without a personal GitHub account.
First you have to obtain a GitHub account. Go to github.com and follow the instructions to open a new account if you do not already
have one.
Then fork the official CMSSW repository. That creates a copy of it in your personal GitHub account. Fork by going to https://github.com/cms-sw/cmssw and
click on the fork button and follow the instructions. After the forking is done you see you have a new repository cmssw,
https://github.com/<your-username>/cmssw.
Setup personal information
- Login on lxplus at CERN or wherever you plan to do your code development work.
- Run the following commands:
- git config --global user.name "First name Last name"
- git config --global user.email <Your-Email-Address>
- git config --global user.github <Your-Just-Created-GitHub-Account-Username>
Easy access of GitHub (optional)
yourKey.pub
- To use your key you have to execute following commands after each login:
-
eval $(ssh-agent); ssh-add /path/to/your/key
- Test your configuration:
ssh -T git@github.com
- You should see: Hi XYZ! You've successfully authenticated, but GitHub does not provide shell access.
Checkout a CMSSW package from Git
<-- * At the moment due to different CMSSW Git repositories a modified git-cms-addpkg is needed:
export PATH=~fhohle/public/gitCMSSW:$PATH
-->
- Setup a CMSSW environment
cmsrel CMSSW_7_4_15
cd CMSSW_7_4_15/src
cmsenv
- Checkout a package, e.g.
PhysicsTools/PatExamples
git cms-addpkg PhysicsTools/PatExamples
No release tags specified, using default CMSSW_7_4_15.
...
You are on branch from-CMSSW_7_4_15
Checking out packages
PhysicsTools/PatExamples
* Create your own development branch e.g. mydev
git checkout -b mydev
Switched to a new branch 'mydev'
- Check which branches are available
git branch
CMSSW_7_4_X
from-CMSSW_7_4_15
* mydev
echo '#modfication' >> PhysicsTools/PatExamples/BuildFile.xml #this adds a line containing #modification at the end of BuildFile.xml
- Check if modification is recognized
git status
# On branch mydev
# Changes not staged for commit:
# (use "git add ..." to update what will be committed)
# (use "git checkout -- ..." to discard changes in working directory)
#
# modified: PhysicsTools/PatExamples/BuildFile.xml
#
no changes added to commit (use "git add" and/or "git commit -a")
- Add and commit your changes
git add PhysicsTools/PatExamples/BuildFile.xml
git commit -m "test message"
[mydev 6812826] test message
1 files changed, 1 insertions(+), 0 deletions(-)
Your modifications were commited to your local git repository.
You can push these changes to your personal GitHub
repository with the following command.
git push my-cmssw mydev
(just an example illustrating how to create a new topic based on a specific template topic. TWikiTemplates has more)
-- JuanEduardoRamirez - 2015-12-07 |