コード例 #1
0
ファイル: gpu_stats.py プロジェクト: stonezuohui/faceswap
 def get_handles(self):
     """ Return all listed Nvidia handles """
     if IS_MACOS:
         self.handles = pynvx.cudaDeviceGetHandles(ignore=True)
     else:
         self.handles = [pynvml.nvmlDeviceGetHandleByIndex(i)
                         for i in range(self.device_count)]
     if self.logger:
         self.logger.debug("GPU Handles found: %s", len(self.handles))
コード例 #2
0
ファイル: gpu_stats.py プロジェクト: wshannak/faceswap
 def get_handles(self):
     """ Return all listed Nvidia handles """
     if IS_MACOS:
         self.handles = pynvx.cudaDeviceGetHandles(ignore=True)
     else:
         self.handles = [pynvml.nvmlDeviceGetHandleByIndex(i)
                         for i in range(self.device_count)]
     if self.logger:
         self.logger.debug("GPU Handles found: %s", len(self.handles))
コード例 #3
0
 def get_handles(self):
     """ Return all listed Nvidia handles """
     if is_macos:
         self.handles = pynvx.cudaDeviceGetHandles(ignore=True)
     else:
         self.handles = [
             pynvml.nvmlDeviceGetHandleByIndex(i)
             for i in range(self.device_count)
         ]
コード例 #4
0
    def _get_handles(self) -> list:
        """ Obtain the device handles for all Apple connected Nvidia GPUs.

        Returns
        -------
        list
            The list of pointers for connected Nvidia GPUs
        """
        handles = pynvx.cudaDeviceGetHandles(ignore=True)  # pylint:disable=no-member
        self._log("debug", f"GPU Handles found: {len(handles)}")
        return handles
コード例 #5
0
 def _get_handles(self):
     """ Obtain the internal handle identifiers for the system GPUs and allocate to
     :attr:`_handles`. """
     if self._is_plaidml:
         self._handles = self._plaid.devices
     elif IS_MACOS:
         self._handles = pynvx.cudaDeviceGetHandles(ignore=True)
     else:
         self._handles = [pynvml.nvmlDeviceGetHandleByIndex(i)
                          for i in range(self._device_count)]
     self._log("debug", "GPU Handles found: {}".format(len(self._handles)))
コード例 #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)))
コード例 #7
0
 def cudaDeviceGetHandleByIndex(id):
     return pynvx.cudaDeviceGetHandles()[id]
コード例 #8
0
def test_device_handles():
    v = m.cudaDeviceGetHandles(ignore=True)
    assert isinstance(v, list)