[petsc-users] cudaSetDevice

Jed Brown jedbrown at mcs.anl.gov
Wed Oct 9 06:48:08 CDT 2013


Karl Rupp <rupp at mcs.anl.gov> writes:
> What is a bit tricky is the question of *when* to call cudaSetDevice() 
> then. We require users to call PetscInitialize() before anything else, 
> so cudaSetDevice() needs to be called from some other place. I like the 
> lazy instantiation model, where the GPU backends (OpenCL, CUDA) are 
> initialized only when the first object (e.g. a Vec) is created. 

This should also enable compiling libraries/binaries that support GPUs,
but then running on machines that don't have GPUs or don't have _enough_
for the number of MPI ranks you are using (provided you aren't making
GPU objects).  This is a very desirably property.

When at all possible, defer decisions to run-time when you have more
information about what is needed.

> I think this can be implemented fairly quickly - I'll do it unless
> there are any objections later today.

Thanks!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131009/217cbfb3/attachment.pgp>


More information about the petsc-users mailing list