diff --git a/examples/queryGpu.f90 b/examples/queryGpu.f90 new file mode 100644 index 0000000..e14c4b3 --- /dev/null +++ b/examples/queryGpu.f90 @@ -0,0 +1,29 @@ +program queryGpu + use cudafor + + implicit none + + real, parameter :: GBUnit = 1024 * 1024 * 1024.0 + real, parameter :: GHzUnit = 1e6 + integer :: istat, devId + type(cudadeviceprop) :: properties + + ! Select a device to query + devId = 0 + ! Query the properties of device devId + istat = cudaGetDeviceProperties(properties, devId) + + write(*,'(A,I0,2A)') "Device ", devId, ": ", properties%name + write(*,'(A,T39,A,I0,A,I0)') "Compute capability", ": ", properties%major, ".", properties%minor + write(*,'(A,T39,A,F5.2,A)') "Total amount of global memory", ": ", properties%totalGlobalMem / GBUnit, " GB" + write(*,'(A,T39,A,F4.2,A)') "GPU clock rate", ": ", properties%clockRate / GHzUnit, " GHz" + write(*,'(A,T39,A,F4.2,A)') "Memory clock rate", ": ", properties%memoryClockRate / GHzUnit, " GHz" + write(*,'(A,T39,A,I0)') "Number of SMs", ": ", properties%multiProcessorCount + write(*,'(A,T39,A,I0)') "Warp size", ": ", properties%warpSize + write(*,'(A,T39,A,I0)') "Maximum number of threads per SM", ": ", properties%maxThreadsPerMultiprocessor + write(*,'(A,T39,A,I0)') "Maximum number of threads per block", ": ", properties%maxThreadsPerBlock + write(*,'(A,T39,A,I0,A,I0,A,I0)') "Maximum sizes of each block dimension", ": ", properties%maxThreadsDim(1), & + " x ", properties%maxThreadsDim(2), " x ", properties%maxThreadsDim(3) + write(*,'(A,T39,A,I0,A,I0,A,I0)') "Maximum sizes of each grid dimension", ": ", properties%maxGridSize(1), & + " x ", properties%maxGridSize(2), " x ", properties%maxGridSize(3) +end program queryGpu