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

Update Kokkos and Kokkos Kernels to 3.7.00 #361

Merged
merged 13 commits into from
Oct 5, 2022
3 changes: 3 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
* Improve tests and checks CI/CD pipelines.
[(#353)](https://github.com/PennyLaneAI/pennylane-lightning/pull/353)

* Upgrade Kokkos and Kokkos Kernels to 3.7.00.
[(#361)](https://github.com/PennyLaneAI/pennylane-lightning/pull/361)

### Documentation

### Bug fixes
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_and_cache_Kokkos_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:

- name: Kokkos version
id: kokkos_version
run: echo "::set-output name=kokkos_version::[\"3.6.00\"]"
run: echo "::set-output name=kokkos_version::[\"3.7.00\"]"

outputs:
exec_model: ${{ steps.exec_model.outputs.exec_model }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/set_wheel_build_matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:

- name: Kokkos version
id: kokkos_version
run: echo "::set-output name=kokkos_version::[\"3.6.00\"]"
run: echo "::set-output name=kokkos_version::[\"3.7.00\"]"

outputs:
python_version: ${{ steps.pyver.outputs.python_version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:

- name: Kokkos version
id: kokkos_version
run: echo "::set-output name=kokkos_version::[\"3.6.00\"]"
run: echo "::set-output name=kokkos_version::[\"3.7.00\"]"

outputs:
exec_model: ${{ steps.exec_model.outputs.exec_model }}
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ test-cpp-kokkos:
gbenchmark:
rm -rf ./BuildGBench
cmake $(LIGHTNING_CPP_DIR) -BBuildGBench -DBUILD_BENCHMARKS=ON -DENABLE_OPENMP=ON -DENABLE_BLAS=ON -DCMAKE_BUILD_TYPE=Release -DBLA_VENDOR=OpenBLAS
cmake --build ./BuildGBench
cmake --build ./BuildGBench

.PHONY: format format-cpp format-python
format: format-cpp format-python
Expand Down
14 changes: 7 additions & 7 deletions cmake/process_options.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
##############################################################################
# This file processes ENABLE_WARNINGS, ENABLE_NATIVE, ENABLE_OPENMP,
# ENABLE_KOKKOS, and ENABLE_BLAS
# This file processes ENABLE_WARNINGS, ENABLE_NATIVE, ENABLE_OPENMP,
# ENABLE_KOKKOS, and ENABLE_BLAS
# options and produces interface libraries
# lightning_compile_options and lightning_external_libs.
##############################################################################
Expand Down Expand Up @@ -151,23 +151,23 @@ if(ENABLE_KOKKOS)

FetchContent_Declare(kokkos
GIT_REPOSITORY https://github.com/kokkos/kokkos.git
GIT_TAG 3.6.00
GIT_TAG 3.7.00
GIT_SUBMODULES "" # Avoid recursively cloning all submodules
)

FetchContent_MakeAvailable(kokkos)

get_target_property(kokkos_INC_DIR kokkos INTERFACE_INCLUDE_DIRECTORIES)
set_target_properties(kokkos PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${kokkos_INC_DIR}")

FetchContent_Declare(kokkoskernels
GIT_REPOSITORY https://github.com/kokkos/kokkos-kernels.git
GIT_TAG 3.6.00
GIT_TAG 3.7.00
GIT_SUBMODULES "" # Avoid recursively cloning all submodules
)

FetchContent_MakeAvailable(kokkoskernels)

get_target_property(kokkoskernels_INC_DIR kokkoskernels INTERFACE_INCLUDE_DIRECTORIES)
set_target_properties(kokkoskernels PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${kokkoskernels_INC_DIR}")

Expand Down
2 changes: 1 addition & 1 deletion pennylane_lightning/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
Version number (major.minor.patch[-label])
"""

__version__ = "0.27.0-dev6"
__version__ = "0.27.0-dev7"
9 changes: 6 additions & 3 deletions pennylane_lightning/src/util/Kokkos_Sparse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,18 @@ void apply_Sparse_Matrix_Kokkos(
const_data_view_type<fp_precision> vector_view(
reinterpret_cast<const Kokkos::complex<fp_precision> *>(vector_ptr),
vector_size);
Kokkos::View<data_type<fp_precision> *> result_view("rhs", vector_size);
std::vector<Kokkos::complex<fp_precision>> result_view_vector(
vector_size);
data_view_type<fp_precision> result_view(result_view_vector.data(),
vector_size);
AmintorDusko marked this conversation as resolved.
Show resolved Hide resolved

const_crs_matrix_type<fp_precision> myMatrix =
const_crs_matrix_type<fp_precision> sparse_matrix =
create_Kokkos_Sparse_Matrix(row_map_ptr, row_map_size - 1,
entries_ptr, values_ptr, numNNZ);

const data_type<fp_precision> alpha(1.0);
const data_type<fp_precision> beta;
KokkosSparse::spmv("N", alpha, myMatrix, vector_view, beta,
KokkosSparse::spmv("N", alpha, sparse_matrix, vector_view, beta,
result_view);

result = std::move(std::vector<std::complex<fp_precision>>(
Expand Down