Mixed-precision algorithms in deal.II

14 views
Skip to first unread message

Maxi Miller

unread,
Aug 26, 2019, 8:09:30 AM8/26/19
to deal.II User Group
I tried to implement a simple mixed-precision algorithm in deal.II, which creates my matrix using float values, and my vectors using double values. Unfortunately, the function distribute_local_to_global(cell_matrix, cell_rhs, local_dof_indices, system_matrix, system_rhs) does not support mixed types. Is there an alternative function, or do I have to create two AffineConstraints-objects, initialize both with different values (double and float) and use them separately?

David Wells

unread,
Aug 26, 2019, 10:13:24 AM8/26/19
to deal.II User Group
Hi Maxi,

The AffineConstraints class does not support using mixed precision and I am not aware of any alternatives that can solve this problem directly.

There may be a better solution, but one way to solve this problem would be to set up two different AffineConstraints objects (one for each floating point type) and then call distribute_local_to_global with a (copied from the single precision) double precision cell matrix and double precision cell RHS and (for single precision) do the opposite. This will update both the global matrix and global RHS correctly.

AffineConstraints objects will do Gaussian elimination with values taken from the single precision cell matrix to determine the correct values for the global RHS, so you will lose some accuracy in the RHS due to truncation. It might be better to either set up both the matrix and RHS in double precision and then copy the matrix over to single precision to avoid this problem, or compute the cell matrix in double precision and copy it to a single precision matrix (instead of the opposite approach given in the previous paragraph).

Does this make sense?

Thanks,
David


On Mon, Aug 26, 2019 at 8:09 AM 'Maxi Miller' via deal.II User Group <dea...@googlegroups.com> wrote:
I tried to implement a simple mixed-precision algorithm in deal.II, which creates my matrix using float values, and my vectors using double values. Unfortunately, the function distribute_local_to_global(cell_matrix, cell_rhs, local_dof_indices, system_matrix, system_rhs) does not support mixed types. Is there an alternative function, or do I have to create two AffineConstraints-objects, initialize both with different values (double and float) and use them separately?

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/39fb6604-f0fc-43a7-b949-7e728e5ac14f%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages