<div dir="ltr">This is what we currently have in PETSc, we check for sizeof and cast <br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno mer 13 apr 2022 alle ore 17:13 Jed Brown <<a href="mailto:jed@jedbrown.org">jed@jedbrown.org</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">C/C++ integer hierarchy was a mistake, with the language-specified types overlapping and the size-specific (int64_t) being typedefs. So long is "different" from long long even if they're both 64-bit signed integers.<br>
<br>
I think they should test that sizeof(HYPRE_Int) == sizeof(PetscInt), but not that they're "the same". They might still need some casts depending on usage.<br>
<br>
Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank">bsmith@petsc.dev</a>> writes:<br>
<br>
> For 64 bit integer builds  AMReX has this test in their code<br>
><br>
> CMakeFiles/amrex.dir/F_Interfaces/Base/AMReX_multifab_mod.F90.o<br>
> /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"<br>
>       static_assert(std::is_same<HYPRE_Int, PetscInt>::value, "HYPRE_Int != PetscInt");<br>
><br>
>  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.<br>
><br>
>   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.<br>
><br>
>  What is the correct general fix for this three-body problem?<br>
><br>
>    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 <br>
><br>
>    Do HYPRE and PETSc configure need to have command-line options to allow controlling exactly the type used to ensure matching? <br>
><br>
>    Something else?<br>
><br>
>   Barry<br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature">Stefano</div>