def METHOD_NAME(self) -> bool:
    """Returns true iff the accounting mode was set already for all GPUs or is now set."""
    ngpus = self.__ngpus
    for i in range(ngpus):
        # Check if each GPU has accounting mode set.
        h = self.__handle[i]
        if (
            pynvml.nvmlDeviceGetAccountingMode(h)
            != pynvml.NVML_FEATURE_ENABLED
        ):
            # If not, try to set it. As a side effect, we turn persistence mode on
            # so the driver is not unloaded (which undoes the accounting mode setting).
            try:
                pynvml.nvmlDeviceSetPersistenceMode(
                    h, pynvml.NVML_FEATURE_ENABLED
                )
                pynvml.nvmlDeviceSetAccountingMode(
                    h, pynvml.NVML_FEATURE_ENABLED
                )
            except pynvml.NVMLError:
                # We don't have sufficient permissions.
                return False
    return True