Skip to content

Commit

Permalink
add unit tests for get_c_interface
Browse files Browse the repository at this point in the history
  • Loading branch information
multiphaseCFD committed Oct 10, 2024
1 parent 190708d commit 7d82d15
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.20)

project(lightning_gpu_catalyst LANGUAGES CXX)

set(LK_CATALYST_FILES LightningGPUSimulator.cpp CACHE INTERNAL "")
add_library(lightning_gpu_catalyst SHARED ${LK_CATALYST_FILES})
set(LGPU_CATALYST_FILES LightningGPUSimulator.cpp CACHE INTERNAL "")
add_library(lightning_gpu_catalyst SHARED ${LGPU_CATALYST_FILES})

include(FetchContent)

Expand Down
15 changes: 15 additions & 0 deletions tests/test_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,21 @@ def test_supported_linux_platform_kokkos():
assert "liblightning_kokkos_catalyst.so" in shared_lib_name


@pytest.mark.skipif(
(device_name != "lightning.gpu" or sys.platform != "linux"),
reason="This test is for LGPU under Linux only.",
)
def test_supported_linux_platform_gpu():
"""Test supported Linux platform for LGPU."""

dev = qml.device(device_name, wires=1)

dev_name, shared_lib_name = dev.get_c_interface()

assert dev_name == "LightningGPUSimulator"
assert "liblightning_gpu_catalyst.so" in shared_lib_name


@pytest.mark.skipif(
(device_name != "lightning.kokkos" or sys.platform != "darwin"),
reason="This test is for Kokkos under MacOS only.",
Expand Down

0 comments on commit 7d82d15

Please sign in to comment.