[petsc-users] GPUs and the float-double dilemma

Matthew Knepley knepley at gmail.com
Fri Feb 10 10:50:51 CST 2023


On Fri, Feb 10, 2023 at 11:31 AM Junchao Zhang <junchao.zhang at gmail.com>
wrote:

>
> On Fri, Feb 10, 2023 at 8:16 AM Ces VLC <cesarillovlc at gmail.com> wrote:
>
>> Hi!
>>
>> I searched if it’s supported to link an application to two different
>> builds of PETSc (one configured as float precision, and the other as
>> double). The last post I found on that topic was from 2016 and it said it’s
>> not recommended.
>>
>> The point is that if you wish to prepare builds of your application for
>> end-users, and if your app offers the option of using GPUs, you have a
>> critical problem if you cannot link with two different PETSc builds in the
>> same executable: either you don’t provide support for most GPUs (as they
>> are float only), or you force float precision even when using the CPU. A
>> third option (shipping two executables for the app) is not practical, as
>> the user won’t be able to compare results without quitting the app and
>> running the other version.
>>
> Why do you say most GPUs are float only?  I do not have a survey but the
> NVIDIA, AMD, Intel GPUs I have access to all support double :)
>
>
>>
>> Has the situation changed since 2016, now that GPU support is being added
>> to PETSc?
>>
>> An obvious solution would be if PETSc could be built prepending a prefix
>> to all symbols (functions, structs, types, everything).
>>
> Sounds like a bomb
>
>>
>> Any advances, plans, or thoughts on this?
>>
> Interfacing petsc with libraries (e.g.,Gingko) that support
> mixed-precision could be an approach. But we have not tried that yet.
>

The datatype on device need not match the datatype on the CPU. This is how
I prefer to do things, running float on device and double on the CPU. This
is possible now I think.

   Matt


>
>> Thanks!
>>
>> César
>>
>>

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230210/c9b27e74/attachment-0001.html>


More information about the petsc-users mailing list