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

Downstream LightningSimulator C++ API to the pennylane-lightning repository #960

Merged
merged 67 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
bc743f0
Copy Catalyst plugin files for LQ
rauletorresc Oct 24, 2024
7ac9ba0
Auto update version from '0.39.0-dev48' to '0.39.0-dev49'
ringo-but-quantum Oct 24, 2024
73b5b49
Copy LQ shared object to build directory in editable mode
rauletorresc Oct 24, 2024
a5700cd
Merge branch 'master' into raultorres/catalyst_LQ
rauletorresc Oct 25, 2024
bb07e2d
Auto update version from '0.39.0-dev49' to '0.39.0-dev50'
ringo-but-quantum Oct 25, 2024
fd85efe
Update changelog
rauletorresc Oct 28, 2024
fe8ae7f
Auto update version from '0.39.0-dev50' to '0.39.0-dev51'
ringo-but-quantum Oct 28, 2024
1fcdc8f
Remove trailing space
rauletorresc Oct 28, 2024
0186e14
Merge branch 'master' into raultorres/catalyst_LQ
rauletorresc Oct 28, 2024
0224c4f
Fix format
rauletorresc Oct 28, 2024
a697803
Remove tests folder from LQ plugin
rauletorresc Oct 28, 2024
57316f3
Add tests
rauletorresc Oct 29, 2024
b70625b
Auto update version from '0.39.0-dev51' to '0.39.0-dev52'
ringo-but-quantum Oct 29, 2024
2a40629
Merge branch 'master' into raultorres/catalyst_LQ
rauletorresc Oct 29, 2024
afe9050
Add tests
rauletorresc Oct 29, 2024
497f0e3
Ignore LQ tests when using clang-tidy
rauletorresc Oct 29, 2024
8d68b02
Revert workflow changes
rauletorresc Oct 29, 2024
0d59583
Remove `python -m` to avoid running tests with relative modules
rauletorresc Oct 30, 2024
d9e471d
Use the same path for fetched headers for LK and LQ
rauletorresc Oct 30, 2024
b7f898c
Move Catalyst fetching process to a macro
rauletorresc Oct 31, 2024
4587497
Skip coverage for some errors, following LGPU implementation
rauletorresc Oct 31, 2024
ab696eb
Fix format
rauletorresc Oct 31, 2024
9c14f13
[NFC] Remove last year from copyright
rauletorresc Oct 31, 2024
ff8f10a
Update pennylane_lightning/core/src/simulators/lightning_qubit/cataly…
rauletorresc Oct 31, 2024
be86e3e
Apply clang-tidy fixes
rauletorresc Nov 1, 2024
98b5cfa
Fix format
rauletorresc Nov 1, 2024
aba3175
Apply clang-tidy to tests
rauletorresc Nov 1, 2024
8964618
More clang-tidy on tests
rauletorresc Nov 1, 2024
a6da775
Add Driver test and fetch related headers
rauletorresc Nov 3, 2024
a5e4691
Fix LQ driver test according to clang-tidy
rauletorresc Nov 3, 2024
3fb9410
Move entry from improvements to new features at changelog
rauletorresc Nov 3, 2024
ea7e644
Remove unnecessary libs for LG plugin
rauletorresc Nov 3, 2024
e8cbb25
Remove unnecessary define from header
rauletorresc Nov 3, 2024
73e13fd
temporarily cuild against a catalyst PR, to clang-tidy files in catal…
paul0403 Nov 4, 2024
79615d1
Auto update version from '0.39.0-dev52' to '0.39.0-dev53'
ringo-but-quantum Nov 4, 2024
26fcdd0
empty to trigger CI, to see if changes in catalyst CI is picked up
paul0403 Nov 4, 2024
561746e
empty to trigger CI, to see if changes in catalyst CI is picked up
paul0403 Nov 4, 2024
ad26043
Merge remote-tracking branch 'origin/master' into raultorres/catalyst_LQ
paul0403 Nov 4, 2024
070f44b
[no ci] only run clang tidy in CI
paul0403 Nov 4, 2024
e95d0fb
change back tidy.yml
paul0403 Nov 4, 2024
9c35882
CI
paul0403 Nov 5, 2024
a891960
CI
paul0403 Nov 5, 2024
6687149
CI for tidy
paul0403 Nov 5, 2024
5942451
Add tests for State Vector Dynamic
rauletorresc Nov 5, 2024
86f98cc
Fix format
rauletorresc Nov 5, 2024
e7c7a1c
Fix clang-tidy issue with signed int
rauletorresc Nov 5, 2024
85dba18
Fix format
rauletorresc Nov 5, 2024
2e55338
Use uppercase U
rauletorresc Nov 5, 2024
955e778
empty, tidy CI
paul0403 Nov 6, 2024
6304e73
Auto update version from '0.39.0-dev53' to '0.40.0-dev1'
ringo-but-quantum Nov 6, 2024
a8db7ef
Merge branch 'master' into raultorres/catalyst_LQ
rauletorresc Nov 6, 2024
1c70158
revert back to tracking catalyst main
paul0403 Nov 6, 2024
80714a6
Revert workflow changes
rauletorresc Nov 6, 2024
0cecdae
Revert "Revert workflow changes"
rauletorresc Nov 6, 2024
2ab8b25
Merge branch 'master' into raultorres/catalyst_LQ
maliasadi Nov 6, 2024
4d8bbb2
Auto update version from '0.40.0-dev1' to '0.40.0-dev2'
ringo-but-quantum Nov 6, 2024
e62b13e
Merge branch 'master' into raultorres/catalyst_LQ
rauletorresc Nov 6, 2024
a663ae1
Remove Catalyst header
rauletorresc Nov 11, 2024
2bcd395
Auto update version from '0.40.0-dev2' to '0.40.0-dev6'
ringo-but-quantum Nov 11, 2024
4e8096f
Merge branch 'master' into raultorres/catalyst_LQ
rauletorresc Nov 11, 2024
374924f
Do not build the LQ plugin for Windows
rauletorresc Nov 11, 2024
6e5de84
Auto update version from '0.40.0-dev6' to '0.40.0-dev7'
ringo-but-quantum Nov 11, 2024
df0d227
Merge branch 'master' into raultorres/catalyst_LQ
rauletorresc Nov 11, 2024
44f1978
Remove Catalyst folder dependency
rauletorresc Nov 11, 2024
4c87696
Remove unwanted Catalyst dependencies
rauletorresc Nov 12, 2024
68c4c77
Fix clang-tidy issues
rauletorresc Nov 12, 2024
d338851
Update changelog
rauletorresc Nov 12, 2024
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
Prev Previous commit
Next Next commit
Move Catalyst fetching process to a macro
  • Loading branch information
rauletorresc committed Oct 31, 2024
commit b7f898c298326e02a26d014e96e6dabb7d603ec1
74 changes: 74 additions & 0 deletions cmake/support_catalyst.cmake
rauletorresc marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
###############################################################################################
# This file provides macros to process Catalyst.
###############################################################################################

# Include this only once
include_guard()

macro(FindCatalyst target_name)
if(LIGHTNING_CATALYST_SRC_PATH)
if(NOT IS_ABSOLUTE ${LIGHTNING_CATALYST_SRC_PATH})
message(FATAL_ERROR " LIGHTNING_CATALYST_SRC_PATH=${LIGHTNING_CATALYST_SRC_PATH} must be set to an absolute path")
endif()
if(CATALYST_GIT_TAG)
message(WARN " Setting `LIGHTNING_CATALYST_SRC_PATH=${LIGHTNING_CATALYST_SRC_PATH}` overrides `CATALYST_GIT_TAG=${CATALYST_GIT_TAG}`")
endif()

# Acquire local git hash and use for CATALYST_GIT_TAG
execute_process(COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY ${LIGHTNING_CATALYST_SRC_PATH}
OUTPUT_VARIABLE CATALYST_GIT_TAG
)
message(INFO " Building against local Catalyst - path: ${LIGHTNING_CATALYST_SRC_PATH} - GIT TAG: ${CATALYST_GIT_TAG}")

target_include_directories(${target_name} PUBLIC ${LIGHTNING_CATALYST_SRC_PATH}/runtime/lib/backend/common)
target_include_directories(${target_name} PUBLIC ${LIGHTNING_CATALYST_SRC_PATH}/runtime/include)

else()
if(NOT CATALYST_GIT_TAG)
set(CATALYST_GIT_TAG "main" CACHE STRING "GIT_TAG value to build Catalyst")
endif()
message(INFO " Building against Catalyst GIT TAG ${CATALYST_GIT_TAG}")

# Fetching /lib/backend/common hpp headers
set(LIB_BACKEND_COMMON_HEADERS CacheManager.hpp
QubitManager.hpp
Utils.hpp
)

foreach(HEADER ${LIB_BACKEND_COMMON_HEADERS})
string(REGEX REPLACE "\\.[^.]*$" "" HEADER_NAME ${HEADER})
FetchContent_Declare(
${HEADER_NAME}
URL https://raw.githubusercontent.com/PennyLaneAI/catalyst/${CATALYST_GIT_TAG}/runtime/lib/backend/common/${HEADER}
DOWNLOAD_NO_EXTRACT True
SOURCE_DIR ../../include
)

FetchContent_MakeAvailable(${HEADER_NAME})
endforeach()

# Fetching include hpp headers
set(INCLUDE_HEADERS DataView.hpp
Exception.hpp
QuantumDevice.hpp
RuntimeCAPI.h
Types.h
)

foreach(HEADER ${INCLUDE_HEADERS})
string(REGEX REPLACE "\\.[^.]*$" "" HEADER_NAME ${HEADER})
FetchContent_Declare(
${HEADER_NAME}
URL https://raw.githubusercontent.com/PennyLaneAI/catalyst/${CATALYST_GIT_TAG}/runtime/include/${HEADER}
DOWNLOAD_NO_EXTRACT True
SOURCE_DIR ../../include
)

FetchContent_MakeAvailable(${HEADER_NAME})
endforeach()

target_include_directories(${target_name} PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/../../include)

endif()
endmacro()
Original file line number Diff line number Diff line change
Expand Up @@ -7,71 +7,8 @@ add_library(lightning_kokkos_catalyst SHARED ${LK_CATALYST_FILES})

include(FetchContent)

if(LIGHTNING_CATALYST_SRC_PATH)
if(NOT IS_ABSOLUTE ${LIGHTNING_CATALYST_SRC_PATH})
message(FATAL_ERROR " LIGHTNING_CATALYST_SRC_PATH=${LIGHTNING_CATALYST_SRC_PATH} must be set to an absolute path")
endif()
if(CATALYST_GIT_TAG)
message(WARN " Setting `LIGHTNING_CATALYST_SRC_PATH=${LIGHTNING_CATALYST_SRC_PATH}` overrides `CATALYST_GIT_TAG=${CATALYST_GIT_TAG}`")
endif()

# Acquire local git hash and use for CATALYST_GIT_TAG
execute_process(COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY ${LIGHTNING_CATALYST_SRC_PATH}
OUTPUT_VARIABLE CATALYST_GIT_TAG
)
message(INFO " Building against local Catalyst - path: ${LIGHTNING_CATALYST_SRC_PATH} - GIT TAG: ${CATALYST_GIT_TAG}")

target_include_directories(lightning_kokkos_catalyst PUBLIC ${LIGHTNING_CATALYST_SRC_PATH}/runtime/lib/backend/common)
target_include_directories(lightning_kokkos_catalyst PUBLIC ${LIGHTNING_CATALYST_SRC_PATH}/runtime/include)

else()
if(NOT CATALYST_GIT_TAG)
set(CATALYST_GIT_TAG "main" CACHE STRING "GIT_TAG value to build Catalyst")
endif()
message(INFO " Building against Catalyst GIT TAG ${CATALYST_GIT_TAG}")

# Fetching /lib/backend/common hpp headers
set(LIB_BACKEND_COMMON_HEADERS CacheManager.hpp
QubitManager.hpp
Utils.hpp
)

foreach(HEADER ${LIB_BACKEND_COMMON_HEADERS})
string(REGEX REPLACE "\\.[^.]*$" "" HEADER_NAME ${HEADER})
FetchContent_Declare(
${HEADER_NAME}
URL https://raw.githubusercontent.com/PennyLaneAI/catalyst/${CATALYST_GIT_TAG}/runtime/lib/backend/common/${HEADER}
DOWNLOAD_NO_EXTRACT True
SOURCE_DIR ../../include
)

FetchContent_MakeAvailable(${HEADER_NAME})
endforeach()

# Fetching include hpp headers
set(INCLUDE_HEADERS DataView.hpp
Exception.hpp
QuantumDevice.hpp
RuntimeCAPI.h
Types.h
)

foreach(HEADER ${INCLUDE_HEADERS})
string(REGEX REPLACE "\\.[^.]*$" "" HEADER_NAME ${HEADER})
FetchContent_Declare(
${HEADER_NAME}
URL https://raw.githubusercontent.com/PennyLaneAI/catalyst/${CATALYST_GIT_TAG}/runtime/include/${HEADER}
DOWNLOAD_NO_EXTRACT True
SOURCE_DIR ../../include
)

FetchContent_MakeAvailable(${HEADER_NAME})
endforeach()

target_include_directories(lightning_kokkos_catalyst PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/../../include)

endif()
include("${pennylane_lightning_SOURCE_DIR}/cmake/support_catalyst.cmake")
FindCatalyst(lightning_kokkos_catalyst)

target_include_directories(lightning_kokkos_catalyst INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(lightning_kokkos_catalyst PUBLIC lightning_compile_options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,71 +7,8 @@ add_library(lightning_qubit_catalyst SHARED ${LQ_CATALYST_FILES})

include(FetchContent)

if(LIGHTNING_CATALYST_SRC_PATH)
if(NOT IS_ABSOLUTE ${LIGHTNING_CATALYST_SRC_PATH})
message(FATAL_ERROR " LIGHTNING_CATALYST_SRC_PATH=${LIGHTNING_CATALYST_SRC_PATH} must be set to an absolute path")
endif()
if(CATALYST_GIT_TAG)
message(WARN " Setting `LIGHTNING_CATALYST_SRC_PATH=${LIGHTNING_CATALYST_SRC_PATH}` overrides `CATALYST_GIT_TAG=${CATALYST_GIT_TAG}`")
endif()

# Acquire local git hash and use for CATALYST_GIT_TAG
execute_process(COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY ${LIGHTNING_CATALYST_SRC_PATH}
OUTPUT_VARIABLE CATALYST_GIT_TAG
)
message(INFO " Building against local Catalyst - path: ${LIGHTNING_CATALYST_SRC_PATH} - GIT TAG: ${CATALYST_GIT_TAG}")

target_include_directories(lightning_qubit_catalyst PUBLIC ${LIGHTNING_CATALYST_SRC_PATH}/runtime/lib/backend/common)
target_include_directories(lightning_qubit_catalyst PUBLIC ${LIGHTNING_CATALYST_SRC_PATH}/runtime/include)

else()
if(NOT CATALYST_GIT_TAG)
set(CATALYST_GIT_TAG "main" CACHE STRING "GIT_TAG value to build Catalyst")
endif()
message(INFO " Building against Catalyst GIT TAG ${CATALYST_GIT_TAG}")

# Fetching /lib/backend/common hpp headers
set(LIB_BACKEND_COMMON_HEADERS CacheManager.hpp
QubitManager.hpp
Utils.hpp
)

foreach(HEADER ${LIB_BACKEND_COMMON_HEADERS})
string(REGEX REPLACE "\\.[^.]*$" "" HEADER_NAME ${HEADER})
FetchContent_Declare(
${HEADER_NAME}
URL https://raw.githubusercontent.com/PennyLaneAI/catalyst/${CATALYST_GIT_TAG}/runtime/lib/backend/common/${HEADER}
DOWNLOAD_NO_EXTRACT True
SOURCE_DIR ../../include
)

FetchContent_MakeAvailable(${HEADER_NAME})
endforeach()

# Fetching include hpp headers
set(INCLUDE_HEADERS DataView.hpp
Exception.hpp
QuantumDevice.hpp
RuntimeCAPI.h
Types.h
)

foreach(HEADER ${INCLUDE_HEADERS})
string(REGEX REPLACE "\\.[^.]*$" "" HEADER_NAME ${HEADER})
FetchContent_Declare(
${HEADER_NAME}
URL https://raw.githubusercontent.com/PennyLaneAI/catalyst/${CATALYST_GIT_TAG}/runtime/include/${HEADER}
DOWNLOAD_NO_EXTRACT True
SOURCE_DIR ../../include
)

FetchContent_MakeAvailable(${HEADER_NAME})
endforeach()

target_include_directories(lightning_qubit_catalyst PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/../../include)

endif()
include("${pennylane_lightning_SOURCE_DIR}/cmake/support_catalyst.cmake")
FindCatalyst(lightning_qubit_catalyst)

target_include_directories(lightning_qubit_catalyst INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(lightning_qubit_catalyst PUBLIC lightning_compile_options
Expand Down
Loading