Loading Libraries#
The standard way to load libraries is through the atiSetup module. Some environment variables can be set (like MPI/GPU) to specify which libraries should be loaded. Some aliasing and pythonization of the c++ wrapped class is performed to simplify syntax as they all live within the PyROOT namespace.
from pyamptools import atiSetup
import ROOT
Welcome to JupyROOT 6.28/06
The main module to load the necessary libraries is atiSetup, in particular its setup function.
Dynamic loading - Depending on who calls the python function (i.e. bash, mpiexec, …) CPU or MPI libraries will be loaded. GPU libraries will be loaded if nvidia-smi can be found in PATH. We can also explictly load a particular cpu/mpi/gpu/mpi+gpu libraries by passing an accelerator string.
We can also decide to load FSRoot or gen_amp (simulation program) now. See atiSetup for API and source code.
############## SET ENVIRONMENT VARIABLES ##############
USE_MPI, USE_GPU, RANK_MPI = atiSetup.setup(globals()) # RANK_MPI defaults to 0 even if not using MPI
atiSetup| jupyter-book called python3.9
------------------------------------------------
atiSetup| MPI is disabled
atiSetup| GPU is disabled
------------------------------------------------
atiSetup| Loading library libIUAmpTools.so ............ ON
atiSetup| Loading library libAmpTools.so .............. ON
atiSetup| Loading library libAmpPlotter.so ............ ON
atiSetup| Loading library libAmpsDataIO.so ............ ON
atiSetup| Loading library libFSRoot.so ................ OFF
atiSetup| Loading library libAmpsGen.so ............... OFF
------------------------------------------------
------------------------------------------------
atiSetup| Saved aliases found in /d/grid17/ln16/PyAmpTools/src/pyamptools/.aliases.txt, attempting to load...
atiSetup| minor warning: Unable to alias omegapiAngles - doesn't exist under ROOT namespace
atiSetup| minor warning: Unable to alias URConfig - doesn't exist under ROOT namespace
atiSetup| minor warning: Unable to alias URtypes - doesn't exist under ROOT namespace
Lets try and load FSRoot and gen_amp libraries also
############## SET ENVIRONMENT VARIABLES ##############
USE_MPI, USE_GPU, RANK_MPI = atiSetup.setup(globals(), use_fsroot=True, use_genamp=True) # RANK_MPI defaults to 0 even if not using MPI
atiSetup| jupyter-book called python3.9
------------------------------------------------
atiSetup| MPI is disabled
atiSetup| GPU is disabled
------------------------------------------------
atiSetup| Loading library libIUAmpTools.so ............ ON
atiSetup| Loading library libAmpTools.so .............. ON
atiSetup| Loading library libAmpPlotter.so ............ ON
atiSetup| Loading library libAmpsDataIO.so ............ ON
atiSetup| Loading library libFSRoot.so ................ ON
atiSetup| Loading library libAmpsGen.so ............... ON
------------------------------------------------
------------------------------------------------
atiSetup| Saved aliases found in /d/grid17/ln16/PyAmpTools/src/pyamptools/.aliases.txt, attempting to load...
atiSetup| minor warning: Unable to alias omegapiAngles - doesn't exist under ROOT namespace
atiSetup| minor warning: Unable to alias URConfig - doesn't exist under ROOT namespace
atiSetup| minor warning: Unable to alias URtypes - doesn't exist under ROOT namespace
atiSetup| minor warning: Unable to alias FSFitFunctions - doesn't exist under ROOT namespace
atiSetup| minor warning: Unable to alias FSFitPrivate - doesn't exist under ROOT namespace
Since all wrapped classes live under PyROOT it can be convenient to set aliases
################ SET ADDITIONAL ALIAS ###################
AmplitudeInfo = ROOT.AmplitudeInfo
TH1 = ROOT.TH1