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

Multiple build errors: error: static_cast from 'const lbann::l2_weight_regularization *' to 'const lbann::objective_function_term *', which are not related by inheritance, is not allowed, etc #2407

Open
yurivict opened this issue Dec 14, 2023 · 4 comments

Comments

@yurivict
Copy link

In file included from /usr/ports/misc/lbann/work/lbann-caa8e5d/src/objective_functions/weight_regularization/l2.cpp:27:
In file included from /usr/ports/misc/lbann/work/lbann-caa8e5d/include/lbann/objective_functions/weight_regularization/l2.hpp:30:
/usr/ports/misc/lbann/work/lbann-caa8e5d/include/lbann/comm_nb_request.hpp:80:3: error: unknown type name 'MPI_Request'
  MPI_Request raw_mpi_req = MPI_REQUEST_NULL;
  ^
/usr/ports/misc/lbann/work/lbann-caa8e5d/src/objective_functions/weight_regularization/l2.cpp:85:28: error: cannot initialize object parameter of type 'lbann::objective_function_term' with an expression of type 'lbann::l2_weight_regularization'
  objective_function_term::setup(m);
                           ^~~~~
/usr/ports/misc/lbann/work/lbann-caa8e5d/src/objective_functions/weight_regularization/l2.cpp:94:7: error: cannot initialize object parameter of type 'const lbann::objective_function_term' with an expression of type 'lbann::l2_weight_regularization'
  if (get_weights_pointers().empty()) {
      ^~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/lbann/work/lbann-caa8e5d/src/objective_functions/weight_regularization/l2.cpp:95:5: error: cannot initialize object parameter of type 'lbann::objective_function_term' with an expression of type 'lbann::l2_weight_regularization'
    set_weights_pointers(m.get_weights_pointers());
    ^~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/lbann/work/lbann-caa8e5d/src/objective_functions/weight_regularization/l2.cpp:99:26: error: cannot initialize object parameter of type 'const lbann::objective_function_term' with an expression of type 'lbann::l2_weight_regularization'
  for (const auto& ptr : get_weights_pointers()) {
                         ^~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/lbann/work/lbann-caa8e5d/src/objective_functions/weight_regularization/l2.cpp:132:5: error: cannot initialize object parameter of type 'lbann::objective_function_term' with an expression of type 'lbann::l2_weight_regularization'
    get_comm().nb_allreduce(
    ^~~~~~~~
/usr/ports/misc/lbann/work/lbann-caa8e5d/src/objective_functions/weight_regularization/l2.cpp:134:7: error: cannot initialize object parameter of type 'lbann::objective_function_term' with an expression of type 'lbann::l2_weight_regularization'
      get_comm().get_trainer_comm(),
      ^~~~~~~~
/usr/ports/misc/lbann/work/lbann-caa8e5d/src/objective_functions/weight_regularization/l2.cpp:176:5: error: cannot initialize object parameter of type 'lbann::objective_function_term' with an expression of type 'lbann::l2_weight_regularization'
    get_comm().wait(m_allreduce_req);
    ^~~~~~~~
/usr/ports/misc/lbann/work/lbann-caa8e5d/src/objective_functions/weight_regularization/l2.cpp:252:24: error: cannot initialize object parameter of type 'const lbann::objective_function_term' with an expression of type 'const lbann::l2_weight_regularization'
  for (auto const& w : this->get_weights_pointers())
                       ^~~~
In file included from /usr/ports/misc/lbann/work/lbann-caa8e5d/src/objective_functions/weight_regularization/l2.cpp:34:
In file included from /usr/ports/misc/lbann/work/lbann-caa8e5d/include/lbann/utils/serialize.hpp:30:
In file included from /usr/ports/misc/lbann/work/lbann-caa8e5d/include/lbann/utils/serialization/cereal_utils.hpp:32:
In file included from /usr/local/include/cereal/cereal.hpp:46:
/usr/local/include/cereal/types/base_class.hpp:104:38: error: static_cast from 'const lbann::l2_weight_regularization *' to 'const lbann::objective_function_term *', which are not related by inheritance, is not allowed
          base_ptr(const_cast<Base*>(static_cast<Base const *>(derived)))
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/lbann/work/lbann-caa8e5d/src/objective_functions/weight_regularization/l2.cpp:80:25: note: in instantiation of function template specialization 'cereal::base_class<lbann::objective_function_term>::base_class<lbann::l2_weight_regularization>' requested here
                        cereal::base_class<objective_function_term>(this)));
                        ^
10 errors generated.

rev. caa8e5d
clang-16
FreeBSD 13.2

@yurivict
Copy link
Author

The current revision still fails:

FAILED: CMakeFiles/lbann.dir/src/objective_functions/weight_regularization/l2.cpp.o 
/usr/local/libexec/ccache/c++ -DH5_BUILT_AS_DYNAMIC_LIB -Dlbann_EXPORTS -I/usr/ports/misc/lbann/work/.build -I/usr/ports/misc/lbann/work/lbann-d7c5780/include -isystem /usr/ports/misc/lbann/work/.build/src/proto -isystem /usr/local/include/El -isystem /usr/local/include/conduit -isystem /usr/ports/misc/lbann/work/Clara-2bfd8b2/include -O2 -pipe  -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing   -isystem /usr/local/include -std=c++17  -Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor -Wshadow -Wno-deprecated-declarations -O2 -pipe  -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing   -isystem /usr/local/include -std=c++17  -DNDEBUG -fPIC -pthread -fopenmp=libomp -DCONDUIT_RELAY_IO_MPI_ENABLED -DCONDUIT_BLUEPRINT_MPI_ENABLED -MD -MT CMakeFiles/lbann.dir/src/objective_functions/weight_regularization/l2.cpp.o -MF CMakeFiles/lbann.dir/src/objective_functions/weight_regularization/l2.cpp.o.d -o CMakeFiles/lbann.dir/src/objective_functions/weight_regularization/l2.cpp.o -c /usr/ports/misc/lbann/work/lbann-d7c5780/src/objective_functions/weight_regularization/l2.cpp
In file included from /usr/ports/misc/lbann/work/lbann-d7c5780/src/objective_functions/weight_regularization/l2.cpp:27:
In file included from /usr/ports/misc/lbann/work/lbann-d7c5780/include/lbann/objective_functions/weight_regularization/l2.hpp:30:
/usr/ports/misc/lbann/work/lbann-d7c5780/include/lbann/comm_nb_request.hpp:80:3: error: unknown type name 'MPI_Request'
  MPI_Request raw_mpi_req = MPI_REQUEST_NULL;
  ^
/usr/ports/misc/lbann/work/lbann-d7c5780/src/objective_functions/weight_regularization/l2.cpp:85:28: error: cannot initialize object parameter of type 'lbann::objective_function_term' with an expression of type 'lbann::l2_weight_regularization'
  objective_function_term::setup(m);
                           ^~~~~
/usr/ports/misc/lbann/work/lbann-d7c5780/src/objective_functions/weight_regularization/l2.cpp:94:7: error: cannot initialize object parameter of type 'const lbann::objective_function_term' with an expression of type 'lbann::l2_weight_regularization'
  if (get_weights_pointers().empty()) {
      ^~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/lbann/work/lbann-d7c5780/src/objective_functions/weight_regularization/l2.cpp:95:5: error: cannot initialize object parameter of type 'lbann::objective_function_term' with an expression of type 'lbann::l2_weight_regularization'
    set_weights_pointers(m.get_weights_pointers());
    ^~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/lbann/work/lbann-d7c5780/src/objective_functions/weight_regularization/l2.cpp:99:26: error: cannot initialize object parameter of type 'const lbann::objective_function_term' with an expression of type 'lbann::l2_weight_regularization'
  for (const auto& ptr : get_weights_pointers()) {
                         ^~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/lbann/work/lbann-d7c5780/src/objective_functions/weight_regularization/l2.cpp:132:5: error: cannot initialize object parameter of type 'lbann::objective_function_term' with an expression of type 'lbann::l2_weight_regularization'
    get_comm().nb_allreduce(
    ^~~~~~~~
/usr/ports/misc/lbann/work/lbann-d7c5780/src/objective_functions/weight_regularization/l2.cpp:134:7: error: cannot initialize object parameter of type 'lbann::objective_function_term' with an expression of type 'lbann::l2_weight_regularization'
      get_comm().get_trainer_comm(),
      ^~~~~~~~
/usr/ports/misc/lbann/work/lbann-d7c5780/src/objective_functions/weight_regularization/l2.cpp:176:5: error: cannot initialize object parameter of type 'lbann::objective_function_term' with an expression of type 'lbann::l2_weight_regularization'
    get_comm().wait(m_allreduce_req);
    ^~~~~~~~
/usr/ports/misc/lbann/work/lbann-d7c5780/src/objective_functions/weight_regularization/l2.cpp:252:24: error: cannot initialize object parameter of type 'const lbann::objective_function_term' with an expression of type 'const lbann::l2_weight_regularization'
  for (auto const& w : this->get_weights_pointers())
                       ^~~~
In file included from /usr/ports/misc/lbann/work/lbann-d7c5780/src/objective_functions/weight_regularization/l2.cpp:34:
In file included from /usr/ports/misc/lbann/work/lbann-d7c5780/include/lbann/utils/serialize.hpp:30:
In file included from /usr/ports/misc/lbann/work/lbann-d7c5780/include/lbann/utils/serialization/cereal_utils.hpp:32:
In file included from /usr/local/include/cereal/cereal.hpp:46:
/usr/local/include/cereal/types/base_class.hpp:104:38: error: static_cast from 'const lbann::l2_weight_regularization *' to 'const lbann::objective_function_term *', which are not related by inheritance, is not allowed
          base_ptr(const_cast<Base*>(static_cast<Base const *>(derived)))
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/lbann/work/lbann-d7c5780/src/objective_functions/weight_regularization/l2.cpp:80:25: note: in instantiation of function template specialization 'cereal::base_class<lbann::objective_function_term>::base_class<lbann::l2_weight_regularization>' requested here
                        cereal::base_class<objective_function_term>(this)));
                        ^
10 errors generated.

I think that lbann is broken due to persistent C++ errors.

@tbennun Maybe you know how to compile lbann, since you regularly commit into this repository?

rev. d7c5780
clang-16
FreeBSD 14.0

@tbennun
Copy link
Contributor

tbennun commented Jan 25, 2024

@yurivict yes, you can see how LBANN is compiled on our GitHub CI. I have never encountered those two compiler errors, so I think it could be some dependency version mismatch?
For example, the lack of MPI_Request seems to indicate that MPI headers are not included. Do you compile without Aluminum?

@yurivict
Copy link
Author

@tbennun
I compile without Aluminum. But even when Aluminum is present it isn't discovered by cmake and it prints:

LBANN_HAS_ALUMINUM: FALSE

MPICH headers are installed in /usr/local/include.

@jvwilliams23
Copy link
Contributor

@yurivict we have a script on how to build lbann with our HPC using spack. Maybe it is useful for you.

https://github.com/nmnobre/LBANN-ScafellPike/blob/main/lbann.sh

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

3 participants