| b8b5be36 | 21-Jul-2025 |
Martin Diehl <mail@martin-diehl.net> |
distinguish Boolean and Integer
MPI_Comm_get_attr has PetscMPIInt as flag argument, not PetscBool. Name this flag "iflg" (was used somewhere already). Use MPI_LAND instead of MPI_BAND for logical op
distinguish Boolean and Integer
MPI_Comm_get_attr has PetscMPIInt as flag argument, not PetscBool. Name this flag "iflg" (was used somewhere already). Use MPI_LAND instead of MPI_BAND for logical operations instead of MPI_MIN, MPI_MAX, and MPI_LAND.
Note: Most of the previous code was probably working as intended, I did the changes when debugging error related to the use of standard C Bool and kept them because it took me a while to understand that MPI has integer flags and PETSc has Booleans. Using different names makes this clear, but was and is not done consistently.
show more ...
|
| ad49c6e3 | 19-Jul-2025 |
Martin Diehl <mail@martin-diehl.net> |
ensure that Fortran Bool is interoperable
The kind C_BOOL for logical from ISO_C_binding only defines the size of the logical as 1 Byte. It does not define which values (bit patterns) are used to en
ensure that Fortran Bool is interoperable
The kind C_BOOL for logical from ISO_C_binding only defines the size of the logical as 1 Byte. It does not define which values (bit patterns) are used to encode true and false. In stdbool.h from C, true is defined as 1 and false as 0, but these values are not guaranteed by the Fortran standard.
There are (at least) two contemporary Fortran compilers that use a difference convention: Intel Fortran (ifort and ifx) and NVIDIA Fortran (nvfortran, former PGI). Both represent true as all bits set, i.e. -1 for a signed integer or 255 for an unsigned integer.
Intel Fortran can be made interoperable with the "-standard-semantics" or "-fpscomp logicals". The latter is now set by default to ensure interoperability while avoiding effects such as modified name mangling rules and performance degradations due to the former.
NVIDIA Fortran can be made interoperable with the "-Munixlogical" flag. This is set manually in the "linux-cuda-single-cxx" pipeline. This is now set by default.
show more ...
|