Skip to content

Unreasonably slow behaviour of CompileMacro #7774

Closed

Description

@malatara
  • Checked for duplicates

Describe the bug

I have a PDF class implemented in C++ that I want to use in a python script through ROOT.gSystem.CompileMacro(). It is unreasonably slow to load each time, O(minutes). When running with "kO" option it is better, but still long - too long for normal usage - whereas it should be instantaneous, if I understand correctly. I have tested ROOT 6.22 and with nightlies, and nightlies are even slower.

The time for a first compilation, so how long it's processing the line Info in <TUnixSystem::ACLiC>: creating shared library /afs/cern.ch/user/t/tnanut/public/Stephan/RooThreshold_cpp.so, for running a script and directly the CompileMacro command in ipython:

Version py file ipython
Nightlies 3m25s 1m55s
6.22 1m35s 1m05s

The run time with "kO" option for the 2nd iteration of running, once binaries are created:

Version py file
Nightlies 1m15s
6.22 0m30s

All above times are on same lxplus machine. Between different lxplus machines the timing changes, but at best e.g from 30s down to 20s.

Another test for how much time has elapsed e.g.:

for version in /cvmfs/sft.cern.ch/lcg/views/LCG_99/x86_64-centos7-gcc10-opt/setup.sh /cvmfs/sft-nightlies.cern.ch/lcg/views/dev3/latest/x86_64-centos7-gcc9-opt/setup.sh ; do (
  source $version;
  echo $version;
  root --version -q
  /usr/bin/time python3 -c "import ROOT; ROOT.gSystem.CompileMacro('~tnanut/public/Stephan/RooThreshold.cpp', 'fO')" 2>&1 | grep user.*system;
  /usr/bin/time python3 -c "import ROOT; ROOT.gSystem.CompileMacro('~tnanut/public/Stephan/RooThreshold.cpp', 'fO')" 2>&1 | grep user.*system;
  /usr/bin/time python3 -c "import ROOT; ROOT.gSystem.CompileMacro('~tnanut/public/Stephan/RooThreshold.cpp', 'O')" 2>&1 | grep user.*system)
done

Output:

/cvmfs/sft.cern.ch/lcg/views/LCG_99/x86_64-centos7-gcc10-opt/setup.sh
ROOT Version: 6.22/06
Built for linuxx8664gcc on Nov 27 2020, 15:14:08
From tags/v6-22-06@v6-22-06
14.56user 22.74system 2:30.29elapsed 24%CPU (0avgtext+0avgdata 869920maxresident)k
14.52user 21.71system 2:08.49elapsed 28%CPU (0avgtext+0avgdata 870036maxresident)k
14.26user 21.65system 1:13.75elapsed 48%CPU (0avgtext+0avgdata 869908maxresident)k
/cvmfs/sft-nightlies.cern.ch/lcg/views/dev3/latest/x86_64-centos7-gcc9-opt/setup.sh
ROOT Version: 6.25/01
Built for linuxx8664gcc on Apr 01 2021, 03:35:00
From heads/master@v6-25-01-520-g875e8fb
14.66user 24.65system 1:47.89elapsed 36%CPU (0avgtext+0avgdata 936048maxresident)k
14.36user 23.63system 1:15.73elapsed 50%CPU (0avgtext+0avgdata 936036maxresident)k
17.88user 26.28system 10:23.67elapsed 7%CPU (0avgtext+0avgdata 936052maxresident)k

Expected behavior

Once binaries are created, there should be an option for an almost instantaneous run on the next iterations.

To Reproduce

All files are in /afs/cern.ch/user/t/tnanut/public/Stephan/ (neither format is allowed to be attached).

python3 /afs/cern.ch/user/t/tnanut/public/Stephan/testRooThreshold.py

Setup

  1. ROOT version: 6.22/06 and latest nightlies version
  2. Operating system: lxplus
  3. How you obtained ROOT:
    Nightlies:
source /cvmfs/sft.cern.ch/lcg/views/dev3/latest/x86_64-centos7-gcc9-opt/setup.sh

6.22: through LHCb

/cvmfs/lhcbdev.cern.ch/conda/envs/default/2021-02-03_15-01/linux-64/bin/root

Additional context

I'd be also interested if you know an alternative method how to implement the class from the .cpp file into python, that can provide nearly instantaneous loading on reruns.

Activity

  1. pcanal commented on Apr 5, 2021

    @pcanal
    Member

    The time spent appears (likely) to be in the new symbol/autoloading search (which would be slower than usual in your case 'thanks' to afs).

    #7  0x00007f88960b6b43 in TCling::GetSharedLibDeps (this=0x2493860, lib=0x3e5c0b0 "/var/tmp/temp/RooThreshold_cpp.so", useDyld=true)
        at /build/jenkins/workspace/lcg_nightly_pipeline/build/projects/ROOT-HEAD/src/ROOT/HEAD/core/metacling/src/TCling.cxx:7274
    #8  0x00007f889da9a8f3 in TSystem::<lambda(char const*, std::function<bool(char const*)>)>::operator()(const char *, std::function<bool(char const*)>) const (__closure=0x7ffd937a0b2e, lib=0x3e5c0b0 "/var/tmp/temp/RooThreshold_cpp.so", f=...)
        at /build/jenkins/workspace/lcg_nightly_pipeline/build/projects/ROOT-HEAD/src/ROOT/HEAD/core/base/src/TSystem.cxx:3339
    #9  0x00007f889da9abc5 in TSystem::<lambda(const TString&)>::operator()(const TString &) const (__closure=0x7ffd937a0b2c, lib=...) at /build/jenkins/workspace/lcg_nightly_pipeline/build/projects/ROOT-HEAD/src/ROOT/HEAD/core/base/src/TSystem.cxx:3360
    #10 0x00007f889da9d907 in TSystem::CompileMacro (this=0x2422570, filename=0x3e5b1a0 "/var/tmp/temp/RooThreshold.cpp", opt=0x7ffd937a1739 "k", library_specified=0x7f889930b41d "", build_dir=0x7f889930b41d "", dirmode=0)
        at /build/jenkins/workspace/lcg_nightly_pipeline/build/projects/ROOT-HEAD/src/ROOT/HEAD/core/base/src/TSystem.cxx:3377
    
  2. hageboeck commented on Apr 6, 2021

    @hageboeck
    Member

    We talked about this with Axel. I assigned it to him.

  3. pcanal commented on Apr 6, 2021

    @pcanal
    Member

    You can work around the problem by pre-loading the library libRooFitCore:

      /usr/bin/time python3 -c "import ROOT; ROOT.gSystem.Load('libRooFitCore');ROOT.gSystem.CompileMacro('~tnanut/public/Stephan/RooThreshold.cpp', 'kO')" 2>&1 | grep user.*system;
    
  4. malatara commented on Apr 6, 2021

    @malatara
    Author

    Nice, this works!! Thanks!

  5. hageboeck commented on Apr 7, 2021

    @hageboeck
    Member

    And here's what's going on in terms of system calls.

    Good root (6.22, cvmfs):

    $ strace python3 -c "import ROOT; ROOT.gSystem.CompileMacro('~tnanut/public/Stephan/RooThreshold.cpp', 'kO')" 2>&1 | sort | uniq -c | sort -n -r | head -n 40
         13 close(3)                                = 0
          4 stat("/cvmfs/sft.cern.ch/lcg/views/LCG_98/x86_64-centos7-gcc10-opt/lib", {st_mode=S_IFDIR|0755, st_size=102400, ...}) = 0
          3 stat("/cvmfs/sft.cern.ch/lcg/views/LCG_98/x86_64-centos7-gcc10-opt/python", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
          3 stat("/cvmfs/sft.cern.ch/lcg/views/LCG_98/x86_64-centos7-gcc10-opt/lib/python2.7/site-packages", {st_mode=S_IFDIR|0755, st_size=36864, ...}) = 0
          3 stat("/cvmfs/sft.cern.ch/lcg/releases/Python/2.7.16-3adfa/x86_64-centos7-gcc10-opt", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
          3 stat("/cvmfs/sft.cern.ch/lcg/releases/Python/2.7.16-3adfa/x86_64-centos7-gcc10-opt/lib64", 0x7ffdb80e8360) = -1 ENOENT (No such file or directory)
          3 getdents(3, /* 88 entries */, 32768)    = 3720
          3 getdents(3, /* 0 entries */, 32768)     = 0
          2 write(2, "\n", 1
          2 stat("/cvmfs/sft.cern.ch/lcg/releases/Python/2.7.16-3adfa/x86_64-centos7-gcc10-opt/lib64/python3.6", 0x7ffdb80e8360) = -1 ENOENT (No such file or directory)
          2 mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7feaa3772000
          2 getdents(3, /* 89 entries */, 32768)    = 3712
          2 getdents(3, /* 88 entries */, 32768)    = 3688
          2 brk(NULL)                               = 0x1aa4000
          2 brk(NULL)                               = 0x1a83000
          2 )                       = 1
          1 write(2, "No module named 'encodings'", 27No module named 'encodings') = 27
          1 write(2, " (most recent call first):\n", 27 (most recent call first):
          1 write(2, "ModuleNotFoundError", 19ModuleNotFoundError)     = 19
          1 write(2, "Fatal Python error: Py_Initializ"..., 69Fatal Python error: Py_Initialize: Unable to get the locale encoding
          1 write(2, "Current thread 0x", 17Current thread 0x)       = 17
          1 write(2, ": ", 2: )                       = 2
          1 write(2, "00007feaa37f2740", 1600007feaa37f2740)        = 16
          1 tgkill(3143, 3143, SIGABRT)             = 0
          1 stat("/usr/sue/bin/python3", 0x7ffdb80dfaf0) = -1 ENOENT (No such file or directory)
          1 stat("/usr/local/bin/python3", 0x7ffdb80dfaf0) = -1 ENOENT (No such file or directory)
          1 stat("/usr/lib64/qt-3.3/bin/python3", 0x7ffdb80dfaf0) = -1 ENOENT (No such file or directory)
          1 stat("/usr/condabin/python3", 0x7ffdb80dfaf0) = -1 ENOENT (No such file or directory)
          1 stat("/usr/bin/python3", {st_mode=S_IFREG|0755, st_size=11328, ...}) = 0
          1 stat("/cvmfs/sft.cern.ch/lcg/views/LCG_98/x86_64-centos7-gcc10-opt/scripts/python3", 0x7ffdb80dfaf0) = -1 ENOENT (No such file or directory)
          1 stat("/cvmfs/sft.cern.ch/lcg/views/LCG_98/x86_64-centos7-gcc10-opt/lib/x86_64", 0x7ffdb80e85a0) = -1 ENOENT (No such file or directory)
          1 stat("/cvmfs/sft.cern.ch/lcg/views/LCG_98/x86_64-centos7-gcc10-opt/lib/tls/x86_64", 0x7ffdb80e85a0) = -1 ENOENT (No such file or directory)
          1 stat("/cvmfs/sft.cern.ch/lcg/views/LCG_98/x86_64-centos7-gcc10-opt/lib/tls", 0x7ffdb80e85a0) = -1 ENOENT (No such file or directory)
          1 stat("/cvmfs/sft.cern.ch/lcg/views/LCG_98/x86_64-centos7-gcc10-opt/lib/python2.7/site-packages/torch/lib/x86_64", 0x7ffdb80e85a0) = -1 ENOENT (No such file or directory)
          1 stat("/cvmfs/sft.cern.ch/lcg/views/LCG_98/x86_64-centos7-gcc10-opt/lib/python2.7/site-packages/torch/lib/tls/x86_64", 0x7ffdb80e85a0) = -1 ENOENT (No such file or directory)
          1 stat("/cvmfs/sft.cern.ch/lcg/views/LCG_98/x86_64-centos7-gcc10-opt/lib/python2.7/site-packages/torch/lib/tls", 0x7ffdb80e85a0) = -1 ENOENT (No such file or directory)
          1 stat("/cvmfs/sft.cern.ch/lcg/views/LCG_98/x86_64-centos7-gcc10-opt/lib/python2.7/site-packages/torch/lib", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
          1 stat("/cvmfs/sft.cern.ch/lcg/views/LCG_98/x86_64-centos7-gcc10-opt/lib/python2.7/site-packages/tensorflow_core/x86_64", 0x7ffdb80e85a0) = -1 ENOENT (No such file or directory)
          1 stat("/cvmfs/sft.cern.ch/lcg/views/LCG_98/x86_64-centos7-gcc10-opt/lib/python2.7/site-packages/tensorflow_core/tls/x86_64", 0x7ffdb80e85a0) = -1 ENOENT (No such file or directory)
          1 stat("/cvmfs/sft.cern.ch/lcg/views/LCG_98/x86_64-centos7-gcc10-opt/lib/python2.7/site-packages/tensorflow_core/tls", 0x7ffdb80e85a0) = -1 ENOENT (No such file or directory)
    

    Nightly master:

    strace python3 -c "import ROOT; ROOT.gSystem.CompileMacro('~tnanut/public/Stephan/RooThreshold.cpp', 'kO')" 2>&1 | sort | uniq -c | sort -n -r | head -n 40
     104738 rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], [], 8) = 0
     104738 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
      92073 close(5)                                = 0
      16174 lstat("/cvmfs", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
      13779 lstat("/cvmfs/sft-nightlies.cern.ch", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
      13779 lstat("/cvmfs/sft-nightlies.cern.ch/lcg", {st_mode=S_IFDIR|0775, st_size=20, ...}) = 0
      12653 close(6)                                = 0
       8668 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/nightlies", {st_mode=S_IFDIR|0775, st_size=18, ...}) = 0
       8668 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3/Wed", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
       8668 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3", {st_mode=S_IFDIR|0775, st_size=17, ...}) = 0
       8214 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3/Wed/ROOT", {st_mode=S_IFDIR|0755, st_size=18, ...}) = 0
       8214 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3/Wed/ROOT/HEAD/x86_64-centos7-gcc9-opt", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
       8214 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3/Wed/ROOT/HEAD/x86_64-centos7-gcc9-opt/lib", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
       8214 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3/Wed/ROOT/HEAD", {st_mode=S_IFDIR|0755, st_size=53, ...}) = 0
       7555 stat("/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3/Wed/ROOT/HEAD/x86_64-centos7-gcc9-opt/lib/libRooFitCore.so", {st_mode=S_IFREG|0755, st_size=8433440, ...}) = 0
       7555 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3/Wed/ROOT/HEAD/x86_64-centos7-gcc9-opt/lib/libRooFitCore.so", {st_mode=S_IFREG|0755, st_size=8433440, ...}) = 0
       7435 lstat("/usr", {st_mode=S_IFDIR|0755, st_size=210, ...}) = 0
       7432 lstat("/usr/lib64", {st_mode=S_IFDIR|0555, st_size=147456, ...}) = 0
       2941 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/views", {st_mode=S_IFDIR|0775, st_size=18, ...}) = 0
       2941 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/views/dev3/Wed/x86_64-centos7-gcc9-opt", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
       2941 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/views/dev3/Wed", {st_mode=S_IFDIR|0775, st_size=40, ...}) = 0
       2941 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/views/dev3", {st_mode=S_IFDIR|0775, st_size=31, ...}) = 0
       2691 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/views/dev3/Wed/x86_64-centos7-gcc9-opt/lib", {st_mode=S_IFDIR|0755, st_size=90112, ...}) = 0
       2395 lstat("/cvmfs/sft.cern.ch", {st_mode=S_IFDIR|0755, st_size=4, ...}) = 0
       2395 lstat("/cvmfs/sft.cern.ch/lcg", {st_mode=S_IFDIR|0755, st_size=24, ...}) = 0
       2395 lstat("/cvmfs/sft.cern.ch/lcg/releases", {st_mode=S_IFDIR|0755, st_size=35, ...}) = 0
       2170 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/latest", {st_mode=S_IFDIR|0755, st_size=196, ...}) = 0
       1165 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/latest/MCGenerators", {st_mode=S_IFDIR|0755, st_size=48, ...}) = 0
        878 stat("/build/jenkins/workspace/lcg_nightly_pipeline/build/projects/ROOT-HEAD/src/ROOT-HEAD-build/lib", 0x7fffb7dd4010) = -1 ENOENT (No such file or directory)
        878 stat("/build/jenkins/workspace/lcg_nightly_pipeline/build/projects/ROOT-HEAD/src/ROOT-HEAD-build/lib", 0x7fffb7dd3fc0) = -1 ENOENT (No such file or directory)
        677 lstat("/cvmfs/sft.cern.ch/lcg/releases/qt5", {st_mode=S_IFDIR|0755, st_size=26, ...}) = 0
        677 lstat("/cvmfs/sft.cern.ch/lcg/releases/qt5/5.12.4-3d860/x86_64-centos7-gcc9-opt", {st_mode=S_IFDIR|0755, st_size=290, ...}) = 0
        677 lstat("/cvmfs/sft.cern.ch/lcg/releases/qt5/5.12.4-3d860/x86_64-centos7-gcc9-opt/lib", {st_mode=S_IFDIR|0755, st_size=16384, ...}) = 0
        677 lstat("/cvmfs/sft.cern.ch/lcg/releases/qt5/5.12.4-3d860", {st_mode=S_IFDIR|0755, st_size=37, ...}) = 0
        458 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/latest/MCGenerators/herwig++", {st_mode=S_IFDIR|0755, st_size=63, ...}) = 0
        458 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/latest/MCGenerators/herwig++/7.2.1-30a79/x86_64-centos7-gcc9-opt", {st_mode=S_IFDIR|0755, st_size=232, ...}) = 0
        458 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/latest/MCGenerators/herwig++/7.2.1-30a79/x86_64-centos7-gcc9-opt/lib", {st_mode=S_IFDIR|0755, st_size=20, ...}) = 0
        458 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/latest/MCGenerators/herwig++/7.2.1-30a79/x86_64-centos7-gcc9-opt/lib/Herwig", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
        458 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/latest/MCGenerators/herwig++/7.2.1-30a79", {st_mode=S_IFDIR|0755, st_size=37, ...}) = 0
        396 munmap(0x7f770c777000, 26960)           = 0
    
  6. vgvassilev commented on May 13, 2021

    @vgvassilev
    Member

    I tried to produce a flamegraph but lxplus seems hard for me. Can somebody produce a flamegraph?

  7. hageboeck commented on May 14, 2021

    @hageboeck
    Member
  8. vgvassilev commented on Oct 1, 2021

    @vgvassilev
    Member

    ping.

  9. Axel-Naumann commented on Oct 1, 2021

    @Axel-Naumann
    Member

    @vgvassilev note that this is realtime not CPU time. Could you fire up your own VM to see whether this was fixed by your #6969 ?

  10. vgvassilev commented on Oct 1, 2021

    @vgvassilev
    Member

    @Axel-Naumann, we did experiment with this when developing the PR. So the performance should be better. We have two options here: a) test it on the same setup as the initial bug (eg afs); b) close the issue as resolved.

  11. Axel-Naumann commented on Oct 1, 2021

    @Axel-Naumann
    Member

    OK so I guess we should try to reproduce on AFS then? What does

    lxplus seems hard for me

    mean?

  12. vgvassilev commented on Oct 1, 2021

    @vgvassilev
    Member

    I tried to reproduce it on lxplus and I cannot run perf which is required to produce a flamegraph.

  13. vgvassilev commented on Oct 1, 2021

    @vgvassilev
    Member

    ok, some updates on running the command by hand on lxplus: source /cvmfs/sft.cern.ch/lcg/views/dev3/latest/x86_64-centos7-gcc9-opt/setup.sh

    
      23843 rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], [], 8) = 0
      23843 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
      18891 close(6)                                = 0
       4888 close(7)                                = 0
       1443 lstat("/cvmfs", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
        923 lstat("/cvmfs/sft-nightlies.cern.ch", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
        923 lstat("/cvmfs/sft-nightlies.cern.ch/lcg", {st_mode=S_IFDIR|0775, st_size=36, ...}) = 0
        887 stat("/build/jenkins/workspace/lcg_nightly_pipeline/build/projects/ROOT-HEAD/src/ROOT-HEAD-build/lib", 0x7ffc085e4280) = -1 ENOENT (No such file or directory)
        887 stat("/build/jenkins/workspace/lcg_nightly_pipeline/build/projects/ROOT-HEAD/src/ROOT-HEAD-build/lib", 0x7ffc085e4230) = -1 ENOENT (No such file or directory)
        521 lstat("/cvmfs/sft.cern.ch", {st_mode=S_IFDIR|0755, st_size=4, ...}) = 0
        521 lstat("/cvmfs/sft.cern.ch/lcg", {st_mode=S_IFDIR|0755, st_size=21, ...}) = 0
        521 lstat("/cvmfs/sft.cern.ch/lcg/releases", {st_mode=S_IFDIR|0755, st_size=28, ...}) = 0
        509 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/nightlies", {st_mode=S_IFDIR|0775, st_size=18, ...}) = 0
        509 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3", {st_mode=S_IFDIR|0775, st_size=17, ...}) = 0
        509 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3/Fri", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
        397 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3/Fri/ROOT", {st_mode=S_IFDIR|0755, st_size=18, ...}) = 0
        397 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3/Fri/ROOT/HEAD/x86_64-centos7-gcc9-opt", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
        397 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3/Fri/ROOT/HEAD/x86_64-centos7-gcc9-opt/lib", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
        397 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3/Fri/ROOT/HEAD", {st_mode=S_IFDIR|0755, st_size=51, ...}) = 0
        364 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/latest", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
        324 close(5)                                = 0
        210 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/latest/MCGenerators", {st_mode=S_IFDIR|0755, st_size=180, ...}) = 0
        197 lseek(5, 0, SEEK_CUR)                   = 0
        153 getcwd("/afs/cern.ch/user/v/vvasilev", 8192) = 29
        130 stat("/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3/Fri/ROOT/HEAD/x86_64-centos7-gcc9-opt/lib/libRooFitCore.so", {st_mode=S_IFREG|0755, st_size=8874664, ...}) = 0
        130 munmap(0x7f3c82c8a000, 8874664)         = 0
        130 lstat("/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3/Fri/ROOT/HEAD/x86_64-centos7-gcc9-opt/lib/libRooFitCore.so", {st_mode=S_IFREG|0755, st_size=8874664, ...}) = 0
        130 fstat(6, {st_mode=S_IFREG|0755, st_size=8874664, ...}) = 0
        130 fstat(6, {st_mode=S_IFREG|0755, st_size=671864, ...}) = 0
        129 open("/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3/Fri/ROOT/HEAD/x86_64-centos7-gcc9-opt/lib/libSmatrix.so", O_RDONLY|O_CLOEXEC) = 6
        129 open("/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3/Fri/ROOT/HEAD/x86_64-centos7-gcc9-opt/lib/libRooFitCore.so", O_RDONLY|O_CLOEXEC) = 6
        129 munmap(0x7f3ca9a8c000, 18448)           = 0
        129 munmap(0x7f3ca9a8b000, 24536)           = 0
        129 munmap(0x7f3ca9a8b000, 20552)           = 0
        129 munmap(0x7f3ca9a8a000, 27800)           = 0
        129 munmap(0x7f3ca9a89000, 31032)           = 0
        129 munmap(0x7f3ca0b4e000, 36216)           = 0
        129 munmap(0x7f3ca0b4e000, 35984)           = 0
        129 munmap(0x7f3ca0b4d000, 37984)           = 0
        129 munmap(0x7f3ca0b4d000, 36912)           = 0
    

    This seems to be an improvement to what @hageboeck saw.

    Then:

     /usr/bin/time -v python3 -c "import ROOT; ROOT.gSystem.CompileMacro('~tnanut/public/Stephan/RooThreshold.cpp', 'kO')" 
    ACLiC:0: RuntimeWarning: /afs/cern.ch/user/t/tnanut/public/Stephan is not writable!
    ACLiC:0: RuntimeWarning: Output will be written to /tmp/vvasilev/vvasilev
    Info in <TUnixSystem::ACLiC>: creating shared library /tmp/vvasilev/vvasilev//afs/cern.ch/user/t/tnanut/public/Stephan/RooThreshold_cpp.so
    
    RooFit v3.60 -- Developed by Wouter Verkerke and David Kirkby 
                    Copyright (C) 2000-2013 NIKHEF, University of California & Stanford University
                    All rights reserved, please read http://roofit.sourceforge.net/license.txt
    
    	Command being timed: "python3 -c import ROOT; ROOT.gSystem.CompileMacro('~tnanut/public/Stephan/RooThreshold.cpp', 'kO')"
    	User time (seconds): 10.03
    	System time (seconds): 9.36
    	Percent of CPU this job got: 57%
    	Elapsed (wall clock) time (h:mm:ss or m:ss): 0:33.48
    	Average shared text size (kbytes): 0
    	Average unshared data size (kbytes): 0
    	Average stack size (kbytes): 0
    	Average total size (kbytes): 0
    	Maximum resident set size (kbytes): 289028
    	Average resident set size (kbytes): 0
    	Major (requiring I/O) page faults: 77334
    	Minor (reclaiming a frame) page faults: 410138
    	Voluntary context switches: 145350
    	Involuntary context switches: 131
    	Swaps: 0
    	File system inputs: 15192744
    	File system outputs: 936
    	Socket messages sent: 0
    	Socket messages received: 0
    	Signals delivered: 0
    	Page size (bytes): 4096
    	Exit status: 0
    bash-4.2$ rm /tmp/vvasilev/vvasilev/afs/cern.ch/user/t/tnanut/public/Stephan/RooThreshold_cpp*
    bash-4.2$ /usr/bin/time -v python3 -c "import ROOT; ROOT.gSystem.CompileMacro('~tnanut/public/Stephan/RooThreshold.cpp')" 
    ACLiC:0: RuntimeWarning: /afs/cern.ch/user/t/tnanut/public/Stephan is not writable!
    ACLiC:0: RuntimeWarning: Output will be written to /tmp/vvasilev/vvasilev
    Info in <TUnixSystem::ACLiC>: creating shared library /tmp/vvasilev/vvasilev//afs/cern.ch/user/t/tnanut/public/Stephan/RooThreshold_cpp.so
    
    RooFit v3.60 -- Developed by Wouter Verkerke and David Kirkby 
                    Copyright (C) 2000-2013 NIKHEF, University of California & Stanford University
                    All rights reserved, please read http://roofit.sourceforge.net/license.txt
    
    	Command being timed: "python3 -c import ROOT; ROOT.gSystem.CompileMacro('~tnanut/public/Stephan/RooThreshold.cpp')"
    	User time (seconds): 10.15
    	System time (seconds): 9.33
    	Percent of CPU this job got: 60%
    	Elapsed (wall clock) time (h:mm:ss or m:ss): 0:32.42
    	Average shared text size (kbytes): 0
    	Average unshared data size (kbytes): 0
    	Average stack size (kbytes): 0
    	Average total size (kbytes): 0
    	Maximum resident set size (kbytes): 289024
    	Average resident set size (kbytes): 0
    	Major (requiring I/O) page faults: 77343
    	Minor (reclaiming a frame) page faults: 410033
    	Voluntary context switches: 132557
    	Involuntary context switches: 153
    	Swaps: 0
    	File system inputs: 15192688
    	File system outputs: 928
    	Socket messages sent: 0
    	Socket messages received: 0
    	Signals delivered: 0
    	Page size (bytes): 4096
    	Exit status: 0

    It looks like the version in the master takes around 10s. It is still a lot more than what it used to be but that is the cost of having more accurate low-level linker symbol resolution system. I assume we could bring this probably closer to the initial timing (eg may get factor 2 speedup) but that will likely come at the cost of introducing more complex, hard-to-debug and hard-to-maintain code.

  14. vgvassilev commented on Oct 1, 2021

    @vgvassilev
    Member

    Here is what I get for the provided test:

    for version in /cvmfs/sft.cern.ch/lcg/views/LCG_99/x86_64-centos7-gcc8-opt/setup.sh /cvmfs/sft-nightlies.cern.ch/lcg/views/dev3/latest/x86_64-centos7-gcc9-opt/setup.sh ; do (   source $version;   echo $version;   root --version -q;   /usr/bin/time python3 -c "import ROOT; ROOT.gSystem.CompileMacro('~tnanut/public/Stephan/RooThreshold.cpp', 'fO')" 2>&1 | grep user.*system;   /usr/bin/time python3 -c "import ROOT; ROOT.gSystem.CompileMacro('~tnanut/public/Stephan/RooThreshold.cpp', 'fO')" 2>&1 | grep user.*system;   /usr/bin/time python3 -c "import ROOT; ROOT.gSystem.CompileMacro('~tnanut/public/Stephan/RooThreshold.cpp', 'O')" 2>&1 | grep user.*system); done
    /cvmfs/sft.cern.ch/lcg/views/LCG_99/x86_64-centos7-gcc8-opt/setup.sh
    ROOT Version: 6.22/06
    Built for linuxx8664gcc on Nov 27 2020, 15:14:08
    From tags/v6-22-06@v6-22-06
    15.72user 28.39system 2:07.93elapsed 34%CPU (0avgtext+0avgdata 880240maxresident)k
    15.06user 26.69system 1:32.07elapsed 45%CPU (0avgtext+0avgdata 880260maxresident)k
    15.23user 26.53system 1:32.15elapsed 45%CPU (0avgtext+0avgdata 880232maxresident)k
    [1]+  Terminated              ( source $version; echo $version; root --version -q; /usr/bin/time python3 -c "import ROOT; ROOT.gSystem.CompileMacro('~tnanut/public/Stephan/RooThreshold.cpp', 'fO')" 2>&1 | grep user.*system; /usr/bin/time python3 -c "import ROOT; ROOT.gSystem.CompileMacro('~tnanut/public/Stephan/RooThreshold.cpp', 'fO')" 2>&1 | grep user.*system; /usr/bin/time python3 -c "import ROOT; ROOT.gSystem.CompileMacro('~tnanut/public/Stephan/RooThreshold.cpp', 'O')" 2>&1 | grep user.*system )
    /cvmfs/sft-nightlies.cern.ch/lcg/views/dev3/latest/x86_64-centos7-gcc9-opt/setup.sh
    ROOT Version: 6.25/01
    Built for linuxx8664gcc on Oct 01 2021, 04:07:00
    From heads/master@v6-25-01-2109-ga7ac1f5
    10.22user 8.58system 0:32.48elapsed 57%CPU (0avgtext+0avgdata 289176maxresident)k
    10.08user 9.15system 0:31.99elapsed 60%CPU (0avgtext+0avgdata 289184maxresident)k
    10.03user 8.78system 0:32.03elapsed 58%CPU (0avgtext+0avgdata 289188maxresident)k```
  15. hageboeck commented on Oct 1, 2021

    @hageboeck
    Member

    I guess the first time you load (and run!) that macro, this is the situation:

    30 s as in 6.22: good
    30 s + a few: should be OK
    2 mins: NO!
    

    If I didn't misread the numbers, it's now as fast as 6.22 used to be, about 30s.
    I don't see the additional 10 s that @vgvassilev mentioned?

  16. vgvassilev commented on Oct 3, 2021

    @vgvassilev
    Member

    @hageboeck, I am happy with what we have now, should we close this issue?

  17. hageboeck commented on Oct 18, 2021

    @hageboeck
    Member

    Hi @vgvassilev @Axel-Naumann,

    I overlooked something. It's only loading the macro, not running it actually.

    I get:
    30s for compiling first time + loading.
    10 - 15s for loading the existing .so, e.g.

    /usr/bin/time root -b -q -e '.L ~tnanut/public/Stephan/RooThreshold.cpp+O' >/dev/null
    1.62user 3.11system 0:10.22elapsed 46%CPU (0avgtext+0avgdata 268244maxresident)k
    

    From a user perspective, that will feel slow. As a user I would expect this to complete in ~ 2s. I know that this is asking a lot, and it's certainly better than the 2 min that @malatara reported initally, but if you see any way to squeeze a bit more out of it, I would recommend that.

    I leave it to you three if you are happy to close this issue.

  18. guitargeek commented on Dec 18, 2023

    @guitargeek
    Contributor

    Nice, this works!! Thanks!

    Since the reporter of the issue was happy with the solution...

    @hageboeck, I am happy with what we have now, should we close this issue?

    ...Vassill too...

    I leave it to you three if you are happy to close this issue.

    ...there was radio silence after it...

    lxplus962:~> /usr/bin/time root -b -q -e '.L ~tnanut/public/Stephan/RooThreshold.cpp+O' >/dev/null
    Warning in <ACLiC>: /afs/cern.ch/user/t/tnanut/public/Stephan is not writable!
    Warning in <ACLiC>: Output will be written to /tmp/rembserj/rembserj
    Info in <TUnixSystem::ACLiC>: creating shared library /tmp/rembserj/rembserj//afs/cern.ch/user/t/tnanut/public/Stephan/RooThreshold_cpp.so
    6.09user 1.24system 0:09.84elapsed 74%CPU (0avgtext+0avgdata 317852maxresident)k
    146152inputs+8568outputs (206major+212245minor)pagefaults 0swaps
    lxplus962:~> /usr/bin/time root -b -q -e '.L ~tnanut/public/Stephan/RooThreshold.cpp+O' >/dev/null
    Warning in <ACLiC>: /afs/cern.ch/user/t/tnanut/public/Stephan is not writable!
    Warning in <ACLiC>: Output will be written to /tmp/rembserj/rembserj
    0.32user 0.08system 0:00.44elapsed 91%CPU (0avgtext+0avgdata 282696maxresident)k
    0inputs+8outputs (0major+22646minor)pagefaults 0swaps
    lxplus962:~>
    

    ...and after @hageboeck's last measurements the compile+loading time went from 30s to 10s, and the loading time reduced from 10s to 0.5s, I think we can close this issue 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions