-
Notifications
You must be signed in to change notification settings - Fork 360
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
Implement GPU tensor network simulator by using cuTensorNet #1637
Conversation
@@ -78,9 +82,11 @@ def test_conditional_gates_64bit(self, method, device): | |||
@supported_methods(SUPPORTED_METHODS) | |||
def test_conditional_gates_132bit(self, method, device): | |||
"""Test conditional gate operations on 132-bit conditional register.""" | |||
shots = 100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that this line is necessary. shots
can be used without assignment, and then tests fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed test cases
src/simulators/state.hpp
Outdated
@@ -229,6 +229,11 @@ class Base { | |||
//set creg bit counts before initialize creg | |||
virtual void set_num_creg_bits(uint_t num_memory, uint_t num_register){} | |||
|
|||
void has_statevector_ops(bool flg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method name looks odd. State
does not have operations (ops
). Maybe enable_save_statevec
is better (though save_amp
is also enabled).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm, has_statevector_ops_
is just for AER::TensorNetwork::State
. I think It should be a method of the class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved this to state in tensor network and changed name enable_density_matrix
int base_; | ||
int rank_; | ||
std::vector<int64_t> extents_; | ||
int64_t size_; | ||
std::vector<std::complex<data_t>> tensor_; | ||
std::vector<int32_t> modes_; | ||
reg_t qubits_; | ||
bool sp_tensor_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you leave some comments on each member? Maybe tensor_
is data of multi-dimensional array defined rank_
and modes_
.
Also, why int64_t
and int32_t
are used here? Can they be replaced with uint64_t
and uint32_t
? Or can they be negative?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment added
Integer types defined in here is supported types in cuTensorNet, the same type is used to avoid data conversion.
This is a new feature. A release note is necessary. I think the note should include some simple samples to use I'm wondering what will be happen if |
I added exception when |
cmake/conan_utils.cmake
Outdated
@@ -10,7 +10,7 @@ macro(setup_conan) | |||
# Right now every dependency shall be static | |||
set(CONAN_OPTIONS ${CONAN_OPTIONS} "*:shared=False") | |||
|
|||
set(REQUIREMENTS nlohmann_json/3.1.1 spdlog/1.9.2) | |||
set(REQUIREMENTS nlohmann_json/3.1.1 spdlog/1.5.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason of this downgrade?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an inconsistency of version to https://github.com/doichanj/qiskit-aer/blob/24df5135cc06d9f9dd839d985b46bd91b2511232/cmake/dependency_utils.cmake#L27 and this causes build error on Power systems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now this looks fine. I would like to show some tutorial to show good examples for this new method.
Summary
This is implementation of a new simulation method
tensor_network
fordevice=GPU
accelerated by cuQuantum SDK.tensor_network
method is tensor network contraction based simulator for general quantum circuits.Details and comments
tensor_network
method may used for quantum circuit simulation with large number of qubits, but has fewer circuit depth.This simulation method simulates quantum circuits by contracting tensor network built from connections of gates of input circuit. Tensor network contraction can be parallelize by using slicing technique optimized in cuTensorNet SDK.
This is performance results of
tensor_network
method compared tostatevector
using QAOA circuit + save expectation value (using random connected graph, connection ratio = 0.1) accelerated by single NDIVIA Tesla V100 (32GB)This PR requires shot branching implementation PR #1596
Currently there is no implementation for
device=CPU
tensor_network
method uses density matrix in tensor network to get norm of statevector.So it also supports operations for
density_matrix
(can simulate noise sampling in single shot)Because using density matrix inside, number of qubits for output of contraction is limited to memory size similar to density matrix.
(So we can not get large statevector/reduced density matrix output)
To simulate quantum circuits with large number of qubits, expectation values, measure or sampling can be used. (Maybe sampling is very slow for random results)
This simulator supports parallelization by multiple-GPUs or multiple nodes on cluster (MPI), tensor network contraction is parallelized.