CUDA provides a simple interface to find the information such as determining which CUDA-enabled GPU devices (if any) are present and what capabilities each device supports. First, it is important to get a count of how many CUDA-enabled devices are present on the system, as a system may contain more than one GPU-enabled device. This count can be determined by the CUDA API cudaGetDeviceCount(). The program for getting a number of CUDA enabled devices on the system is shown here:
#include <memory>
#include <iostream>
#include <cuda_runtime.h>
// Main Program
int main(void)
{
int device_Count = 0;
cudaGetDeviceCount(&device_Count);
// This function returns count of number of CUDA enable devices and 0 if there are no CUDA capable devices.
if (device_Count == 0)
{
printf("There are no available device...