Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined reference to `void costa::transform<float>(std::__1::vector<std::__1:: ... #141

Open
yurivict opened this issue Apr 26, 2024 · 3 comments

Comments

@yurivict
Copy link

yurivict commented Apr 26, 2024

Build fails:

FAILED: miniapp/layout_miniapp 
: && /usr/local/libexec/ccache/c++ -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -fno-strict-aliasing   -DNDEBUG -fstack-protector-strong     -Wl,-rpath=-Wl,-rpath=/usr/local/lib/gcc13 -Wl,-rpath -Wl,/usr/local/mpi/openmpi/lib -Wl,--enable-new-dtags -pthread miniapp/CMakeFiles/layout_miniapp.dir/layout_miniapp.cpp.o -o miniapp/layout_miniapp  -Wl,-rpath,/usr/ports/math/cosma/work/.build/src/cosma:/usr/local/lib:/usr/local/mpi/openmpi/lib:  src/cosma/libcosma.so  /usr/local/lib/libcosta.so  /usr/local/mpi/openmpi/lib/libmpi_cxx.so  /usr/local/mpi/openmpi/lib/libmpi.so  /usr/lib/libomp.so  /usr/local/lib/libopenblas.so && :
/usr/local/bin/x86_64-unknown-freebsd14.0-ld: warning: libmpi.so.12, needed by /usr/local/lib/libcosta.so, may conflict with libmpi.so.40
/usr/local/bin/x86_64-unknown-freebsd14.0-ld: src/cosma/libcosma.so: undefined reference to `void costa::transform<double>(std::__1::vector<std::__1::reference_wrapper<costa::grid_layout<double> >, std::__1::allocator<std::__1::reference_wrapper<costa::grid_layout<double> > > >&, std::__1::vector<std::__1::reference_wrapper<costa::grid_layout<double> >, std::__1::allocator<std::__1::reference_wrapper<costa::grid_layout<double> > > >&, char const*, double const*, double const*, ompi_communicator_t*)'
/usr/local/bin/x86_64-unknown-freebsd14.0-ld: src/cosma/libcosma.so: undefined reference to `void costa::transform<double>(std::__1::vector<std::__1::reference_wrapper<costa::grid_layout<double> >, std::__1::allocator<std::__1::reference_wrapper<costa::grid_layout<double> > > >&, std::__1::vector<std::__1::reference_wrapper<costa::grid_layout<double> >, std::__1::allocator<std::__1::reference_wrapper<costa::grid_layout<double> > > >&, ompi_communicator_t*)'
/usr/local/bin/x86_64-unknown-freebsd14.0-ld: src/cosma/libcosma.so: undefined reference to `void costa::transform<std::__1::complex<double> >(std::__1::vector<std::__1::reference_wrapper<costa::grid_layout<std::__1::complex<double> > >, std::__1::allocator<std::__1::reference_wrapper<costa::grid_layout<std::__1::complex<double> > > > >&, std::__1::vector<std::__1::reference_wrapper<costa::grid_layout<std::__1::complex<double> > >, std::__1::allocator<std::__1::reference_wrapper<costa::grid_layout<std::__1::complex<double> > > > >&, ompi_communicator_t*)'
/usr/local/bin/x86_64-unknown-freebsd14.0-ld: src/cosma/libcosma.so: undefined reference to `void costa::transform<std::__1::complex<float> >(std::__1::vector<std::__1::reference_wrapper<costa::grid_layout<std::__1::complex<float> > >, std::__1::allocator<std::__1::reference_wrapper<costa::grid_layout<std::__1::complex<float> > > > >&, std::__1::vector<std::__1::reference_wrapper<costa::grid_layout<std::__1::complex<float> > >, std::__1::allocator<std::__1::reference_wrapper<costa::grid_layout<std::__1::complex<float> > > > >&, char const*, std::__1::complex<float> const*, std::__1::complex<float> const*, ompi_communicator_t*)'
/usr/local/bin/x86_64-unknown-freebsd14.0-ld: src/cosma/libcosma.so: undefined reference to `void costa::transform<std::__1::complex<float> >(std::__1::vector<std::__1::reference_wrapper<costa::grid_layout<std::__1::complex<float> > >, std::__1::allocator<std::__1::reference_wrapper<costa::grid_layout<std::__1::complex<float> > > > >&, std::__1::vector<std::__1::reference_wrapper<costa::grid_layout<std::__1::complex<float> > >, std::__1::allocator<std::__1::reference_wrapper<costa::grid_layout<std::__1::complex<float> > > > >&, ompi_communicator_t*)'
/usr/local/bin/x86_64-unknown-freebsd14.0-ld: src/cosma/libcosma.so: undefined reference to `void costa::transform<std::__1::complex<double> >(std::__1::vector<std::__1::reference_wrapper<costa::grid_layout<std::__1::complex<double> > >, std::__1::allocator<std::__1::reference_wrapper<costa::grid_layout<std::__1::complex<double> > > > >&, std::__1::vector<std::__1::reference_wrapper<costa::grid_layout<std::__1::complex<double> > >, std::__1::allocator<std::__1::reference_wrapper<costa::grid_layout<std::__1::complex<double> > > > >&, char const*, std::__1::complex<double> const*, std::__1::complex<double> const*, ompi_communicator_t*)'
/usr/local/bin/x86_64-unknown-freebsd14.0-ld: src/cosma/libcosma.so: undefined reference to `void costa::transform<float>(std::__1::vector<std::__1::reference_wrapper<costa::grid_layout<float> >, std::__1::allocator<std::__1::reference_wrapper<costa::grid_layout<float> > > >&, std::__1::vector<std::__1::reference_wrapper<costa::grid_layout<float> >, std::__1::allocator<std::__1::reference_wrapper<costa::grid_layout<float> > > >&, ompi_communicator_t*)'
/usr/local/bin/x86_64-unknown-freebsd14.0-ld: src/cosma/libcosma.so: undefined reference to `void costa::transform<float>(std::__1::vector<std::__1::reference_wrapper<costa::grid_layout<float> >, std::__1::allocator<std::__1::reference_wrapper<costa::grid_layout<float> > > >&, std::__1::vector<std::__1::reference_wrapper<costa::grid_layout<float> >, std::__1::allocator<std::__1::reference_wrapper<costa::grid_layout<float> > > >&, char const*, float const*, float const*, ompi_communicator_t*)'
c++: error: linker command failed with exit code 1 (use -v to see invocation)

Version: 2.6.6
costa-2.2.2
clang-17
FreeBSD 14.0

@simonpintarelli
Copy link
Member

simonpintarelli commented Apr 26, 2024

Why is cosma compiled with GCC while clang is used for costa?

/usr/local/bin/x86_64-unknown-freebsd14.0-ld: warning: libmpi.so.12, needed by /usr/local/lib/libcosta.so, may conflict with libmpi.so.40

MPI implementations shouldn't be mixed here.

Iirc you are packaging CP2K on FreeBSD. Cosma is an optional dependency. It is used on HPC systems to optimize communication in distributed (very large) matrix-matrix multiplications. I very much doubt it brings any improvement to a workstation use case. You might want to consider simplify the package and build CP2K without cosma.
If you build CP2K with SIRIUS, which adds the possibility to run plane-wave DFT, COSTA will be required for SIRIUS though.

@yurivict
Copy link
Author

No, it's not compiled with gcc. The link path containing gcc doesn't mean that it is compiled by gcc.

I got this error while trying to update the FreeBSD port to the new version.
This port is currently not used, but it is intended to be used by sirius and cp2k.

@simonpintarelli
Copy link
Member

simonpintarelli commented Apr 26, 2024

There is the warning about different mpi soname.
All undefined references expect ompi_communicator_t.
Can you please compile costa and cosma using the same MPI library?

What does nm -DC libcosta.so show?

Otherwise I can't explain the missing symbol. All of the above symbols are explicitly instantiated in https://github.com/eth-cscs/COSTA/blob/master/src/costa/grid2grid/transform.cpp#L294, while transform.hpp contains just a template on the number type.

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

No branches or pull requests

2 participants