[petsc-dev] C++ and hypre long long int vs PETSc int64_t for 64 bit integer builds

Barry Smith bsmith at petsc.dev
Wed Apr 13 09:09:50 CDT 2022


For 64 bit integer builds  AMReX has this test in their code

CMakeFiles/amrex.dir/F_Interfaces/Base/AMReX_multifab_mod.F90.o
/lcrc/project/PhloughToolz/petsc/petsc-3.17.0_oneAPI_2021.4.0.3422/externalpackages/git.amrex/Src/Extern/PETSc/AMReX_PETSc.cpp(44): error: static assertion failed with "HYPRE_Int != PetscInt"
      static_assert(std::is_same<HYPRE_Int, PetscInt>::value, "HYPRE_Int != PetscInt");

 Currently, hypre uses long lont int for 64 bit integers, PETSc depending on what MPI and integer types are available uses int64_t but may fall back to long long int.

  This means depending on configuration information the PETSc built hypre and PETSc may or may not be compatible by the AMReX tests for C++ code.

 What is the correct general fix for this three-body problem?

   Will the C++ code in AMReX, which presumably is template-and-polymorphic-method-city, fail if the long long int and int64_t are mixed and treated as the same (that is one just removes the is_same() check)? Clearly, the easiest fix 

   Do HYPRE and PETSc configure need to have command-line options to allow controlling exactly the type used to ensure matching? 

   Something else?

  Barry








More information about the petsc-dev mailing list