Intel® oneAPI Data Parallel C++
Support for Intel® oneAPI DPC++ Compiler, Intel® oneAPI DPC++ Library, Intel ICX Compiler , Intel® DPC++ Compatibility Tool, and GDB*
584 Discussions

Is there anyway to restrict the precision of float-point precision to a higher level with dpcpp?

nahso
Novice
866 Views

Hello,

I am using dpcpp to compute the sparse matrix-matrix multiplication(spmm) in sequential minimal optimization(SMO), but the result is not precise enough. I specified -fp-model=double, -fp=model=restrict, -fimf-precision=high, -fimf-max-error=0.1, -fimf-accuracy-bits=52 one by one, and used sycl::gpu_selector and sycl::cpu_selector, but the final result of SMO was not right.

 

Here is the spmm code with dpcpp:

q.submit([&](sycl::handler& h) {
h.parallel_for(sycl::nd_range<2>(global_range, local_range), [=](sycl::nd_item<2> it)
{
auto i = it.get_global_id(0);
auto jj = it.get_global_id(1);
float sum = 0;
for (size_t j = row_ptr_usm[i]; j < row_ptr_usm[i + 1]; ++j) {
sum += val_usm[j] * dense_trans[col_ptr_usm[j] * n + jj];
}
res[i * n + jj] = sum;
});
}).wait();

0 Kudos
1 Solution
nahso
Novice
714 Views

Hi,

I'm sorry for no reply, we reported this issue to the competition team, and they modified the precision requirement just before. So current precision is OK. Thank you!

View solution in original post

0 Kudos
6 Replies
NoorjahanSk_Intel
Moderator
837 Views

Hi,

 

Thanks for reaching out to us.

 

Could you please try with below compiler option which enables precision?

"-fp-model = precise"

If we use this option  (-fp-model=precise) , it implies -fimf-precision=high.

 

Please refer to below link for more details:

https://www.intel.com/content/www/us/en/develop/documentation/oneapi-dpcpp-cpp-compiler-dev-guide-and-reference/top/compiler-reference/compiler-options/floating-point-options/fp-model-fp.html

 

 

If this doesn't resolve your issue then please provide us with below details

  • Complete reproducer code and steps to reproduce the issue.
  • Expected and observed results. 
  • Hardware details(device you are using to run your code) and compiler version being used.

 

 

Thanks & Regards,

Noorjahan

 

0 Kudos
nahso
Novice
814 Views

No, I tried -fp-model = precise with O0, O2, O3, Ofast, but none of these flags make the final result precious enough.

0 Kudos
NoorjahanSk_Intel
Moderator
798 Views

Hi,


Thanks for the update.


Could you please provide us with the following details so that we can try it from our end?

  • Complete reproducer code and steps to reproduce the issue.
  • Expected and observed results. 
  • Hardware details(the device you are using to run your code) and compiler version being used.


Thanks & Regards,

Noorjahan.


0 Kudos
NoorjahanSk_Intel
Moderator
722 Views

Hi,


We haven't heard back from you. Could you please provide an update on your issue?


Thanks & Regards,

Noorjahan.


0 Kudos
nahso
Novice
715 Views

Hi,

I'm sorry for no reply, we reported this issue to the competition team, and they modified the precision requirement just before. So current precision is OK. Thank you!

0 Kudos
NoorjahanSk_Intel
Moderator
707 Views

Hi,


Glad to know that your issue is resolved. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.


Thanks & Regards,

Noorjahan.


0 Kudos
Reply