Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logger error when printing GPU properties #143

Closed
PabloAndresCQ opened this issue Jul 29, 2024 · 0 comments
Closed

Logger error when printing GPU properties #143

PabloAndresCQ opened this issue Jul 29, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@PabloAndresCQ
Copy link
Collaborator

PabloAndresCQ commented Jul 29, 2024

The issue is in

def print_device_properties(self, logger: Logger) -> None:

The logger struggles to parse the values of the GPU properties dictionary into a string. It should be possible to fix this by doing the string transformation more explicitly.

The following code reproduces the error:

import cupy as cp
from pytket import Circuit
from pytket.extensions.cutensornet import CuTensorNetHandle
from pytket.extensions.cutensornet.general_state import GeneralState

circ = Circuit(2).H(0).CX(0,1)

with CuTensorNetHandle() as libhandle:
  GeneralState(circ, libhandle, loglevel=10)

--- Logging error ---
Traceback (most recent call last):
File "/global/homes/p/pam_q/.conda/envs/cuquantum-24.03/lib/python3.12/logging/init.py", line 1160, in emit
msg = self.format(record)
^^^^^^^^^^^^^^^^^^^
File "/global/homes/p/pam_q/.conda/envs/cuquantum-24.03/lib/python3.12/logging/init.py", line 999, in format
return fmt.format(record)
^^^^^^^^^^^^^^^^^^
File "/global/homes/p/pam_q/.conda/envs/cuquantum-24.03/lib/python3.12/logging/init.py", line 703, in format
record.message = record.getMessage()
^^^^^^^^^^^^^^^^^^^
File "/global/homes/p/pam_q/.conda/envs/cuquantum-24.03/lib/python3.12/logging/init.py", line 392, in getMessage
msg = msg % self.args
~~~~^~~~~~~~~~~
TypeError: not all arguments converted during string formatting
Call stack:
File "/global/u1/p/pam_q/Repository/prueba.py", line 8, in
GeneralState(circ, libhandle, loglevel=10)
File "/global/homes/p/pam_q/.conda/envs/cuquantum-24.03/lib/python3.12/site-packages/pytket/extensions/cutensornet/general_state/tensor_network_state.py", line 69, in init
libhandle.print_device_properties(self._logger)
File "/global/homes/p/pam_q/.conda/envs/cuquantum-24.03/lib/python3.12/site-packages/pytket/extensions/cutensornet/general.py", line 85, in print_device_properties
logger.debug("GPU-name:", device_props["name"].decode())
Message: 'GPU-name:'
Arguments: ('NVIDIA A100-PCIE-40GB',)

@PabloAndresCQ PabloAndresCQ added the bug Something isn't working label Jul 29, 2024
@PabloAndresCQ PabloAndresCQ self-assigned this Jul 29, 2024
PabloAndresCQ added a commit that referenced this issue Jul 30, 2024
# Description

Fixed the issue below. The issue has a code snippet to reproduce the
error (and see what the fix did).

# Related issues

Solves issue #143 

# Checklist

- [x] I have run the tests on a device with GPUs.
- [x] I have performed a self-review of my code.
- [ ] I have commented hard-to-understand parts of my code.
- [ ] I have made corresponding changes to the public API documentation.
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have updated the changelog with any user-facing changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant