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

Improve installation supports with external builds #403

Merged
merged 17 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

### Improvements

* Allow better integration and installation support with CMake targeted binary builds.
[(#403)](https://github.com/PennyLaneAI/pennylane-lightning/pull/403)

### Documentation

### Bug fixes
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ jobs:
- name: Run GBenchmark
run: |
./BuildGBench/benchmarks/utils --benchmark_filter="^[a-z]+_innerProd_cmplx<double>/[0-9]+$"
./BuildGBench/benchmarks/apply_operations --benchmark_filter="^applyOperations_RandOps<double>/LM_all/32/[0-9]+$"
./BuildGBench/benchmarks/pennylane_lightning_bench_operations --benchmark_filter="^applyOperations_RandOps<double>/LM_all/32/[0-9]+$"
16 changes: 8 additions & 8 deletions .github/workflows/tests_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
cmake --build ./Build
cd ./Build
mkdir -p ./tests/results
./runner --order lex --reporter junit --out ./tests/results/report_${{ github.job }}.xml
./pennylane_lightning_test_runner --order lex --reporter junit --out ./tests/results/report_${{ github.job }}.xml

- name: Upload test results
uses: actions/upload-artifact@v3
Expand All @@ -60,7 +60,7 @@ jobs:
cmake . -BBuildCov -DCMAKE_BUILD_TYPE=Debug -DENABLE_KOKKOS=OFF -DENABLE_PYTHON=OFF -DBUILD_TESTS=ON -DENABLE_COVERAGE=ON -DCMAKE_CXX_COMPILER="$(which g++-$GCC_VERSION)" -G Ninja
cmake --build ./BuildCov
cd ./BuildCov
./runner
./pennylane_lightning_test_runner
lcov --directory . -b ../pennylane_lightning/src --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
mv coverage.info coverage-${{ github.job }}.info
Expand Down Expand Up @@ -159,7 +159,7 @@ jobs:
cmake --build ./Build
cd ./Build
mkdir -p ./tests/results
./runner --order lex --reporter junit --out ./tests/results/report_${{ github.job }}.xml
./pennylane_lightning_test_runner --order lex --reporter junit --out ./tests/results/report_${{ github.job }}.xml

- name: Upload test results
uses: actions/upload-artifact@v3
Expand All @@ -173,7 +173,7 @@ jobs:
cmake . -BBuildCov -DCMAKE_BUILD_TYPE=Debug -DENABLE_KOKKOS=OFF -DENABLE_PYTHON=OFF -DENABLE_BLAS=ON -DCMAKE_PREFIX_PATH=${{ github.workspace }}/Kokkos -DBUILD_TESTS=ON -DENABLE_COVERAGE=ON -DCMAKE_CXX_COMPILER="$(which g++-$GCC_VERSION)" -G Ninja
cmake --build ./BuildCov
cd ./BuildCov
./runner
./pennylane_lightning_test_runner
lcov --directory . -b ../pennylane_lightning/src --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
mv coverage.info coverage-${{ github.job }}.info
Expand Down Expand Up @@ -298,7 +298,7 @@ jobs:
cmake --build ./Build
cd ./Build
mkdir -p ./tests/results
./runner --order lex --reporter junit --out ./tests/results/report_${{ github.job }}.xml
./pennylane_lightning_test_runner --order lex --reporter junit --out ./tests/results/report_${{ github.job }}.xml

- name: Upload test results
uses: actions/upload-artifact@v3
Expand All @@ -312,7 +312,7 @@ jobs:
cmake . -BBuildCov -DCMAKE_BUILD_TYPE=Debug -DENABLE_KOKKOS=ON -DENABLE_PYTHON=OFF -DCMAKE_PREFIX_PATH=${{ github.workspace }}/Kokkos -DBUILD_TESTS=ON -DENABLE_COVERAGE=ON -DCMAKE_CXX_COMPILER="$(which g++-$GCC_VERSION)" -G Ninja
cmake --build ./BuildCov
cd ./BuildCov
./runner
./pennylane_lightning_test_runner
lcov --directory . -b ../pennylane_lightning/src --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
mv coverage.info coverage-${{ github.job }}.info
Expand Down Expand Up @@ -447,7 +447,7 @@ jobs:
cmake --build ./Build
cd ./Build
mkdir -p ./tests/results
./runner --order lex --reporter junit --out ./tests/results/report_${{ github.job }}.xml
./pennylane_lightning_test_runner --order lex --reporter junit --out ./tests/results/report_${{ github.job }}.xml

- name: Upload test results
uses: actions/upload-artifact@v3
Expand All @@ -461,7 +461,7 @@ jobs:
cmake . -BBuildCov -DCMAKE_BUILD_TYPE=Debug -DENABLE_BLAS=ON -DENABLE_KOKKOS=ON -DENABLE_PYTHON=OFF -DCMAKE_PREFIX_PATH=${{ github.workspace }}/Kokkos -DBUILD_TESTS=ON -DENABLE_COVERAGE=ON -DCMAKE_CXX_COMPILER="$(which g++-$GCC_VERSION)" -G Ninja
cmake --build ./BuildCov
cd ./BuildCov
./runner
./pennylane_lightning_test_runner
lcov --directory . -b ../pennylane_lightning/src --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
mv coverage.info coverage-${{ github.job }}.info
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tests_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ jobs:
cmake ./pennylane_lightning/src -BBuild -DBUILD_TESTS=ON -DENABLE_OPENMP=OFF -DENABLE_WARNINGS=OFF
cmake --build ./Build --config Debug
mkdir -p ./Build/tests/results
.\Build\tests\Debug\runner.exe --order lex --reporter junit --out .\Build\tests\results\report_cpptests.xml
OpenCppCoverage --sources pennylane_lightning\src --export_type cobertura:coverage.xml Build\tests\Debug\runner.exe
.\Build\tests\Debug\pennylane_lightning_test_runner.exe --order lex --reporter junit --out .\Build\tests\results\report_cpptests.xml
OpenCppCoverage --sources pennylane_lightning\src --export_type cobertura:coverage.xml Build\tests\Debug\pennylane_lightning_test_runner.exe
Move-Item -Path .\coverage.xml -Destination .\coverage-${{ github.job }}.xml

- name: Upload test results
Expand Down Expand Up @@ -208,8 +208,8 @@ jobs:
cmake ./pennylane_lightning/src -BBuild -DBUILD_TESTS=ON -DENABLE_KOKKOS=ON -DCMAKE_PREFIX_PATH=D:\a\pennylane-lightning\pennylane-lightning\Kokkos -DENABLE_OPENMP=OFF -DENABLE_WARNINGS=OFF -T clangcl
cmake --build ./Build --config Debug -- /p:UseMultiToolTask=true /p:EnforceProcessCountAcrossBuilds=true /p:MultiProcMaxCount=2
mkdir -p ./Build/tests/results
.\Build\tests\Debug\runner.exe --order lex --reporter junit --out .\Build\tests\results\report_${{ github.job }}.xml
OpenCppCoverage --sources pennylane_lightning\src --export_type cobertura:coverage.xml Build\tests\Debug\runner.exe
.\Build\tests\Debug\pennylane_lightning_test_runner.exe --order lex --reporter junit --out .\Build\tests\results\report_${{ github.job }}.xml
OpenCppCoverage --sources pennylane_lightning\src --export_type cobertura:coverage.xml Build\tests\Debug\pennylane_lightning_test_runner.exe
Move-Item -Path .\coverage.xml -Destination .\coverage-${{ github.job }}.xml

- name: Upload test results
Expand Down
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ target_link_libraries(pennylane_lightning INTERFACE lightning_utils
lightning_algorithms
lightning_gates
)
target_include_directories(pennylane_lightning INTERFACE "pennylane_lightning/src")
target_include_directories(pennylane_lightning INTERFACE "$<INSTALL_INTERFACE:${PROJECT_SOURCE_DIR}/pennylane_lightning/src;include>")

#####################################################
if(ENABLE_PYTHON)
Expand All @@ -108,6 +108,12 @@ install(TARGETS pennylane_lightning
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
INCLUDES DESTINATION include
PUBLIC_HEADER DESTINATION include
)

install(DIRECTORY
mlxd marked this conversation as resolved.
Show resolved Hide resolved
${PROJECT_SOURCE_DIR}/pennylane_lightning/src
DESTINATION include/pennylane_lightning
)

if (BUILD_TESTS)
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,32 +79,32 @@ coverage-cpp:
rm -rf ./BuildCov
cmake pennylane_lightning/src -BBuildCov -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON -DENABLE_COVERAGE=ON
cmake --build ./BuildCov
cd ./BuildCov; ./tests/runner; \
cd ./BuildCov; ./tests/pennylane_lightning_test_runner; \
lcov --directory . -b ../pennylane_lightning/src --capture --output-file coverage.info; \
genhtml coverage.info --output-directory out

test-cpp:
rm -rf ./BuildTests
cmake $(LIGHTNING_CPP_DIR) -BBuildTests -DBUILD_TESTS=ON
cmake --build ./BuildTests --target runner
cmake --build ./BuildTests --target pennylane_lightning_test_runner
cmake --build ./BuildTests --target test

test-cpp-blas:
rm -rf ./BuildTests
cmake $(LIGHTNING_CPP_DIR) -BBuildTests -DBUILD_TESTS=ON -DENABLE_BLAS=ON
cmake --build ./BuildTests --target runner
cmake --build ./BuildTests --target pennylane_lightning_test_runner
cmake --build ./BuildTests --target test

test-cpp-no-omp:
rm -rf ./BuildTests
cmake $(LIGHTNING_CPP_DIR) -BBuildTests -DBUILD_TESTS=ON -DENABLE_OPENMP=OFF
cmake --build ./BuildTests --target runner
cmake --build ./BuildTests --target pennylane_lightning_test_runner
cmake --build ./BuildTests --target test

test-cpp-kokkos:
rm -rf ./BuildTests
cmake $(LIGHTNING_CPP_DIR) -BBuildTests -DBUILD_TESTS=ON -DENABLE_KOKKOS=ON
cmake --build ./BuildTests --target runner
cmake --build ./BuildTests --target pennylane_lightning_test_runner
cmake --build ./BuildTests --target test

.PHONY: gbenchmark
Expand Down
1 change: 0 additions & 1 deletion pennylane_lightning/_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ def _serialize_ops(
op_list = [o]

for single_op in op_list:

name = single_op.name
names.append(name)

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.29.0-dev3"
__version__ = "0.29.0-dev4"
2 changes: 1 addition & 1 deletion pennylane_lightning/src/algorithms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ project(lightning_algorithms LANGUAGES CXX)
set(ALGORITHM_FILES AdjointDiff.cpp JacobianTape.cpp StateVecAdjDiff.cpp CACHE INTERNAL "" FORCE)
add_library(lightning_algorithms STATIC ${ALGORITHM_FILES})

target_link_libraries(lightning_algorithms PRIVATE lightning_compile_options
target_link_libraries(lightning_algorithms PUBLIC lightning_compile_options
lightning_external_libs
lightning_gates
lightning_simulator
Expand Down
Loading