Skip to content

fixed create_kernel parameter data_type="float" to procucde single precision

Christoph Alt requested to merge ob28imeq/pystencils:fix_single_precision into master

Currently if create_kernel(assignments, data_type="float") is used then the untyped symbols are typed with float64, since the np.dtype("float") creates this during the construction of a new TypedSymbol.

Since data_type or as it is called in cpu.create_kernel type_info can be an string of an C type, At least following the documentation of cpu.create_kernel this behavior is a bit confusing, since typical the C type specifier "float" is meant to be single precision.

So I added a small function that just replaces "float" with "single" in the symbol_to_type dict, so the untyped symbols get the single precision type.

Merge request reports