mfem: linalg/hiop.hpp:81:21: error: invalid conversion from 'const void*' to 'void*'

If HIOP support enabled, the build fails on the following:

:info:build In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_mfem/mfem/work/mfem-4.5.2/linalg/linalg.hpp:45,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_mfem/mfem/work/mfem-4.5.2/linalg/auxiliary.cpp:16:
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_mfem/mfem/work/mfem-4.5.2/linalg/hiop.hpp: In constructor 'mfem::HiopOptimizationProblem::HiopOptimizationProblem(const hypre_MPI_Comm&, const mfem::OptimizationProblem&)':
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_mfem/mfem/work/mfem-4.5.2/linalg/hiop.hpp:81:21: error: invalid conversion from 'const void*' to 'void*' [-fpermissive]
:info:build    81 |       MPI_Allreduce(&ntdofs_loc, &ntdofs_glob, 1, MPI_HIOP_SIZE_TYPE, MPI_SUM, comm);
:info:build       |                     ^~~~~~~~~~~
:info:build       |                     |
:info:build       |                     const void*
:info:build In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_mfem/mfem/work/mfem-4.5.2/linalg/../fem/../mesh/../fem/../linalg/linalg.hpp:45,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_mfem/mfem/work/mfem-4.5.2/linalg/../fem/../mesh/../fem/fe.hpp:17,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_mfem/mfem/work/mfem-4.5.2/linalg/../fem/../mesh/triangle.hpp:16,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_mfem/mfem/work/mfem-4.5.2/linalg/../fem/../mesh/mesh.hpp:18,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_mfem/mfem/work/mfem-4.5.2/linalg/../fem/fespace.hpp:17,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_mfem/mfem/work/mfem-4.5.2/linalg/tlayout.hpp:16,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_mfem/mfem/work/mfem-4.5.2/linalg/kernels.hpp:21,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_mfem/mfem/work/mfem-4.5.2/linalg/densemat.cpp:16:
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_mfem/mfem/work/mfem-4.5.2/linalg/../fem/../mesh/../fem/../linalg/hiop.hpp: In constructor 'mfem::HiopOptimizationProblem::HiopOptimizationProblem(const hypre_MPI_Comm&, const mfem::OptimizationProblem&)':
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_mfem/mfem/work/mfem-4.5.2/linalg/../fem/../mesh/../fem/../linalg/hiop.hpp:81:21: error: invalid conversion from 'const void*' to 'void*' [-fpermissive]
:info:build    81 |       MPI_Allreduce(&ntdofs_loc, &ntdofs_glob, 1, MPI_HIOP_SIZE_TYPE, MPI_SUM, comm);
:info:build       |                     ^~~~~~~~~~~
:info:build       |                     |
:info:build       |                     const void*
:info:build In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_mfem/mfem/work/mfem-4.5.2/linalg/linalg.hpp:45,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_mfem/mfem/work/mfem-4.5.2/linalg/sparsemat.cpp:14:
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_mfem/mfem/work/mfem-4.5.2/linalg/hiop.hpp: In constructor 'mfem::HiopOptimizationProblem::HiopOptimizationProblem(const hypre_MPI_Comm&, const mfem::OptimizationProblem&)':
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_mfem/mfem/work/mfem-4.5.2/linalg/hiop.hpp:81:21: error: invalid conversion from 'const void*' to 'void*' [-fpermissive]
:info:build    81 |       MPI_Allreduce(&ntdofs_loc, &ntdofs_glob, 1, MPI_HIOP_SIZE_TYPE, MPI_SUM, comm);
:info:build       |                     ^~~~~~~~~~~
:info:build       |                     |
:info:build       |                     const void*
:info:build In file included from /opt/local/include/seq_mv.h:23,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_mfem/mfem/work/mfem-4.5.2/linalg/hypre.hpp:25,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_mfem/mfem/work/mfem-4.5.2/linalg/complex_operator.hpp:18,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_mfem/mfem/work/mfem-4.5.2/linalg/linalg.hpp:21:
:info:build /opt/local/include/_hypre_utilities.h:353:38: note:   initializing argument 1 of 'HYPRE_Int hypre_MPI_Allreduce(void*, void*, HYPRE_Int, hypre_MPI_Datatype, hypre_MPI_Op, hypre_MPI_Comm)'
:info:build   353 | HYPRE_Int hypre_MPI_Allreduce( void *sendbuf , void *recvbuf , HYPRE_Int count , hypre_MPI_Datatype datatype , hypre_MPI_Op op , hypre_MPI_Comm comm );
:info:build       |                                ~~~~~~^~~~~~~
:info:build In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_mfem/mfem/work/mfem-4.5.2/linalg/linalg.hpp:45,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_mfem/mfem/work/mfem-4.5.2/linalg/solvers.cpp:12:
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_mfem/mfem/work/mfem-4.5.2/linalg/hiop.hpp: In constructor 'mfem::HiopOptimizationProblem::HiopOptimizationProblem(const hypre_MPI_Comm&, const mfem::OptimizationProblem&)':
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_mfem/mfem/work/mfem-4.5.2/linalg/hiop.hpp:81:21: error: invalid conversion from 'const void*' to 'void*' [-fpermissive]
:info:build    81 |       MPI_Allreduce(&ntdofs_loc, &ntdofs_glob, 1, MPI_HIOP_SIZE_TYPE, MPI_SUM, comm);
:info:build       |                     ^~~~~~~~~~~
:info:build       |                     |
:info:build       |                     const void*

Suggested flag will likely get past the error, but it is better to fix the source.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 21 (19 by maintainers)

Most upvoted comments

You can check for

/* Define to 1 if an MPI library is found */
#define HYPRE_HAVE_MPI 1

in the header HYPRE_config.h.

It looks like you are using fairly old MPI implementation conforming to MPI-2.2 or older. In these older versions, the first argument of MPI_Allreduce is non-const, see https://www.mpi-forum.org/docs/mpi-2.2/mpi22-report.pdf#subsection.5.9.6. Starting with MPI-3.0, the same argument is const void *, see https://www.mpi-forum.org/docs/mpi-3.0/mpi30-report.pdf#subsection.5.9.6.