diff --git a/docs/changelog.rst b/docs/changelog.rst index 30e97c79..5ac06223 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,6 +1,11 @@ Changelog ~~~~~~~~~ +Unreleased +---------- + +* Fixed a bug causing the logger to fail displaying device properties. + 0.7.0 (July 2024) ----------------- diff --git a/pytket/extensions/cutensornet/general.py b/pytket/extensions/cutensornet/general.py index 0f5d3af7..9b095664 100644 --- a/pytket/extensions/cutensornet/general.py +++ b/pytket/extensions/cutensornet/general.py @@ -81,14 +81,14 @@ def __exit__(self, exc_type: Any, exc_value: Any, exc_tb: Any) -> None: def print_device_properties(self, logger: Logger) -> None: """Prints local GPU properties.""" device_props = cp.cuda.runtime.getDeviceProperties(self.dev.id) - logger.debug("===== device info ======") - logger.debug("GPU-name:", device_props["name"].decode()) - logger.debug("GPU-clock:", device_props["clockRate"]) - logger.debug("GPU-memoryClock:", device_props["memoryClockRate"]) - logger.debug("GPU-nSM:", device_props["multiProcessorCount"]) - logger.debug("GPU-major:", device_props["major"]) - logger.debug("GPU-minor:", device_props["minor"]) - logger.debug("========================") + logger.info("===== device info ======") + logger.info("GPU-name: " + device_props["name"].decode()) + logger.info("GPU-clock: " + str(device_props["clockRate"])) + logger.info("GPU-memoryClock: " + str(device_props["memoryClockRate"])) + logger.info("GPU-nSM: " + str(device_props["multiProcessorCount"])) + logger.info("GPU-major: " + str(device_props["major"])) + logger.info("GPU-minor: " + str(device_props["minor"])) + logger.info("========================") def set_logger( diff --git a/tests/test_utils.py b/tests/test_utils.py index a4aad95f..fa6c68b2 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,4 +1,6 @@ +import pytest import numpy +from pytket.extensions.cutensornet.general import CuTensorNetHandle, set_logger from pytket.extensions.cutensornet.general_state.utils import ( circuit_statevector_postselect, ) @@ -31,3 +33,11 @@ def test_circuit_statevector_postselect() -> None: sv_postselect = circuit_statevector_postselect(circ, post_select_dict) numpy.testing.assert_array_equal(sv_postselect, sv_post_select) + + +def test_device_properties_logger() -> None: + try: + with CuTensorNetHandle() as libhandle: + libhandle.print_device_properties(set_logger("GeneralState", 10)) + except: + pytest.fail("Could not print device properties")