On Sat, Oct 1, 2011 at 9:08 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Matt,<br>
<br>
I assume you wrote this? Does it make sense ti initialize the cublasInit() before setting the device? Seems like the cublasInit() should go after the other code?<br></blockquote><div><br></div><div>I think you are probably right. I will move it.</div>
<div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Barry<br>
<br>
#if defined(PETSC_HAVE_CUDA)<br>
cublasInit();<br>
<br>
ierr = PetscOptionsHasName(PETSC_NULL,"-cuda_show_devices",&flg);CHKERRQ(ierr);<br>
if (flg) {<br>
struct cudaDeviceProp prop;<br>
int devCount;<br>
int device;<br>
<br>
ierr = cudaGetDeviceCount(&devCount);CHKERRQ(ierr);<br>
for(device = 0; device < devCount; ++device) {<br>
ierr = cudaGetDeviceProperties(&prop, device);CHKERRQ(ierr);<br>
ierr = PetscPrintf(PETSC_COMM_WORLD, "CUDA device %d: %s\n", device, <a href="http://prop.name" target="_blank">prop.name</a>);CHKERRQ(ierr);<br>
}<br>
}<br>
{<br>
int device;<br>
<br>
ierr = PetscOptionsGetInt(PETSC_NULL,"-cuda_set_device", &device, &flg);CHKERRQ(ierr);<br>
if (flg) {<br>
ierr = cudaSetDevice(device);CHKERRQ(ierr);<br>
}<br>
}<br>
#endif<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener<br>