-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add exact tensor network C++ backend to LT (#977)
### Before submitting Please complete the following checklist when submitting a PR: - [ ] All new features must include a unit test. If you've fixed a bug or added code that should be tested, add a test to the [`tests`](../tests) directory! - [ ] All new functions and code must be clearly commented and documented. If you do make documentation changes, make sure that the docs build and render correctly by running `make docs`. - [ ] Ensure that the test suite passes, by running `make test`. - [x] Add a new entry to the `.github/CHANGELOG.md` file, summarizing the change, and including a link back to the PR. - [x] Ensure that code is properly formatted by running `make format`. When all the above are checked, delete everything above the dashed line and fill in the pull request template. ------------------------------------------------------------------------------------------------------------ **Context:** [sc-72879] **Description of the Change:** **Benefits:** **Possible Drawbacks:** **Related GitHub Issues:** --------- Co-authored-by: ringo-but-quantum <[email protected]> Co-authored-by: Luis Alfredo Nuñez Meneses <[email protected]> Co-authored-by: Ali Asadi <[email protected]>
- Loading branch information
1 parent
17bf594
commit 5448c8a
Showing
30 changed files
with
3,516 additions
and
2,726 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,4 @@ | |
Version number (major.minor.patch[-label]) | ||
""" | ||
|
||
__version__ = "0.40.0-dev30" | ||
__version__ = "0.40.0-dev31" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
pennylane_lightning/core/src/simulators/lightning_tensor/tncuda/ExactTNCuda.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2024 Xanadu Quantum Technologies Inc. | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
|
||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "ExactTNCuda.hpp" | ||
|
||
// explicit instantiation | ||
template class Pennylane::LightningTensor::TNCuda::ExactTNCuda<float>; | ||
template class Pennylane::LightningTensor::TNCuda::ExactTNCuda<double>; |
70 changes: 70 additions & 0 deletions
70
pennylane_lightning/core/src/simulators/lightning_tensor/tncuda/ExactTNCuda.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// Copyright 2024 Xanadu Quantum Technologies Inc. | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
|
||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
/** | ||
* @file ExactTNCuda.hpp | ||
* ExactTN class with cuTensorNet backend. Note that current implementation only | ||
* support the open boundary condition. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <vector> | ||
|
||
#include "DevTag.hpp" | ||
#include "TNCuda.hpp" | ||
#include "TNCudaBase.hpp" | ||
#include "TensorCuda.hpp" | ||
#include "Util.hpp" | ||
|
||
/// @cond DEV | ||
namespace { | ||
using namespace Pennylane::LightningGPU; | ||
using namespace Pennylane::LightningTensor::TNCuda; | ||
using namespace Pennylane::LightningTensor::TNCuda::Util; | ||
} // namespace | ||
/// @endcond | ||
|
||
namespace Pennylane::LightningTensor::TNCuda { | ||
|
||
/** | ||
* @brief Managed memory Exact Tensor Network class using cutensornet high-level | ||
* APIs. | ||
* | ||
* @tparam Precision Floating-point precision type. | ||
*/ | ||
|
||
template <class Precision> | ||
class ExactTNCuda final : public TNCuda<Precision, ExactTNCuda<Precision>> { | ||
private: | ||
using BaseType = TNCuda<Precision, ExactTNCuda>; | ||
|
||
public: | ||
constexpr static auto method = "exacttn"; | ||
|
||
using CFP_t = decltype(cuUtil::getCudaType(Precision{})); | ||
using ComplexT = std::complex<Precision>; | ||
using PrecisionT = Precision; | ||
|
||
public: | ||
ExactTNCuda() = delete; | ||
|
||
explicit ExactTNCuda(std::size_t numQubits) : BaseType(numQubits) {} | ||
|
||
explicit ExactTNCuda(std::size_t numQubits, DevTag<int> dev_tag) | ||
: BaseType(numQubits, dev_tag) {} | ||
|
||
~ExactTNCuda() = default; | ||
}; | ||
} // namespace Pennylane::LightningTensor::TNCuda |
Oops, something went wrong.