Skip to content

Commit

Permalink
Merge branch 'master' into fix_lk_rocm_unused
Browse files Browse the repository at this point in the history
  • Loading branch information
josephleekl committed Dec 5, 2024
2 parents d2d3b36 + 5448c8a commit 34f9ece
Show file tree
Hide file tree
Showing 29 changed files with 3,515 additions and 2,725 deletions.
10 changes: 8 additions & 2 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

### New features since last release

* Add native N-controlled gate/matrix operations and adjoint support to `lightning.kokkos`.
[(#950)](https://github.com/PennyLaneAI/pennylane-lightning/pull/950)
* Add Exact Tensor Network C++ backend to `lightning.tensor`.
[(#977)](https://github.com/PennyLaneAI/pennylane-lightning/pull/977)

* Add native N-controlled generators and adjoint support to `lightning.gpu`'s single-GPU backend.
[(#970)](https://github.com/PennyLaneAI/pennylane-lightning/pull/970)
Expand All @@ -12,6 +12,9 @@
[(#960)](https://github.com/PennyLaneAI/pennylane-lightning/pull/960)
[(#999)](https://github.com/PennyLaneAI/pennylane-lightning/pull/999)

* Add native N-controlled gate/matrix operations and adjoint support to `lightning.kokkos`.
[(#950)](https://github.com/PennyLaneAI/pennylane-lightning/pull/950)

* Add native N-controlled gates support to `lightning.gpu`'s single-GPU backend.
[(#938)](https://github.com/PennyLaneAI/pennylane-lightning/pull/938)

Expand Down Expand Up @@ -55,6 +58,9 @@
* Update Kokkos version support to 4.4.1 and enable Lightning-Kokkos[CUDA] C++ tests on CI.
[(#1000)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1000)

* Add C++ unit tests for Exact Tensor Network backends.
[(#998)](https://github.com/PennyLaneAI/pennylane-lightning/pull/998)

* Add native BLAS support to the C++ layer via dynamic `scipy-openblas32` loading.
[(#995)](https://github.com/PennyLaneAI/pennylane-lightning/pull/995)

Expand Down
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ endif()
foreach(BACKEND ${PL_BACKEND})
message(STATUS "PL_BACKEND: ${BACKEND}")
if("${BACKEND}" STREQUAL "lightning_tensor")
set(PL_TENSOR_METHOD "mps" CACHE STRING "PennyLane LightningTensor MPS simulator.")
set(PL_TENSOR_BACKEND "cutensornet" CACHE STRING "PennyLane LightningTensor backed by cutensornet")
set(PL_TENSOR "${PL_BACKEND}_${PL_TENSOR_METHOD}_${PL_TENSOR_BACKEND}")
set(PL_TENSOR "${PL_BACKEND}_${PL_TENSOR_BACKEND}")
endif()
endforeach()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ include("${pennylane_lightning_SOURCE_DIR}/cmake/support_pltensortncuda.cmake")
findCUDATK(lightning_external_libs)
findCutensornet(lightning_external_libs)

set(LTENSOR_MPS_FILES MPSTNCuda.cpp CACHE INTERNAL "" FORCE)
set(LTENSOR_MPS_FILES MPSTNCuda.cpp ExactTNCuda.cpp MPOTNCuda.cpp CACHE INTERNAL "" FORCE)

add_library(${PL_BACKEND} STATIC ${LTENSOR_MPS_FILES})

Expand Down
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>;
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
Loading

0 comments on commit 34f9ece

Please sign in to comment.