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

Log messages emitted on imports #1736

Closed
SquidDev opened this issue Mar 6, 2023 · 1 comment · Fixed by #1760
Closed

Log messages emitted on imports #1736

SquidDev opened this issue Mar 6, 2023 · 1 comment · Fixed by #1760
Labels
bug Something isn't working

Comments

@SquidDev
Copy link
Contributor

SquidDev commented Mar 6, 2023

Informations

  • Qiskit Aer version:
  • Python version: Python 3.8.10
  • Operating system: Linux (Ubuntu 22.04.1 LTS)

What is the current behavior?

Importing any qiskit.aer module will log several messages of the form:

INFO:qiskit.compiler.assembler:Total Assembly Time - 0.13256 (ms)

Steps to reproduce the problem

Run the following Python program:

import logging
logging.basicConfig(level="DEBUG")
import qiskit.providers.aer

What is the expected behavior?

Importing a module ideally would not log any messages.

Suggested solutions

The easiest option here would be to change the backend detection code to run when the list of backends is requested, rather when in the constructor - happy to put a PR together for that.

There was an alternative solution proposed in Qiskit/qiskit#7498 (comment) which suggested (if I understand correctly) removing the assembling of circuits in available_methods/available_devices and replacing it with some metadata on the binary.

@SquidDev SquidDev added the bug Something isn't working label Mar 6, 2023
@hhorii
Copy link
Collaborator

hhorii commented Mar 7, 2023

Instead of calling cpp_execute_qobj, calling cpp_execute_circuits will resolve this issue once #1717 is merged.

available_methods is constant for a binary. However, available_devices depends on environment: ["CPU"] or ["CPU", "GPU", "Thrust"]. But just for checking availability of GPU, calling CPU and GPU may be not-small overheads.

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

Successfully merging a pull request may close this issue.

2 participants