<div dir="ltr">I suspect that the Poisson and Ampere's law solve are not coupled. You might be able to duplicate the communicator and use two threads. You would want to configure PETSc with threadsafty and threads and I think it could/should work, but this mode is never used by anyone.<br><div><br></div><div>That said, I would not recommend doing this unless you feel like playing in computer science, as opposed to doing application science. The best case scenario you get a speedup of 2x. That is a strict upper bound, but you will never come close to it. Your hardware has some balance of CPU to GPU processing rate. Your application has a balance of volume of work for your two solves. They have to be the same to get close to 2x speedup and that ratio(s) has to be 1:1. To be concrete, from what little I can guess about your applications let's assume that the cost of each of these two solves is about the same (eg, Laplacians on your domain and the best case scenario). But, GPU machines are configured to have roughly 1-10% of capacity in the GPUs, these days, that gives you an upper bound of about 10% speedup. That is noise. Upshot, unless you configure your hardware to match this problem, and the two solves have the same cost, you will not see close to 2x speedup. Your time is better spent elsewhere.</div><div><br></div><div>Mark</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Aug 1, 2020 at 3:24 PM Jed Brown <<a href="mailto:jed@jedbrown.org">jed@jedbrown.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">You can use MPI and split the communicator so n-1 ranks create a DMDA for one part of your system and the other rank drives the GPU in the other part. They can all be part of the same coupled system on the full communicator, but PETSc doesn't currently support some ranks having their Vec arrays on GPU and others on host, so you'd be paying host-device transfer costs on each iteration (and that might swamp any performance benefit you would have gotten).<br>
<br>
In any case, be sure to think about the execution time of each part. Load balancing with matching time-to-solution for each part can be really hard.<br>
<br>
<br>
Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank">bsmith@petsc.dev</a>> writes:<br>
<br>
> Nicola,<br>
><br>
> This is really viable or practical at this time with PETSc. It is not impossible but requires careful coding with threads, another possibility is to use one half of the virtual GPUs for each solve, this is also not trivial. I would recommend first seeing what kind of performance you can get on the GPU for each type of solve and revist this idea in the future.<br>
><br>
> Barry<br>
><br>
><br>
><br>
><br>
>> On Jul 31, 2020, at 9:23 AM, nicola varini <<a href="mailto:nicola.varini@gmail.com" target="_blank">nicola.varini@gmail.com</a>> wrote:<br>
>> <br>
>> Hello, I would like to know if it is possible to overlap CPU and GPU with DMDA.<br>
>> I've a machine where each node has 1P100+1Haswell.<br>
>> I've to resolve Poisson and Ampere equation for each time step.<br>
>> I'm using 2D DMDA for each of them. Would be possible to compute poisson <br>
>> and ampere equation at the same time? One on CPU and the other on GPU?<br>
>> <br>
>> Thanks<br>
</blockquote></div>