Override any OpenCL fast math JIT settings for born/coul/wolf{/cs}/gpu to resolve numerical deviations seen with some OpenCL implementations.

This commit is contained in:
Mike Brown
2021-08-28 17:01:58 -07:00
parent 4d1a6cbd73
commit 89556f0bcb
6 changed files with 29 additions and 9 deletions

View File

@ -420,6 +420,16 @@ int DeviceT::set_ocl_params(std::string s_config, std::string extra_args) {
return 0;
}
template <class numtyp, class acctyp>
std::string DeviceT::compile_string_nofast() {
std::string no_fast = _ocl_compile_string;
size_t p = no_fast.find("-cl-fast-relaxed-math ");
if (p != std::string::npos) no_fast.erase(p,22);
p = no_fast.find("-DFAST_MATH=");
if (p != std::string::npos) no_fast[p + 12]='0';
return no_fast;
}
template <class numtyp, class acctyp>
int DeviceT::init(Answer<numtyp,acctyp> &ans, const bool charge,
const bool rot, const int nlocal,