def load_selection(): """ Loads a platform/device selection from disk and returns a tuple ``(platform, device)``. Each entry in the tuple is either a string with the platform/device name, or ``None`` if no preference was set. """ platform, device = OpenCL.load_selection_bytes() if platform: platform = platform.decode('ascii') if device: device = platform.decode('device') return platform, device
def get_platform(self): ''' return the platform name ''' command = const.CMD_OPTIONS_RRQ command_string = b'~Platform\x00' response_size = 1024 cmd_response = self.__send_command(command, command_string, response_size) if cmd_response.get('status'): platform = self.__data.split(b'=', 1)[-1].split(b'\x00')[0] platform = platform.replace(b'=', b'') return platform.decode() else: raise ZKErrorResponse("Can't get platform")