Skip to content
Draft
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
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ if(ENABLE_PYTHON)
endif()

find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)

message(STATUS "Enabling Nanobind Python bindings")
message(STATUS "Using Python executable: ${Python_EXECUTABLE}")
message(STATUS "Python version: ${Python_VERSION}")
Expand Down Expand Up @@ -163,6 +164,8 @@ foreach(BACKEND ${PL_BACKEND})
endforeach()

target_include_directories(pennylane_lightning INTERFACE "$<INSTALL_INTERFACE:${PROJECT_SOURCE_DIR}/pennylane_lightning/core;include>")
target_link_options(pennylane_lightning INTERFACE "-Wl,--export-all-symbols")
set_target_properties(pennylane_lightning PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)

#####################################################
if(ENABLE_PYTHON)
Expand All @@ -171,6 +174,8 @@ if(ENABLE_PYTHON)
nanobind_add_module("${PL_BACKEND}_ops"
NB_DOMAIN "pennylane_lightning"
"pennylane_lightning/core/bindings/Bindings.cpp")
target_link_options("${PL_BACKEND}_ops" PUBLIC "-Wl,--export-all-symbols")
set_target_properties("${PL_BACKEND}_ops" PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)

# Remove nanobind's problematic flags that are incompatible with NVCC
target_compile_options("${PL_BACKEND}_ops" PRIVATE
Expand Down
1 change: 1 addition & 0 deletions cmake/support_catalyst.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ macro(FindCatalyst target_name)
target_include_directories(${target_name} SYSTEM PUBLIC ${LIGHTNING_CATALYST_SRC_PATH}/runtime/include)

else()
set(CATALYST_GIT_TAG "mlxd/fwd_it_dataview")
if(NOT CATALYST_GIT_TAG)
set(CATALYST_GIT_TAG "main" CACHE STRING "GIT_TAG value to build Catalyst")
endif()
Expand Down
2 changes: 1 addition & 1 deletion pennylane_lightning/core/_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.46.0-dev14"
__version__ = "0.46.0-dev15"
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ set(COMPONENT_SUBDIRS algorithms
)

# Do not build the LQ plugin for Windows
if (NOT WIN32)
if (1)
set(COMPONENT_SUBDIRS ${COMPONENT_SUBDIRS}
catalyst
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ target_link_libraries(lightning_qubit_catalyst PUBLIC lightning_compile_options

set(CMAKE_BUILD_RPATH_USE_ORIGIN ON)
set_target_properties(lightning_qubit_catalyst PROPERTIES BUILD_RPATH "${SCIPY_OPENBLAS32_RUNTIME_LIB_PATH}")
set_target_properties(lightning_qubit_catalyst PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)

if (BUILD_TESTS)
enable_testing()
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,6 @@ exclude_dirs = ["tests"]
skips = [
"B101", # We are okay with using asserts in source code as we do not compile optimized bytecode of pennylane
]
[tool.cibuildwheel.windows]
# Force the linker to find the active pythonXX.lib folder
environment = { LDFLAGS="/LIBPATH:{python}\\libs", CFLAGS="/I{python}\\include" }
25 changes: 19 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,17 @@ def build_extension(self, ext: CMakeExtension):
# As Ninja does not support long path for windows yet:
# (https://github.com/ninja-build/ninja/pull/2056)
configure_args += [
"-T clangcl",
]
elif ninja_path:
configure_args += [
"-GNinja",
f"-DCMAKE_MAKE_PROGRAM={ninja_path}",
#"-T clangcl",
"-DCMAKE_C_COMPILER=clang-cl",
"-DCMAKE_CXX_COMPILER=clang-cl",
"-DCMAKE_BUILD_TYPE=Release",
"-DCMAKE_LINKER=lld-link",
]
#elif ninja_path:
configure_args += [
"-GNinja",
f"-DCMAKE_MAKE_PROGRAM={ninja_path}",
]

configure_args += [f"-DPL_BACKEND={backend}"]
configure_args += self.cmake_defines
Expand Down Expand Up @@ -167,6 +171,15 @@ def build_extension(self, ext: CMakeExtension):
source = os.path.join(f"{extdir}", f"lib{lib_name}_catalyst{shared_lib_ext}")
destination = os.path.join(os.getcwd(), self.build_temp)
shutil.copy(source, destination)
elif platform.system() is "Windows":
shared_lib_ext = ".dll"
lib_name = "lightning_kokkos" if backend == "lightning_amdgpu" else backend
# Windows follows diff build rules with locations
source = os.path.join(os.getcwd(), self.build_temp, f"{lib_name}_catalyst{shared_lib_ext}")
destination = extdir
shutil.copy(source, destination)
else:
raise RuntimeException(f"Unsupported platform {platform.system()} for backend {backend}")

with open(os.path.join("pennylane_lightning", "core", "_version.py"), encoding="utf-8") as f:
version = f.readlines()[-1].split()[-1].strip("\"'")
Expand Down
Loading