KinKal
Local KinKal development with Muse
Initial build
To develop new code in KinKal and call it in Offline you will need to define your own version of KinKal and install it in your own private extension to UPS. You need to do some initial setup in a throwaway shell:
- create a Muse workDir and cd there
setup mu2e mkdir 'myworkdir' cd 'myworkdir'
- checkout your fork of Offline in the muse workdir as you would normally
git clone git@github.com:<your GitHub username>/Offline cd Offline git remote add -f mu2e https://github.com/Mu2e/Offline git checkout -b work_branch mu2e/master cd ..
- create a fork of KinKal in GitHub (if you don't already have one). In a browser, go to the KinKal GitHub page, then under the 'fork' menu select 'Create a new fork'. You must be logged in to your GitHub account.
- checkout your fork of KinKal in the muse workdir .The KinKal development model is the same as Offline: start with the head of main, create your own branch, develop and commit to that, and make a PR to KinKal when your development is ready.
git clone git@github.com:<your GitHub username>/KinKal cd KinKal git remote add -f mu2e https://github.com/KFTrack/KinKal git checkout -b work_branch mu2e/main cd ..
- checkout KinKal_to_UPS
git clone https://github.com/Mu2e/KinKal_to_UPS
- setup Muse
muse setup
this puts a root and other products in the environment, which the KinKal build will detect
- build KinKal according to the instructions in README. make sure to run the test (make test)
mkdir build_profile cd build_profile cmake ../KinKal -DCMAKE_BUILD_TYPE=Release [or Debug] make -j 20 make test cd ..
- create the directory 'artexternals' in the muse workdir. Copying in the upsfiles makes UPS recognize this area.
mkdir artexternals rsync -aur /cvmfs/mu2e.opensciencegrid.org/artexternals/.upsfiles artexternals/
- install this build in artexternals. For version, it can be arbitrary, it shouldn't correspond to an actual tag. It will only be used to point to this artexternals area. IN this case we used the next logical tag, in anticipation of the local development becoming the next version.
KinKal_to_UPS/build -v v0.1.6 -i
- create an envset that points to your local UPS version of KinKal
- find the envset recommended for the current Offline
> grep ENVSET Offline/.muse ENVSET p003
- copy it locally
mkdir muse cp $MUSE_ENVSET_DIR/p003 muse/u004
- edit muse/u004 so that it sets up your local version of KinKal
setup -B KinKal v00_01_06 -q +${MUSE_BUILD}:+${MUSE_COMPILER_E}:+${MUSE_PYTHON}
At this point, the KinKal is built and UPS-installed locally. Now start a new shell, because we need to setup again, this time with this local build in the environment.
- create a new shell, and cd to your muse workdir
setup mu2e
- execute the following, to tell UPS to look here first for your products
export PRODUCTS=${PWD}/artexternals:${PRODUCTS}
- setup muse, now using the envset you created, which points to your local KinKal installation
muse setup -q u004
- and build Offline
muse build -j 20
Rebuilding KinKal
assuming you are in a fully setup environment, where you could run the code, for example,
- edit KinKal as needed
- rebuild KinKal
cd build_profile make -j 20 make test cd ..
- now re-install this build in the UPS artexternals area, it will overwrite the previous
KinKal_to_UPS/build -v v0.1.6 -i
Returning to the area
- to return in a new shell, you only need to repeat the setups:
cd workDir setup mu2e export PRODUCTS=${PWD}/artexternals:${PRODUCTS} muse setup -q u004
Adding debug build
An environment can only be setup once, so for an process, you must choose one or the other. The steps all follow form the prof build
- setups. Setup muse in debug. Since you don't have the new KinKal in debug, you can setup root by setting up the published versions
setup mu2e cd workDir muse setup -q debug (defaults to envset p003)
- build debug KinKal using the same fake version as for prof
mkdir build_debug cd build_debug cmake ../KinKal -DCMAKE_BUILD_TYPE=Debug make -j 20 make test cd .. KinKal_to_UPS/build -v v0.1.6 -i
- now that the debug version of the local KinKal product is available, you need to setup in new process to get the full environment
cd workDir setup mu2e export PRODUCTS=${PWD}/artexternals:${PRODUCTS} muse setup -q u004:debug
What if you update Offline?
If you update the version of Offline in your working area:
- Compare the old and new versions of Offline to see if the version or qualifiers of root have changed.
- If they have not, you are done with this section. If they have, then you need to do the following:
- Make a new build of KinKal using the modified root and install it in your local artexternals directory.
- Hint: you may wish to investigate the -s versionSuffix option in KinKal_to_UPS.
- Hint: remember to start a new login session
- Follow the instructions in Muse#Maintaining_a_Customized_Setup to update your local muse/uNNN file to select your new build of KinKal.
Original Notes
To develop new code in KinKal and call it in Offline you will need to define your own version of KinKal and install it in your own private extension to UPS. You need to do some initial setup in a throwaway shell:
- create a Muse workDir and cd there
- checkout your fork of Offline in the muse workdir as you would normally
- checkout your fork of KinKal in the muse workdir .The KinKal development model is the same as Offline: start with the head of main, create your own branch, develop and commit to that, and make a PR to KinKal when your development is ready.
- checkout tag v0.1.4 of KinKal_to_UPS
- build KinKal according to the instructions in README. make sure to run the test (make test)
- create the directory 'artexternals' in the muse workdir
- execute 'muse setup -q (prof, debug) depending on what you want. Note you can have both builds in the same workdir, but any given shell can be only one or the other.
- invoke KinKal_to_UPS/build -v your_version -i -b -j10, where your_version is whatever version you want (it is temporary). I have this command saved in a script /mu2e/app/users/brownd/KFTrack/install_KinKal.sh
- define a user envset in the ./muse directory. mine is /mu2e/app/users/brownd/KFTrack/muse/u002 The name is unimportant. Edit that so it refers to your_version of KinKal
Then, close that shell. From then on, you can work with KinKal and/or Offline in this muse workdir with the following commands:
- create a new shell, and cd to your muse workdir
- exectue 'export PRODUCTS=${PWD}/artexternals:${PRODUCTS}' This tells UPS to look for KinKal in your local install
- execute 'muse setup -q (prof, debug) your_envset'
(I have these defined as /mu2e/app/users/brownd/KFTrack/setup_prof.sh and setup_debug.sh in my area)'
- Any time you change KinKal rebuild and rerun the tests, and then rerun install_KinKal.sh
- Any time you change Mu2eKinKal (or after changing and rebuilding KinKal as above) rebuild Offline using 'muse build'