[petsc-dev] (no subject)
Barry Smith
bsmith at mcs.anl.gov
Sat Oct 1 21:08:53 CDT 2011
Matt,
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?
Barry
#if defined(PETSC_HAVE_CUDA)
cublasInit();
ierr = PetscOptionsHasName(PETSC_NULL,"-cuda_show_devices",&flg);CHKERRQ(ierr);
if (flg) {
struct cudaDeviceProp prop;
int devCount;
int device;
ierr = cudaGetDeviceCount(&devCount);CHKERRQ(ierr);
for(device = 0; device < devCount; ++device) {
ierr = cudaGetDeviceProperties(&prop, device);CHKERRQ(ierr);
ierr = PetscPrintf(PETSC_COMM_WORLD, "CUDA device %d: %s\n", device, prop.name);CHKERRQ(ierr);
}
}
{
int device;
ierr = PetscOptionsGetInt(PETSC_NULL,"-cuda_set_device", &device, &flg);CHKERRQ(ierr);
if (flg) {
ierr = cudaSetDevice(device);CHKERRQ(ierr);
}
}
#endif
More information about the petsc-dev
mailing list