AMGX icon indicating copy to clipboard operation
AMGX copied to clipboard

How to use the mixed precision in AMGX

Open ztdepztdep opened this issue 2 years ago • 6 comments

Which example provide an tutorial on the usage of the mixed precision solver in AMGX. will it provide a faster speed compared to a fully double precision computation?

ztdepztdep avatar Oct 06 '22 00:10 ztdepztdep

Does anybody know this? I can't find any infors in the userguide.

ztdepztdep avatar Oct 10 '22 13:10 ztdepztdep

Hi @ztdepztdep ,

Mixed precision solver is enabled through different value of API parameter. You can see here: https://github.com/NVIDIA/AMGX/blob/main/examples/amgx_capi.c#L266 how mode value is set and this value is used in all consecutive AMGX calls. For example value that corresponds to matrix data stored in float and vectors data stored in double would be AMGX_mode_dDFI.

marsaev avatar Oct 10 '22 14:10 marsaev

if we store the matrix in float, then at last how to iterative refinement its final solution to double precision which is true meaning of "mixed precision"

| | Professor Ding、 | | @.*** | ---- Replied Message ---- | From | @.> | | Date | 10/10/2022 22:19 | | To | @.> | | Cc | @.> , @.> | | Subject | Re: [NVIDIA/AMGX] How to use the mixed precision in AMGX (Issue #213) |

Hi @ztdepztdep ,

Mixed precision solver is enabled through different value of API parameter. You can see here: https://github.com/NVIDIA/AMGX/blob/main/examples/amgx_capi.c#L266 how mode value is set and this value is used in all consecutive AMGX calls. For example value that corresponds to matrix data stored in float and vectors data stored in double would be AMGX_mode_dDFI.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

ztdepztdep avatar Oct 10 '22 23:10 ztdepztdep

It seems the second D or F specifies the matrix precision. I tried to set dFDI, but AMGX feedback error "no this kind of mode ".

| | Professor Ding、 | | @.*** | ---- Replied Message ---- | From | @.> | | Date | 10/10/2022 22:19 | | To | @.> | | Cc | @.> , @.> | | Subject | Re: [NVIDIA/AMGX] How to use the mixed precision in AMGX (Issue #213) |

Hi @ztdepztdep ,

Mixed precision solver is enabled through different value of API parameter. You can see here: https://github.com/NVIDIA/AMGX/blob/main/examples/amgx_capi.c#L266 how mode value is set and this value is used in all consecutive AMGX calls. For example value that corresponds to matrix data stored in float and vectors data stored in double would be AMGX_mode_dDFI.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

ztdepztdep avatar Oct 11 '22 00:10 ztdepztdep

if we store the matrix in float, then at last how to iterative refinement its final solution to double precision which is true meaning of "mixed precision"

Restriction/prolongation matrices are also stored in lower precision, so coarse matrices are kept in lower precision too. For anything else (i.e. MatVec product) matrix data is promoted to "higher" precision and compute performed in higher precision too.

marsaev avatar Oct 11 '22 13:10 marsaev

It seems the second D or F specifies the matrix precision. I tried to set dFDI, but AMGX feedback error "no this kind of mode ".

It's other way around, as i mentioned in my previous message:

For example value that corresponds to matrix data stored in float and vectors data stored in double would be AMGX_mode_dDFI.

marsaev avatar Oct 11 '22 13:10 marsaev