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

Question: how to use TorchConnector and specify gpu devices #892

Open
zuxfoucault opened this issue Feb 3, 2025 · 1 comment
Open

Question: how to use TorchConnector and specify gpu devices #892

zuxfoucault opened this issue Feb 3, 2025 · 1 comment
Labels
type: question 🙋 Question about the code or its uses

Comments

@zuxfoucault
Copy link

In this qgan example (https://qiskit-community.github.io/qiskit-machine-learning/tutorials/04_torch_qgan.html)
how do I specify gpu in TorchConnector?
or just simply with

device = 'GPU' if 'GPU' in AerSimulator().available_devices() else 'CPU'
sim = AerSimulator(method='statevector', device=device)
sampler = AerSampler(
      options={'backend_options':{'method': sim.options.method, 
                                    'device' : sim.options.device, 
                                    'cuStateVec_enable' : True}}
    )
@edoaltamura edoaltamura added the type: question 🙋 Question about the code or its uses label Feb 3, 2025
@edoaltamura
Copy link
Collaborator

Indeed, that's the way to do it if you want to simulate the training part of the algorithm. @OkuyanBoga @oscar-wallis do you have tips for selecting the device from TorchConnector as an alternative?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question 🙋 Question about the code or its uses
Projects
None yet
Development

No branches or pull requests

2 participants