Skip to content

Inline-friendly dot product. - #5113

Closed
RudolfWeeber wants to merge 1 commit into
espressomd:pythonfrom
RudolfWeeber:inline_friendly_dot_product
Closed

Inline-friendly dot product.#5113
RudolfWeeber wants to merge 1 commit into
espressomd:pythonfrom
RudolfWeeber:inline_friendly_dot_product

Conversation

@RudolfWeeber

Copy link
Copy Markdown
Contributor

No description provided.

@RudolfWeeber

Copy link
Copy Markdown
Contributor Author

@jngrad,

I observed the not-inlined dot-product (probably originating from v.norm() with GCC13 on the shared memory pr (5097):

From perf Output:

     4.24%  python3         espresso_core.so                                   [.] auto Utils::operator*<3ul, double, double, void>(Utils::Vector<double, 3ul> const&, Utils::Vector<double, 3ul> const&)

@jngrad

jngrad commented Jul 15, 2025

Copy link
Copy Markdown
Member

In a debug build with the python branch:

$ nm -D src/core/espresso_core.so | grep inner | c++filt
double boost::inner_product<std::vector<double>, std::vector<double>, double>(std::vector<double> const&, std::vector<double> const&, double)
double std::inner_product<double const*, double const*, double>(double const*, double const*, double const*, double)
double std::inner_product<int const*, double const*, double>(int const*, int const*, double const*, double)
int std::inner_product<int const*, int const*, int>(int const*, int const*, int const*, int)
$ nm -D src/core/espresso_core.so | grep operator | c++filt
P3MStateCommon<double>::calc_differential_operator()
P3MStateCommon<float>::calc_differential_operator()
boost::iterators::detail::operator_arrow_dispatch<BondView, BondView*>::apply(BondView const&)
boost::iterators::detail::operator_arrow_dispatch<BondView, BondView*>::proxy::proxy(BondView const&)
boost::iterators::detail::operator_arrow_dispatch<BondView, BondView*>::proxy::proxy(BondView const&)
boost::iterators::detail::operator_arrow_dispatch<BondView, BondView*>::proxy::operator->()
boost::iterators::detail::operator_arrow_dispatch<Cell&, Cell*>::apply(Cell&)

In a release build, these symbols disappear. The boost::inner_product comes from the Utils::Matrix class. PR 5097 has extra operator symbols from Kokkos.

@RudolfWeeber Which build options are you currently using?

@RudolfWeeber

Copy link
Copy Markdown
Contributor Author

@jngrad,
CMake says: release.
Here is one of the compilation commands form the json:

{
  "directory": "/tikhome/weeber/es/build_minimal/src/core",
  "command": "/usr/bin/g++-13 -DBOOST_MPI_DYN_LINK -DBOOST_MPI_NO_LIB -DBOOST_SERIALIZATION_DYN_LINK -DBOOST_SERIALIZATION_NO_LIB -DKOKKOS_DEPENDENCE -DR123_USE_MULHILO64_C99 -Despresso_core_EXPORTS -I/tikhome/weeber/es/src/core -I/tikhome/weeber/es/src/config/include -I/tikhome/weeber/es/build_minimal/src/config/include -I/tikhome/weeber/es/src/utils/include -I/tikhome/weeber/es/src/shapes/include -I/tikhome/weeber/es/build_minimal/_deps/cabana-src/core/src -I/tikhome/weeber/es/build_minimal/_deps/cabana-build/core/src -I/tikhome/weeber/es/src/instrumentation/include -I/tikhome/weeber/es/build_minimal/_deps/caliper-src/include -I/tikhome/weeber/es/build_minimal/_deps/caliper-build/include -I/tikhome/weeber/es/src/walberla_bridge/include -isystem /tikhome/weeber/.local/include -isystem /usr/include/hdf5/openmpi -isystem /usr/lib/x86_64-linux-gnu/openmpi/include -isystem /usr/lib/x86_64-linux-gnu/openmpi/include/openmpi -isystem /tikhome/weeber/es/libs/Random123-1.09/include -isystem /tikhome/weeber/es/src/particle_observables/include -O3 -DNDEBUG -std=c++20 -fPIC -Wall -Wextra -pedantic -Wfloat-conversion -Wdelete-non-virtual-dtor -Wcast-qual -Wcast-align -Wunused-macros -Wpointer-arith -Winit-self -Wformat-signedness -Wformat=2 -Wduplicated-branches -Wshadow=compatible-local -Wno-sign-compare -Wno-unused-function -Wno-unused-parameter -Wno-array-bounds -Wno-restrict -Wno-clobbered -Wno-cast-function-type -Wno-implicit-fallthrough -Wno-format-nonliteral -Wno-float-conversion -Wno-cast-qual -DBOOST_MPL_CFG_NO_PREPROCESSED_HEADERS -DBOOST_MPL_LIMIT_LIST_SIZE=30 -fopenmp -o CMakeFiles/espresso_core.dir/communication.cpp.o -c /tikhome/weeber/es/src/core/communication.cpp",
  "file": "/tikhome/weeber/es/src/core/communication.cpp",
  "output": "src/core/CMakeFiles/espresso_core.dir/communication.cpp.o"
},

@jngrad

jngrad commented Jul 15, 2025

Copy link
Copy Markdown
Member

To reproduce your build, I must use -D ESPRESSO_BUILD_WITH_SHARED_MEMORY_PARALLELISM=OFF.

Still, command for f in $(find src -name "*.so"); do nm -D $f | grep inner | c++filt; done returns nothing.

@jngrad

jngrad commented Jul 15, 2025

Copy link
Copy Markdown
Member

To reproduce the issue, an Intel CPU is needed. I could reproduce it on i7-12700, i7-12700K, i7-14700K.

@jngrad jngrad mentioned this pull request Jul 15, 2025
@jngrad jngrad closed this Jul 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants