qiskit-aer
qiskit-aer copied to clipboard
Should the GPU build be usable without a GPU?
Informations
- Qiskit AER version: 0.15.0
- Operating system: Linux, CentOS 7
What is the current behavior?
When running the tests with stestr run -E 'test_save_statevector_for_qasm3_circuit|_GPU' for a build with NVidia support but on a system without a GPU, I see the following:
=========================
Failures during discovery
=========================
--- import errors ---
Failed to import test module: test.terra.backends.aer_simulator.test_algorithms
Traceback (most recent call last):
File "$PREFIX/lib/python3.10/unittest/loader.py", line 436, in _find_test_path
module = self._get_module_from_name(name)
File "$PREFIX/lib/python3.10/unittest/loader.py", line 377, in _get_module_from_name
__import__(name)
File "$SRC_DIR/test/terra/backends/aer_simulator/test_algorithms.py", line 24, in <module>
class TestAlgorithms(SimulatorTestCase):
File "$SRC_DIR/test/terra/backends/aer_simulator/test_algorithms.py", line 59, in TestAlgorithms
@supported_methods(
File "$SRC_DIR/test/terra/backends/simulator_test_case.py", line 51, in supported_methods
method_args = _method_device(methods)
File "$SRC_DIR/test/terra/backends/simulator_test_case.py", line 83, in _method_device
cuStateVec = check_cuStateVec(available_devices)
File "$SRC_DIR/test/terra/backends/simulator_test_case.py", line 121, in check_cuStateVec
).result()
File "$PREFIX/lib/python3.10/site-packages/qiskit_aer/jobs/utils.py", line 38, in _wrapper
return func(self, *args, **kwargs)
File "$PREFIX/lib/python3.10/site-packages/qiskit_aer/jobs/aerjob.py", line 96, in result
return self._future.result(timeout=timeout)
File "$PREFIX/lib/python3.10/concurrent/futures/_base.py", line 451, in result
return self.__get_result()
File "$PREFIX/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
raise self._exception
File "$PREFIX/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "$PREFIX/lib/python3.10/site-packages/qiskit_aer/backends/aerbackend.py", line 490, in _execute_circuits_job
output = self._execute_circuits(aer_circuits, noise_model, config)
File "$PREFIX/lib/python3.10/site-packages/qiskit_aer/backends/aer_simulator.py", line 928, in _execute_circuits
ret = cpp_execute_circuits(self._controller, aer_circuits, noise_model, config)
File "$PREFIX/lib/python3.10/site-packages/qiskit_aer/backends/backend_utils.py", line 446, in cpp_execute_circuits
return controller.execute(aer_circuits, noise_model, config)
RuntimeError: No CUDA device available!
...
Steps to reproduce the problem
- Build qiskit-aer 0.15.0 with CUDA support.
- Run the tests with
stestr run -E 'test_save_statevector_for_qasm3_circuit|_GPU'on a system without a GPU.
Complete build and tests logs can be seen for now in this log.
What is the expected behavior?
With previous versions of Aer up through 0.14.2, the stestr command excluding the _GPU tests could run successfully and execute many tests. A recent build log example for 0.14.2 is here.
I am not sure what the expected behavior is. Should it be possible to import qiskit_aer and run CPU simulations in this situation of a GPU build on a system without a GPU? If so, then I think there is something to fix in Aer. If not, then I will have to stop running the tests on the CUDA builds of Aer for conda-forge because the build environment does not have access to a GPU.
I commented on the older behavior before here.