Enabling Multi Threading in My Custom action


Please read tips for efficient and successful posting and posting code

_ROOT Version: ROOT 6.27/01
Platform: Ubuntu (Windows subsystem for Linux
Compiler: gcc

Whenever I write ROOT::EnableImplicitMT(2), and run it, it ran successfully but with a warning …

Warning in : Cannot enable implicit multi-threading with 2 threads, please build ROOT with -Dimt=ON

Although I build it again with cmake -Dimt=ON , still its showing. Please help!

May be @eguiraud can help ?

Hi @Sayandeep_Ghosh ,
you specified -Dimt=ON but somehow ROOT built without. There was probably some information as to why in the cmake configuration output, i.e. what’s printed after you run cmake ... -Dimt=ON path/to/source. Can you please paste that output here?

You can also confirm that imt is OFF for your build by running e.g. grep imt path/to/build/CMakeCache.txt.

Cheers,
Enrico

sayang@DESKTOP-IFS80HM:~/root_src2/buildroot$ cmake Dimt=ON …/

– Detected ROOT_VERSION 6.27.01
– Checking internet connectivity…
– No: will not automatically download external dependencies
– Looking for Python
– Found Python3: /usr/bin/python3.8 (found version “3.8.10”) found components: Interpreter Development NumPy
– Could NOT find Python2 (missing: Python2_NumPy_INCLUDE_DIRS NumPy) (found version “2.7.18”)
– Found GCC. Major version 9, minor version 3
– ROOT Platform: linux
– ROOT Compiler: GNU 9.3.0
– ROOT Processor: x86_64
– ROOT Architecture: linuxx8664gcc
– Build Type: ‘Release’ (flags = ‘-O3 -DNDEBUG’)
– Compiler Flags: -std=c++17 -Wno-implicit-fallthrough -Wno-noexcept-type -pipe -Wshadow -Wall -W -Woverloaded-virtual -fsigned-char -pthread -O3 -DNDEBUG
– ROOT default compression algorithm: zlib
– PyROOT will be built for versions 3.8.10 (Main) and 2.7.18
– Looking for ZLib
– Looking for Freetype
– Building LZMA version 5.2.4 included in ROOT itself
– Looking for X11
– Could NOT find GIF (missing: GIF_LIBRARY GIF_INCLUDE_DIR)
– Could NOT find TIFF (missing: TIFF_LIBRARY TIFF_INCLUDE_DIR)
– Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR)
– Building AfterImage library included in ROOT itself
– Looking for LibXml2
– Looking for Protobuf
CUDA_TOOLKIT_ROOT_DIR not found or specified
– Could NOT find CUDA (missing: CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY)
– CUDA not found. Disable RooFit and TMVA cuda computation
– Building LLVM in ‘Release’ mode.
– Could NOT find Z3: Found unsuitable version “0.0.0”, but required is at least “4.7.1” (found Z3_LIBRARIES-NOTFOUND)
– Native target architecture is X86
– Threads disabled.
– Doxygen disabled.
– Go bindings disabled.
– Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH)
– OCaml bindings disabled.
– LLVM host triple: x86_64-unknown-linux-gnu
– LLVM default target triple: x86_64-unknown-linux-gnu
– Building with -fPIC
– Constructing LLVMBuild project information
– Linker detection: GNU ld
– Targeting X86
– Targeting NVPTX
– Clang version: 9.0.1
– Cling version (from VERSION file): ROOT_1.0~dev
– Cling will look for C++ headers in ‘/usr/include/c++/9:/usr/include/x86_64-linux-gnu/c++/9:/usr/include/c++/9/backward’ at runtime.
– And then fallback to: ‘x86_64-linux-gnu-g+±9’
– Use SSL API VERSION 1.1 for civetweb
– Performing Test found_stdstringview
– Performing Test found_stdstringview - Success
– Performing Test found_stod_stringview
– Performing Test found_stod_stringview - Failed
– Performing Test found_stdapply
– Performing Test found_stdapply - Success
– Performing Test found_stdinvoke
– Performing Test found_stdinvoke - Success
– Performing Test found_stdindexsequence
– Performing Test found_stdindexsequence - Success
– ROOT Configuration

System Linux-4.4.0-19041-Microsoft
Processor 4 core Intel(R) Core™ i5-9300H CPU @ 2.40GHz (x86_64)
Build type Release
Install path /home/sayang/root_install
Compiler GNU 9.3.0
Compiler flags:
C -Wno-implicit-fallthrough -pipe -Wall -W -pthread -O3 -DNDEBUG
C++ -std=c++17 -Wno-implicit-fallthrough -Wno-noexcept-type -pipe -Wshadow -Wall -W -Woverloaded-virtual -fsigned-char -pthread -O3 -DNDEBUG
Linker flags:
Executable -rdynamic
Module
Shared -Wl,–no-undefined -Wl,–hash-style=“both”

– Enabled support for: asimage builtin_afterimage builtin_clang builtin_cling builtin_llvm builtin_lz4 builtin_lzma builtin_nlohmannjson builtin_openui5 builtin_pcre builtin_xxhash builtin_zstd dataframe exceptions gdml http mlp minuit2 pyroot roofit root7 rpath runtime_cxxmodules shared ssl tmva tmva-sofie tmva-pymva spectrum x11 xml
– Configuring done
– Generating done
– Build files have been written to: /home/sayang/root_src2/buildroot

I think the problem is

– Checking internet connectivity…
– No: will not automatically download external dependencies

as imt=ON would need to download and build the Intel TBB library – @bellenot can you confirm?

Well, in this case, there should be a message like:

No internet connection, disabling 'builtin_tbb' and 'imt' options

To make sure, you can try to enable fail-on-missing (-Dfail-on-missing=ON)

sudo apt-get install libtbb-dev

cmake -Dall=ON ...

1 Like

Uhm -Dimt=ON was specified but builtin_tbb is not listed in the enabled features, so that message might be skipped for some reason…

Then -Dbuiltin_tbb=ON is required, but in this case, it will fail without internet connection

After writing
sudo apt-get install libtbb-dev

cmake -Dall=ON ...

imt got included in root-config --features

sayang@DESKTOP-IFS80HM:~/root_src/tutorials/dataframe$ root df022_useKahan.C

| Welcome to ROOT 6.27/01 https://root.cern |
| (c) 1995-2021, The ROOT Team; conception: R. Brun, F. Rademakers |
| Built for linuxx8664gcc on Mar 18 2022, 19:30:00 |
| From heads/master@v6-25-02-721-gb92cbb9ea9 |
| With c++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 |

Try ‘.help’, ‘.demo’, ‘.license’, ‘.credits’, ‘.quit’/’.q’

root [0]
Processing df022_useKahan.C…
Kahan: 1000000000.00000011920929 Classical: 1000000000
terminate called after throwing an instance of ‘std::runtime_error’
what(): Display was called with ImplicitMT enabled, but multi-thread is not supported.

and when I ran the same thing with my custom action

sayang@DESKTOP-IFS80HM:~/root_src/tutorials/dataframe$ root my_custom_action.C

| Welcome to ROOT 6.27/01 https://root.cern |
| (c) 1995-2021, The ROOT Team; conception: R. Brun, F. Rademakers |
| Built for linuxx8664gcc on Mar 18 2022, 19:30:00 |
| From heads/master@v6-25-02-721-gb92cbb9ea9 |
| With c++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 |

Try ‘.help’, ‘.demo’, ‘.license’, ‘.credits’, ‘.quit’/’.q’

root [0]
Processing my_custom_action.C…
The final sum is :0.530221

But after writing cmake -Dbuiltin_tbb=ON …/ in the build directory imt got eliminated from root-config --features.

Did I tell you to “-Dbuiltin_tbb=ON”?

BTW. It seems that you report a problem in the df022_useKahan.C tutorial when run “with ImplicitMT enabled” → @eguiraud is the author.

You must specify both -Dimt=ON -Dbuiltin_tbb=ON to use the built-in one (with an internet connection), or simply -Dimt=ON if you want to use the system installed one

Thanks ,the issue was solved but error which I reported in df022_useKahan.C is still coming.

@bellenot You do NOT have to specify -Dimt=ON because this is the default.

@Wile_E_Coyote it is just to make sure, in case it has been disabled by a precedent error

Uhm, there is no Display call in df022_useKahan.C :smiley: so you must have modified the code there.

As the error message says, Display cannot be used in multi-thread runs, so that’s expected.

Cheers,
Enrico

1 Like

Thanks a lot for your help!

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