`import ROOT` in python takes long time to load

Dear experts,

I am experiencing very painful delays when calling import ROOT on my python prompt on lxplus when using libraries from cvmfs.

$ source /cvmfs/sft.cern.ch/lcg/views/setupViews.sh LCG_104a x86_64-centos7-gcc12-opt
$ python -c "import time; start = time.time(); import ROOT as r; stop = time.time(); print(f'it took {stop-start:.1f}s')"
it took 267.4s

n.b. I was maybe unlucky with this test. See table below.

For comparison I’ve run the same command on my laptop

$ python -c "import time; start = time.time(); import ROOT as r; stop = time.time(); print(f'it took {stop-start:.1f}s')"
it took 28.4s

That is still a long time. I tried to perform more systematic tests on different platforms

ROOT Version Platform Compiler Time (s) LCG
6.28/06 linuxx8664gcc g++ (GCC) 12.1.0 63.0 104a
6.28/06 linuxx8664gcc g++ (GCC) 11.3.0 59.0 104a
6.28/06 macosx64 clang-1403.0.22.14.1 28.4 n.d.
6.28/00 linuxx8664gcc g++ (GCC) 11.3.0 41.1 103
6.26/04 linuxx8664gcc g++ (GCC) 8.3.0 10.2 102

Is the trend of rising time simply due to lower community access to the old environments?
Does anybody have a suggestion to circumvent or mitigate the issue?

Thanks,

Maurizio

1 Like

Hi @puma ,

I can reproduce the timings and they seem excessive. I think it’s a regression (cc: @vpadulan @Axel ).

On my laptop, with ROOT installed as a conda package, this is ROOT v6.28.00:

~ micromamba activate root-agc
~ python -c "import time; start = time.time(); import ROOT as r; stop = time.time(); print(f'it took {stop-start:.1f}s')"
it took 5.2s
~ python -c "import time; start = time.time(); import ROOT as r; stop = time.time(); print(f'it took {stop-start:.1f}s')"
it took 1.2s
~ python -c "import time; start = time.time(); import ROOT as r; stop = time.time(); print(f'it took {stop-start:.1f}s')"
it took 1.2s

(the first run is reading from risk, successive runs from the filesystem cache).

Even 5s is still a lot. This is with 6.26 instead:

~ micromamba activate root-626                                                                                     (root-agc)
~ python -c "import time; start = time.time(); import ROOT as r; stop = time.time(); print(f'it took {stop-start:.1f}s')"
it took 2.2s
~ python -c "import time; start = time.time(); import ROOT as r; stop = time.time(); print(f'it took {stop-start:.1f}s')"
it took 0.7s

Dear Maurizio,

Thanks for this complete report.
I can also confirm your findings: I am sorry to see that you are exposed to this performance regression.

However, let me point out that this issue has been been fixed in the ROOT repository two weeks ago, and will be part of the forthcoming ROOT 6.30 release, together with a pack of other optimisations.

I can propose two temporary workarounds for lxplus, if you allow me, as a stop gap solution until 6.30 is released.
The first one consists in picking up the latest ROOT master through a LCG release. This is also a cool way to have access to a preview of all the nice features of 6.30. One needs only to:

source  /cvmfs/sft.cern.ch/lcg/views/dev3/latest/x86_64-centos7-gcc12-opt/setup.sh

The second one, consists in caching on AFS the root-config executable (the syntax assumes the usage of the bash shell):

mkdir mypath
cp /cvmfs/sft.cern.ch/lcg/views/LCG_104a/x86_64-centos7-gcc12-opt/bin/root-config mypath
export PATH=`pwd`/mypath:$PATH

Thanks for your patience.

Best,
Danilo

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.