Skip to content

Commit 0dd6746

Browse files
authored
Merge branch 'main' into fix/macos-ci-timeout
2 parents 4e958af + edfd98b commit 0dd6746

File tree

70 files changed

+2658
-714
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+2658
-714
lines changed

.github/pre-commit/spelling_allowlist.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ Superpositions
131131
Superstaq
132132
TBI
133133
TCP
134+
TII
134135
TableGen
135136
Toffoli
136137
Toshiko
@@ -367,7 +368,9 @@ toolchain
367368
toolchains
368369
toolset
369370
transmon
371+
transpilation
370372
transpile
373+
trixie
371374
trotterization
372375
uccsd
373376
unary
@@ -381,6 +384,7 @@ unmarshal
381384
unmarshalling
382385
unoptimized
383386
upvote
387+
url
384388
variadic
385389
variational
386390
vazirani

.github/workflows/build_package_sources.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,38 @@ jobs:
322322
fi
323323
ls -la "$d"/*trimmed* 2>/dev/null || true
324324
325+
- name: Generate pip attribution (NOTICE_PIP per variant + CUDA version)
326+
run: |
327+
cuda_major=$(echo "${{ matrix.cuda }}" | cut -d. -f1)
328+
suffix="_cu${cuda_major}"
329+
python3 scripts/generate_pip_attribution.py \
330+
package-source-diff/pip_packages_cudaq.txt \
331+
-o "NOTICE_PIP_cudaq${suffix}"
332+
333+
python3 scripts/generate_pip_attribution.py \
334+
package-source-diff/pip_packages_cudaqx.txt \
335+
-o "NOTICE_PIP_cudaqx${suffix}"
336+
337+
python3 scripts/generate_pip_attribution.py \
338+
package-source-diff/pip_packages_macos.txt \
339+
-o "NOTICE_PIP_macos${suffix}"
340+
ls -la NOTICE_PIP_*
341+
head -50 "NOTICE_PIP_cudaq${suffix}"
342+
343+
- name: Generate apt attribution (NOTICE_APT per variant + CUDA version)
344+
run: |
345+
cuda_major=$(echo "${{ matrix.cuda }}" | cut -d. -f1)
346+
suffix="_cu${cuda_major}"
347+
python3 scripts/generate_apt_attribution.py \
348+
package-source-diff/apt_packages_cudaq.txt \
349+
-o "NOTICE_APT_cudaq${suffix}"
350+
351+
python3 scripts/generate_apt_attribution.py \
352+
package-source-diff/apt_packages_cudaqx.txt \
353+
-o "NOTICE_APT_cudaqx${suffix}"
354+
ls -la NOTICE_APT_*
355+
head -50 "NOTICE_APT_cudaq${suffix}"
356+
325357
- name: Generate tpls lock file
326358
run: |
327359
chmod +x scripts/generate_tpls_lock.sh

.github/workflows/integration_tests.yml

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ on:
2727
- qci
2828
- quantinuum
2929
- scaleway
30+
- tii
3031
single_test_name:
3132
type: string
3233
required: false
@@ -190,7 +191,7 @@ jobs:
190191
run: |
191192
# Determine which providers to test based on inputs and event type
192193
if [[ "${{ github.event_name }}" == "schedule" || "${{ inputs.target }}" == "nightly" ]]; then
193-
providers='["anyon", "fermioniq", "infleqtion", "ionq", "iqm", "oqc", "orca", "pasqal", "qci", "quantinuum", "scaleway"]'
194+
providers='["anyon", "fermioniq", "infleqtion", "ionq", "iqm", "oqc", "orca", "pasqal", "qci", "quantinuum", "scaleway", "tii"]'
194195
else
195196
# Just run the specified target provider
196197
providers="[\"${{ inputs.target }}\"]"
@@ -270,6 +271,9 @@ jobs:
270271
scaleway)
271272
filelist="targettests/scaleway/*.cpp docs/sphinx/targets/python/scaleway.py"
272273
;;
274+
tii)
275+
filelist="docs/sphinx/targets/cpp/tii.cpp docs/sphinx/targets/python/tii.py"
276+
;;
273277
esac
274278
echo "testlist=$filelist" >> $GITHUB_OUTPUT
275279
fi
@@ -417,6 +421,13 @@ jobs:
417421
echo "SCW_PROJECT_ID=${{ secrets.SCW_PROJECT_ID }}" >> $GITHUB_ENV
418422
echo "SCW_SECRET_KEY=${{ secrets.SCW_SECRET_KEY }}" >> $GITHUB_ENV
419423
;;
424+
tii)
425+
echo "### Setting up TII account" >> $GITHUB_STEP_SUMMARY
426+
echo "::add-mask::${{ secrets.TII_AUTH_TOKEN }}"
427+
echo "::add-mask::${{ secrets.TII_PROJECT }}"
428+
echo "TII_AUTH_TOKEN=${{ secrets.TII_AUTH_TOKEN }}" >> $GITHUB_ENV
429+
echo "TII_PROJECT=${{ secrets.TII_PROJECT }}" >> $GITHUB_ENV
430+
;;
420431
esac
421432
shell: bash
422433

@@ -704,7 +715,7 @@ jobs:
704715
705716
scaleway)
706717
if [[ "$filename" == *.cpp ]]; then
707-
nvq++ -v $filename --target scaleway --scaleway-machine EMU-CUDAQ-64C-512M
718+
nvq++ -v $filename --target scaleway --scaleway-machine EMU-CUDAQ-64C-512M --scaleway-deduplication-id ghci-workflow-testing
708719
test_status=$?
709720
if [ $test_status -eq 0 ]; then
710721
./a.out
@@ -734,6 +745,38 @@ jobs:
734745
test_skip_sum=$((test_skip_sum+1))
735746
fi
736747
;;
748+
749+
tii)
750+
if [[ "$filename" == *.cpp ]]; then
751+
nvq++ -v $filename --target tii --tii-device tii-sim --tii-project ${{ secrets.TII_PROJECT }}
752+
test_status=$?
753+
if [ $test_status -eq 0 ]; then
754+
./a.out
755+
test_status=$?
756+
if [ $test_status -eq 0 ]; then
757+
echo ":white_check_mark: Successfully ran test: $filename" >> $GITHUB_STEP_SUMMARY
758+
else
759+
echo ":x: Test failed (failed to execute): $filename" >> $GITHUB_STEP_SUMMARY
760+
test_err_sum=$((test_err_sum+1))
761+
fi
762+
else
763+
echo ":x: Test failed (failed to compile): $filename" >> $GITHUB_STEP_SUMMARY
764+
test_err_sum=$((test_err_sum+1))
765+
fi
766+
elif [[ "$filename" == *.py ]]; then
767+
python3 $filename 1> /dev/null
768+
test_status=$?
769+
if [ $test_status -eq 0 ]; then
770+
echo ":white_check_mark: Successfully ran test: $filename" >> $GITHUB_STEP_SUMMARY
771+
else
772+
echo ":x: Test failed (failed to execute): $filename" >> $GITHUB_STEP_SUMMARY
773+
test_err_sum=$((test_err_sum+1))
774+
fi
775+
else
776+
echo "::warning::Unsupported file type: $filename"
777+
echo ":warning: Test skipped (unsupported file type): $filename" >> $GITHUB_STEP_SUMMARY
778+
test_skip_sum=$((test_skip_sum+1))
779+
;;
737780
esac
738781
done
739782

CMakeLists.txt

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ get_filename_component(REAL_PROJECT_BINARY_DIR "${PROJECT_BINARY_DIR}" REALPATH)
6060

6161
if("${REAL_PROJECT_SOURCE_DIR}" STREQUAL "${REAL_PROJECT_BINARY_DIR}")
6262
message(FATAL_ERROR
63-
"In-source builds are not permitted. You must run cmake in a separeted "
63+
"In-source builds are not permitted. You must run cmake in a separated "
6464
"directory, e.g.:\n"
6565
" mkdir build && cd build && cmake ..\n"
66-
"NOTE: Remeber to clean up the source tree by deleting the files already "
66+
"NOTE: Remember to clean up the source tree by deleting the files already "
6767
"created by CMake, e.g, CMakeCache.txt and cmake.check_cache")
6868
endif()
6969

@@ -73,7 +73,7 @@ set(CMAKE_CXX_STANDARD 20)
7373
set(CMAKE_CXX_STANDARD_REQUIRED ON)
7474
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
7575

76-
# Set warnings as errors by default.
76+
# Set warnings as errors by default.
7777
# Individual targets and the command line invocation can override this behavior.
7878
if(NOT DEFINED CMAKE_COMPILE_WARNING_AS_ERROR)
7979
set(CMAKE_COMPILE_WARNING_AS_ERROR ON)
@@ -95,7 +95,7 @@ endif()
9595

9696
# Enable Amazon Braket backends by default.
9797
if (NOT DEFINED CUDAQ_ENABLE_BRAKET_BACKEND)
98-
set(CUDAQ_ENABLE_BRAKET_BACKEND ON CACHE BOOL "Enable building AWS SDK for Amazon Braket backends.")
98+
set(CUDAQ_ENABLE_BRAKET_BACKEND ON CACHE BOOL "Enable building AWS SDK for Amazon Bracket backends.")
9999
endif()
100100

101101
# Enable Pasqal target by default.
@@ -108,6 +108,11 @@ if (NOT DEFINED CUDAQ_ENABLE_QCI_BACKEND)
108108
set(CUDAQ_ENABLE_QCI_BACKEND ON CACHE BOOL "Enable building the Quantum Circuits, Inc. target.")
109109
endif()
110110

111+
# Enable TII target by default.
112+
if (NOT DEFINED CUDAQ_ENABLE_TII_BACKEND)
113+
set(CUDAQ_ENABLE_TII_BACKEND ON CACHE BOOL "Enable building the TII target.")
114+
endif()
115+
111116
# Enable Quantum Machines target by default.
112117
if (NOT DEFINED CUDAQ_ENABLE_QUANTUM_MACHINES_BACKEND)
113118
set(CUDAQ_ENABLE_QUANTUM_MACHINES_BACKEND ON CACHE BOOL "Enable building the Quantum Machines target.")
@@ -173,7 +178,7 @@ if(NOT LLVM_DIR AND EXISTS "$ENV{LLVM_INSTALL_PREFIX}/lib/cmake/llvm")
173178
endif()
174179
if(NOT BLAS_LIBRARIES AND EXISTS "$ENV{BLAS_INSTALL_PREFIX}/libblas.a")
175180
# CACHE INTERNAL is needed due to how FindBLAS.cmake works...
176-
SET(BLAS_LIBRARIES "$ENV{BLAS_INSTALL_PREFIX}/libblas.a" CACHE INTERNAL "")
181+
SET(BLAS_LIBRARIES "$ENV{BLAS_INSTALL_PREFIX}/libblas.a" CACHE INTERNAL "")
177182
endif()
178183
if(NOT CUSTATEVEC_ROOT)
179184
SET(CUSTATEVEC_ROOT "$ENV{CUQUANTUM_INSTALL_PREFIX}" CACHE PATH "Path to cuStateVec installation")
@@ -190,7 +195,7 @@ endif()
190195
if(NOT ZLIB_ROOT)
191196
SET(ZLIB_ROOT "$ENV{ZLIB_INSTALL_PREFIX}" CACHE PATH "Path to zlib installation")
192197
endif()
193-
if(NOT OPENSSL_ROOT_DIR)
198+
if(NOT OPENSSL_ROOT_DIR)
194199
SET(OPENSSL_ROOT_DIR "$ENV{OPENSSL_INSTALL_PREFIX}" CACHE PATH "Path to OpenSSL installation")
195200
endif()
196201
if (NOT crypto_LIBRARY AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND EXISTS "$ENV{OPENSSL_INSTALL_PREFIX}/lib64/libcrypto.a")
@@ -249,9 +254,9 @@ else()
249254
# flat_namespace makes all symbols global, allowing shared libraries to see
250255
# each other's registrations. This is not a very graceful fix.
251256
# Alternatives might be:
252-
# A. Restructuring libraries to avoid multiple symbol definitions
257+
# A. Restructuring libraries to avoid multiple symbol definitions
253258
# (but this still might struggle due to how plugin systems are used).
254-
# B. Using LLVM/MLIR dylibs. This won't work until later versions of LLVM are used as
259+
# B. Using LLVM/MLIR dylibs. This won't work until later versions of LLVM are used as
255260
# the first versions of this setting did not appropriately link all libraries to the dylibs.
256261
add_link_options("-Wl,-flat_namespace")
257262
endif()
@@ -275,7 +280,7 @@ if (CUDAQ_ENABLE_STATIC_LINKING)
275280
# then using -static (for exe) and -staic-pie (for linker).
276281
# At the time of writing, there wasn't any benefit to using those over -static.
277282
# When we only link libstdc++ and libgcc statically, we still have a dependency
278-
# on GLIBC on the target system, but linking it statically is likely to cause issues.
283+
# on GLIBC on the target system, but linking it statically is likely to cause issues.
279284
# A better option might be to include the required GNU C Library and have the nvq++
280285
# compiler dynamically pick the newer one of the included or system one.
281286
# See also these posts:
@@ -284,10 +289,10 @@ if (CUDAQ_ENABLE_STATIC_LINKING)
284289
# If the final application loads multiple dynamic libraries, and two or more
285290
# of those dynamic libraries are linked to different versions of the same static
286291
# libraries, then the different copies of those static libraries will conflict with
287-
# each other. If we were to link everything statically, it is probably advisable to
288-
# set CMAKE_<LANG>_VISIBILITY_PRESET to hidden and CMAKE_VISIBILITY_INLINES_HIDDEN
292+
# each other. If we were to link everything statically, it is probably advisable to
293+
# set CMAKE_<LANG>_VISIBILITY_PRESET to hidden and CMAKE_VISIBILITY_INLINES_HIDDEN
289294
# to 1, to avoid some of these issues.
290-
# We don't set these configurations here, since the LLVM runtime libraries that we
295+
# We don't set these configurations here, since the LLVM runtime libraries that we
291296
# build from source are already configured to hide symbols and include dependencies.
292297
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc")
293298
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libstdc++ -static-libgcc")
@@ -299,7 +304,7 @@ else()
299304
message(STATUS "CUDA Quantum static linking disabled.")
300305
endif()
301306

302-
# ZLIB is required when we build LLVM with zlib support.
307+
# ZLIB is required when we build LLVM with zlib support.
303308
# ZLIB support in LLVM is good to have e.g. for the linker,
304309
# since some binaries will use zlib compression to store symbols.
305310
find_package(ZLIB REQUIRED)
@@ -394,7 +399,7 @@ if(NOT Clang_DIR)
394399
endif()
395400

396401
find_package(Clang CONFIG)
397-
if (NOT Clang_FOUND)
402+
if (NOT Clang_FOUND)
398403
message(STATUS "Clang not found, turning off C++ Frontend.")
399404
set (CUDAQ_DISABLE_CPP_FRONTEND ON)
400405
endif()
@@ -508,7 +513,7 @@ execute_process(COMMAND git rev-parse --verify HEAD
508513
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
509514
OUTPUT_VARIABLE CUDA_QUANTUM_COMMIT_SHA OUTPUT_STRIP_TRAILING_WHITESPACE)
510515

511-
configure_file("${CMAKE_SOURCE_DIR}/include/cudaq/Support/Version.h.in"
516+
configure_file("${CMAKE_SOURCE_DIR}/include/cudaq/Support/Version.h.in"
512517
"${CUDAQ_BINARY_DIR}/include/cudaq/Support/Version.h" @ONLY)
513518

514519
# Check optional dependencies
@@ -538,7 +543,7 @@ add_subdirectory(tpls/fmt)
538543
cmake_policy(POP)
539544
include_directories(SYSTEM tpls/json/include)
540545

541-
# Add spdlog
546+
# Add spdlog
542547
set(SPDLOG_BUILD_SHARED OFF)
543548
set(SPDLOG_FMT_EXTERNAL ON)
544549
set(SPDLOG_BUILD_PIC ON)
@@ -663,7 +668,7 @@ endif()
663668

664669
if (CUDAQ_ENABLE_PYTHON)
665670
find_package(Python 3 COMPONENTS Interpreter Development)
666-
671+
667672
# Apply specific patch to pybind11 for our documentation.
668673
# Only apply the patch if not already applied.
669674
execute_process(COMMAND ${GIT_EXECUTABLE} -C tpls/pybind11/ apply ../customizations/pybind11/pybind.h.diff --ignore-whitespace --reverse --check
@@ -693,8 +698,8 @@ if (CUDAQ_ENABLE_PYTHON)
693698
message(FATAL_ERROR "Applying LTO patch to submodule failed with ${GIT_PATCH_RESULT}, please update patch")
694699
endif()
695700

696-
# Regarding the use of PyBind, we need to be careful that the same STL is used for any
697-
# Python bindings generated as part of the CUDA-Q build and bindings generated for
701+
# Regarding the use of PyBind, we need to be careful that the same STL is used for any
702+
# Python bindings generated as part of the CUDA-Q build and bindings generated for
698703
# third party CUDA-Q libraries; see also https://github.com/pybind/pybind11/issues/1262
699704
add_subdirectory(tpls/pybind11)
700705
add_subdirectory(python)
@@ -706,8 +711,8 @@ if(CUDAQ_BUILD_TESTS AND NOT CUDAQ_DISABLE_CPP_FRONTEND)
706711
add_subdirectory(tpls/googletest-src)
707712
# Bug in GCC 12 leads to spurious warnings (-Wrestrict)
708713
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105329
709-
if (CMAKE_COMPILER_IS_GNUCXX
710-
AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12.0.0
714+
if (CMAKE_COMPILER_IS_GNUCXX
715+
AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12.0.0
711716
AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0.0)
712717
target_compile_options(gtest PUBLIC --param=evrp-mode=legacy)
713718
endif()
@@ -725,7 +730,7 @@ if(CUDAQ_BUILD_TESTS AND NOT CUDAQ_DISABLE_CPP_FRONTEND)
725730
umbrella_lit_testsuite_end(check-all)
726731
endif()
727732

728-
if (CUDAQ_EXTERNAL_NVQIR_SIMS)
733+
if (CUDAQ_EXTERNAL_NVQIR_SIMS)
729734
while(CUDAQ_EXTERNAL_NVQIR_SIMS)
730735
list(POP_FRONT CUDAQ_EXTERNAL_NVQIR_SIMS LIB_SO_OR_CONFIG_FILE)
731736
add_target_libs_to_wheel(${LIB_SO_OR_CONFIG_FILE})

0 commit comments

Comments
 (0)