Example #1
0
 def get_device_count(self):
     """ Return count of Nvidia devices """
     if is_macos:
         self.device_count = pynvx.cudaDeviceGetCount(ignore=True)
     else:
         try:
             self.device_count = pynvml.nvmlDeviceGetCount()
         except pynvml.NVMLError:
             self.device_count = 0
Example #2
0
 def get_device_count(self):
     """ Return count of Nvidia devices """
     if IS_MACOS:
         self.device_count = pynvx.cudaDeviceGetCount(ignore=True)
     else:
         try:
             self.device_count = pynvml.nvmlDeviceGetCount()
         except pynvml.NVMLError:
             self.device_count = 0
     if self.logger:
         self.logger.debug("GPU Device count: %s", self.device_count)
Example #3
0
 def get_device_count(self):
     """ Return count of Nvidia devices """
     if IS_MACOS:
         self.device_count = pynvx.cudaDeviceGetCount(ignore=True)
     else:
         try:
             self.device_count = pynvml.nvmlDeviceGetCount()
         except pynvml.NVMLError:
             self.device_count = 0
     if self.logger:
         self.logger.debug("GPU Device count: %s", self.device_count)
Example #4
0
    def _get_device_count(self) -> int:
        """ Detect the number of GPUs attached to the system.

        Returns
        -------
        int
            The total number of GPUs connected to the PC
        """
        retval = pynvx.cudaDeviceGetCount(ignore=True)  # pylint:disable=no-member
        self._log("debug", f"GPU Device count: {retval}")
        return retval
Example #5
0
 def _get_device_count(self):
     """ Detect the number of GPUs attached to the system and allocate to
     :attr:`_device_count`. """
     if self._is_plaidml:
         self._device_count = self._plaid.device_count
     elif IS_MACOS:
         self._device_count = pynvx.cudaDeviceGetCount(ignore=True)
     else:
         try:
             self._device_count = pynvml.nvmlDeviceGetCount()
         except pynvml.NVMLError:
             self._device_count = 0
     self._log("debug", "GPU Device count: {}".format(self._device_count))
Example #6
0
def print_info():
    try:
        pynvx.cudaInit()
    except RuntimeError as e:
        print(e)
        return

    print('================ CUDA INFO =====================')
    print('Driver Version  : {}'.format(pynvx.cudaSystemGetDriverVersion()))
    print('Runtime Version : {}'.format(pynvx.cudaSystemGetRuntimeVersion()))
    print('Device Count    : {}'.format(pynvx.cudaDeviceGetCount()))

    handles = pynvx.cudaDeviceGetHandles()
    for handle in handles:
        print('------------------------------------------------')
        print('Device {}:'.format(handle))
        print('Device Name              : {}'.format(
            pynvx.cudaGetName(handle)))
        print('Device ClockRate         : {} MHz'.format(
            pynvx.cudaGetClockRate(handle) / 1024))
        print('Device ComputeCapability : {}'.format(
            pynvx.cudaGetComputeCapability(handle)))
        print('Device ProcessorCount    : {}'.format(
            pynvx.cudaGetMultiProcessorCount(handle)))
        print('Device PciBusID          : {}'.format(
            pynvx.cudaGetPciBusID(handle)))
        print('Device PciDeviceID       : {}'.format(
            pynvx.cudaGetPciDeviceID(handle)))
        print('Device PciDomainID       : {}'.format(
            pynvx.cudaGetPciDomainID(handle)))
        print('Device MemTotal          : {} MiB'.format(
            pynvx.cudaGetMemTotal(handle) / (1024 * 1024)))
        print('Device MemFree           : {} MiB'.format(
            pynvx.cudaGetMemFree(handle) / (1024 * 1024)))
        print('Device MemUsed           : {} MiB'.format(
            pynvx.cudaGetMemUsed(handle) / (1024 * 1024)))
Example #7
0
def test_device_count():
    v = m.cudaDeviceGetCount(ignore=True)
    assert isinstance(v, int)