def _get_devices(self): """ Obtain the name of the installed devices. The quality of this information depends on the backend and OS being used, but it should be sufficient for identifying cards. Returns ------- list List of device names for connected GPUs as corresponding to the values in :attr:`_handles` """ self._initialize() if self._device_count == 0: names = list() if self._is_plaidml: names = self._plaid.names elif IS_MACOS: names = [ pynvx.cudaGetName(handle, ignore=True) for handle in self._handles ] else: names = [ pynvml.nvmlDeviceGetName(handle).decode("utf-8") for handle in self._handles ] self._log("debug", "GPU Devices: {}".format(names)) return names
def get_devices(self): """ Return name of devices """ self.initialize() if IS_MACOS: names = [pynvx.cudaGetName(handle, ignore=True) for handle in self.handles] else: names = [pynvml.nvmlDeviceGetName(handle).decode("utf-8") for handle in self.handles] if self.logger: self.logger.debug("GPU Devices: %s", names) return names
def get_devices(self): """ Return name of devices """ self.initialize() if self.device_count == 0: names = list() elif IS_MACOS: names = [pynvx.cudaGetName(handle, ignore=True) for handle in self.handles] else: names = [pynvml.nvmlDeviceGetName(handle).decode("utf-8") for handle in self.handles] if self.logger: self.logger.debug("GPU Devices: %s", names) return names
def _get_device_names(self) -> List[str]: """ Obtain the list of names of connected Nvidia GPUs as identified in :attr:`_handles`. Returns ------- list The list of connected Nvidia GPU names """ names = [ pynvx.cudaGetName(handle, ignore=True) # pylint:disable=no-member for handle in self._handles ] self._log("debug", f"GPU Devices: {names}") return names
def get_devices(self): """ Return name of devices """ self.initialize() if is_macos: names = [ pynvx.cudaGetName(handle, ignore=True) for handle in self.handles ] else: names = [ pynvml.nvmlDeviceGetName(handle).decode("utf-8") for handle in self.handles ] return names
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)))
def test_name(): v = m.cudaGetName(0, ignore=True) assert isinstance(v, string_types)