hypre icon indicating copy to clipboard operation
hypre copied to clipboard

--enable-bigint: long long int vs int64_t

Open lahwaacz opened this issue 2 years ago • 0 comments

I'm having issues with enabling "bigint" support in Hypre because the --enable-bigint configure flag sets HYPRE_BigInt to long long int, which is none of the standard fixed width integer types provided by C++11. That is assuming a 64-bit compiler, see https://stackoverflow.com/questions/4160945/long-long-int-vs-long-int-vs-int64-t-in-c for more info.

Consequently, using Hypre together with some other library which assumes the fixed-width types for indexes is problematic, because function overloads and template specializations may be ambiguous. Consider e.g. function declarations like

void foo(std::int32_t);
void foo(std::uint32_t);
void foo(std::int64_t);
void foo(std::uint64_t);

and try to call foo(value) where value is HYPRE_Int, i.e. long long int.

I could surely try to force manual conversions in the code using both libraries, but that would be quite some boilerplate code. Considering that these problems seem to appear on a low level, it might be better to force HYPRE_Int to int64_t instead of long long int. I understand you may not want to do it via --enable-bigint for backwards compatibility, but can you add another flag to explicitly set a custom index type?

lahwaacz avatar Jul 23 '22 07:07 lahwaacz