Using real_t for toMatrix does not work with types that are not real_t
Within the file hog/operator_generation/kernel_types.py
a generic field called mat is created and its dtype
is set to real_t
. This only works if everything is real_t
, when you want to use other types, e.g. for mixed precision, compile errors occur, since real_t
(usually float64) cannot be converted to a 'smaller' type.
cannot convert '
walberla::real_t*
' {aka 'double*
'} to 'const float*
'
The question is, what is the desired behavior. I understand that the signature is given as real_t
and maybe it is mathematically advised to even use float64, but this way it is not possible to experiment with different precisions.
Code part of interest (kernel_types.py line 268 to 276) link-to-code:
# NOTE: The type is 'hyteg_type().pystencils_type', i.e. `real_t`
# (not `self._type_descriptor.pystencils_type`)
# because this function is implemented manually in HyTeG with
# this signature. Passing `np.float64` is not ideal (if `real_t !=
# double`) but it makes sure that casts are inserted if necessary
# (though some might be superfluous).
mat = create_generic_fields( ["mat"], dtype=hyteg_type(HOGPrecision.REAL_T).pystencils_type )[0]