KinKal: Difference between revisions
Line 3: | Line 3: | ||
===Initial build=== | ===Initial build=== | ||
To develop new code in KinKal | To develop new code in KinKal for new use cases in Offline you will need to checkout KinKal and install it in your own private extension to UPS. You need to do some initial setup in a throwaway shell: | ||
You need to do some initial setup in a throwaway shell: | |||
* create a [[Muse]] workDir and cd there | * create a [[Muse]] workDir and cd there | ||
* setup Muse. This puts a root and other products in the environment, which the KinKal build will use | |||
<pre> | <pre> | ||
mkdir 'myworkdir' | mkdir 'myworkdir' | ||
cd 'myworkdir' | cd 'myworkdir' | ||
Line 21: | Line 20: | ||
</pre> | </pre> | ||
* create a fork of KinKal in GitHub (if you don't already have one). In a browser, go to the [https://github.com/KFTrack/KinKal KinKal GitHub page], then under the 'fork' menu select 'Create a new fork'. You must be logged in to your GitHub account. | * create a fork of KinKal in GitHub (if you don't already have one). In a browser, go to the [https://github.com/KFTrack/KinKal 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. Start with the current version of KinKal | |||
* 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. | |||
<pre> | <pre> | ||
git clone git@github.com:<your GitHub username>/KinKal | git clone git@github.com:<your GitHub username>/KinKal | ||
cd KinKal | cd KinKal | ||
git remote add -f mu2e https://github.com/KFTrack/KinKal | git remote add -f mu2e https://github.com/KFTrack/KinKal | ||
git checkout -b work_branch mu2e/ | git checkout -b work_branch mu2e/$KINKAL_VERSION | ||
cd .. | cd .. | ||
</pre> | </pre> | ||
* build KinKal according to the instructions in README. You can build either a profile (optimized) | * build KinKal according to the instructions in README. You can build either a profile (optimized) | ||
or debug. If you want both, just repeat this step. | or debug. If you want both, just repeat this step. | ||
mkdir build_profile (or build_debug) | mkdir build_profile (or build_debug) | ||
cd build_profile (or build_debug) | cd build_profile (or build_debug) | ||
Line 48: | Line 37: | ||
cd .. | cd .. | ||
</pre> | </pre> | ||
* | * checkout KinKal_to_UPS, and use it to make your build of KinKal visible to Offline through UPS. | ||
<pre> | <pre> | ||
git clone https://github.com/Mu2e/KinKal_to_UPS | |||
mkdir artexternals | mkdir artexternals | ||
rsync -aur /cvmfs/mu2e.opensciencegrid.org/artexternals/.upsfiles artexternals/ | rsync -aur /cvmfs/mu2e.opensciencegrid.org/artexternals/.upsfiles artexternals/ | ||
</pre> | </pre> | ||
* install | * install your build of KinKal in artexternals. You must assign a tag to your build; the value is arbitrary, but it shouldn't correspond to an actual tag. Below a dummy is used. | ||
<pre> | <pre> | ||
KinKal_to_UPS/build -v v9.9.9 -i -d artexternals | KinKal_to_UPS/build -v v9.9.9 -i -d artexternals | ||
Line 65: | Line 55: | ||
... | ... | ||
</pre> | </pre> | ||
At this point, KinKal is built and UPS-installed locally, but the current setup of Offline still points to the old version of KinKal. To get Offline to use your new version of KinKal you need a new shell. Close your existing shell, and start a new one, then cd back to your work directory. Note you only need to do this when setting up a new work directory; the following commands are needed for all subsequent use of this workdir | |||
At this point, | * close your current shell | ||
* create a new shell, and cd to your muse workdir. | * create a new shell, and cd to your muse workdir. | ||
* | * Tell UPS where to look find your local version of KinKal | ||
* setup muse, specifying the envset you created, which points to your local KinKal installation | * setup muse, specifying the envset you created, which points to your local KinKal installation | ||
<pre> | <pre> | ||
exit (closes the current shell) | |||
ssh 'myuser'@mu2egpvm04.fnal.gov | ssh 'myuser'@mu2egpvm04.fnal.gov | ||
cd 'myworkdir' | cd 'myworkdir' | ||
setup mu2e | setup mu2e | ||
export PRODUCTS=${PWD}/artexternals:${PRODUCTS} | export PRODUCTS=${PWD}/artexternals:${PRODUCTS} | ||
muse setup -q u999 | |||
</pre> | </pre> | ||
* Now build Offline (and any other muse-aware repos you've cloned) | * Now build Offline (and any other muse-aware repos you've cloned) | ||
Line 81: | Line 72: | ||
===Rebuilding KinKal=== | ===Rebuilding KinKal=== | ||
Once you have a stock build of Offline and KinKal, you can can develop both code sets coherently. | |||
* edit KinKal as needed | * edit KinKal as needed | ||
* rebuild KinKal | * edit Offline as needed to exploit new KinKal features | ||
* rebuild KinKal and update the installation | |||
* rebuild Offline | |||
<pre> | <pre> | ||
(edit KinKal/*/*) | |||
(edit Offline/*/*) | |||
cd build_profile | cd build_profile | ||
make -j 20 | make -j 20 | ||
make test | make test | ||
cd .. | cd .. | ||
KinKal_to_UPS/build -v v9.9.9 -i -d artexternals | |||
muse build | |||
</pre> | </pre> | ||
===Returning to the area=== | ===Returning to the area=== | ||
* to return in a new shell, you only need to repeat the setups: | * to return in a new shell and simply run the code you've already edited and built, you only need to repeat the setups: | ||
<pre> | <pre> | ||
cd | cd 'workdir' | ||
setup mu2e | setup mu2e | ||
export PRODUCTS=${PWD}/artexternals:${PRODUCTS} | export PRODUCTS=${PWD}/artexternals:${PRODUCTS} | ||
muse setup -q | muse setup -q u999 | ||
</pre> | </pre> | ||
Line 107: | Line 101: | ||
<pre> | <pre> | ||
setup mu2e | setup mu2e | ||
cd | cd 'workdir' | ||
muse setup -q debug | muse setup -q debug | ||
</pre> | </pre> | ||
* build debug KinKal using the same fake version as for prof | * build debug KinKal using the same fake version as for prof | ||
Line 118: | Line 112: | ||
make test | make test | ||
cd .. | cd .. | ||
KinKal_to_UPS/build -v | KinKal_to_UPS/build -v v9.9.9 -i -d artexternals | ||
</pre> | </pre> | ||
* now that the debug version of the local KinKal product is available, you need to setup in new | * now that the debug version of the local KinKal product is available, you need to setup in a new shell to get the full environment | ||
<pre> | <pre> | ||
cd | exit | ||
ssh 'myuser@mu2egpvm04.fnal.gov' | |||
cd 'workdir' | |||
setup mu2e | setup mu2e | ||
export PRODUCTS=${PWD}/artexternals:${PRODUCTS} | export PRODUCTS=${PWD}/artexternals:${PRODUCTS} | ||
muse setup -q | muse setup -q u999:debug | ||
muse build | |||
</pre> | </pre> | ||
Revision as of 16:29, 14 July 2023
Local KinKal development with Muse
Initial build
To develop new code in KinKal for new use cases in Offline you will need to checkout 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 Muse. This puts a root and other products in the environment, which the KinKal build will use
mkdir 'myworkdir' cd 'myworkdir'
- checkout your fork of Offline in the muse workdir as you would normally. Add the main mu2e repo as a remote. If you need other muse-aware repos (Production, TrkAna, ...) for your workflow, you can add them too
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 .. (git clone git@github.com:<your GitHub username>/TrkAna.git)
- 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. Start with the current version of KinKal
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/$KINKAL_VERSION cd ..
- build KinKal according to the instructions in README. You can build either a profile (optimized)
or debug. If you want both, just repeat this step. mkdir build_profile (or build_debug) cd build_profile (or build_debug) cmake ../KinKal -DCMAKE_BUILD_TYPE=Release (or Debug) make -j 20 make test cd ..
- checkout KinKal_to_UPS, and use it to make your build of KinKal visible to Offline through UPS.
git clone https://github.com/Mu2e/KinKal_to_UPS mkdir artexternals rsync -aur /cvmfs/mu2e.opensciencegrid.org/artexternals/.upsfiles artexternals/
- install your build of KinKal in artexternals. You must assign a tag to your build; the value is arbitrary, but it shouldn't correspond to an actual tag. Below a dummy is used.
KinKal_to_UPS/build -v v9.9.9 -i -d artexternals
- create an envset that points to your local UPS version of KinKal. Start with a copy of the current Offline envset.
- edit the copy so that it references your local version of KinKal. IE replace the tag in the line 'setup -B KinKal v00_01_06 -q +${MUSE_BUILD}:+${MUSE_COMPILER_E}:+${MUSE_PYTHON}' with your tag (v09_09_09)
mkdir muse cp $MUSE_ENVSET_DIR/$MUSE_ENVSET muse/u999 vim muse/u999 ...
At this point, KinKal is built and UPS-installed locally, but the current setup of Offline still points to the old version of KinKal. To get Offline to use your new version of KinKal you need a new shell. Close your existing shell, and start a new one, then cd back to your work directory. Note you only need to do this when setting up a new work directory; the following commands are needed for all subsequent use of this workdir
- close your current shell
- create a new shell, and cd to your muse workdir.
- Tell UPS where to look find your local version of KinKal
- setup muse, specifying the envset you created, which points to your local KinKal installation
exit (closes the current shell) ssh 'myuser'@mu2egpvm04.fnal.gov cd 'myworkdir' setup mu2e export PRODUCTS=${PWD}/artexternals:${PRODUCTS} muse setup -q u999
- Now build Offline (and any other muse-aware repos you've cloned)
muse build -j 20
Rebuilding KinKal
Once you have a stock build of Offline and KinKal, you can can develop both code sets coherently.
- edit KinKal as needed
- edit Offline as needed to exploit new KinKal features
- rebuild KinKal and update the installation
- rebuild Offline
(edit KinKal/*/*) (edit Offline/*/*) cd build_profile make -j 20 make test cd .. KinKal_to_UPS/build -v v9.9.9 -i -d artexternals muse build
Returning to the area
- to return in a new shell and simply run the code you've already edited and built, you only need to repeat the setups:
cd 'workdir' setup mu2e export PRODUCTS=${PWD}/artexternals:${PRODUCTS} muse setup -q u999
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
- 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 v9.9.9 -i -d artexternals
- now that the debug version of the local KinKal product is available, you need to setup in a new shell to get the full environment
exit ssh 'myuser@mu2egpvm04.fnal.gov' cd 'workdir' setup mu2e export PRODUCTS=${PWD}/artexternals:${PRODUCTS} muse setup -q u999:debug muse build
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'