OP-DSL / OP2-Common

OP2: open-source framework for the execution of unstructured grid applications on clusters of GPUs or multi-core CPUs
https://op-dsl.github.io
Other
98 stars 46 forks source link

Silent failures of kernels with incorrectly specified access type #229

Open bozbez opened 2 years ago

bozbez commented 2 years ago

Currently the translator optimistically assumes that the user has specified the correct access type in the op_arg. In the case they didn't, the code will fail at run-time most likely in a way where the dataset values end up being incorrect or NaN, or with the kernel experiencing degraded performance due to increased MPI communication.

Complete static verification of access types is not possible as mappings are loaded at run-time, however it might be good to extend the translator to perform basic checks of the user kernel to check that the dataset pointers are not used in an obviously wrong manner.

One example of where could help this kernel function from MG-CFD that was incorrectly specifying OP_INC for it's argument which should've been OP_RW:

inline void dampen_ewt(double* ewt) {
    ewt[0] *= 1e-7;
    ewt[1] *= 1e-7;
    ewt[2] *= 1e-7;
}