Skip to content

Commit 66215f7

Browse files
authored
Merge public main into private/main (NVIDIA#37)
2 parents d91ad27 + 1e9f7d0 commit 66215f7

File tree

13 files changed

+1327
-12
lines changed

13 files changed

+1327
-12
lines changed

.cudaq_version

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"cudaq": {
33
"repository": "NVIDIA/cuda-quantum",
4-
"ref": "5785e44256b757263879580c82cb84adc85bcf5a"
4+
"ref": "dcb0abaf464463061df38992b00f7c3150363d18"
55
}
66
}
7-

.github/workflows/sync.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ jobs:
99
sync:
1010
name: Get Updates from Upstream
1111
if: ${{ github.repository != 'NVIDIA/cudaqx' }}
12-
permissions:
13-
actions: write
14-
contents: write
1512
runs-on: 'ubuntu-latest'
1613

1714
steps:
1815
- name: Checkout repository
1916
uses: actions/checkout@v4
17+
with:
18+
token: ${{ secrets.REPO_BOT_ACCESS_TOKEN }}
2019

2120
- name: Fast-forward ${{ github.ref_name }}
2221
run: |
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
on:
2+
workflow_dispatch:
3+
schedule:
4+
- cron: 0 1 * * 6
5+
6+
name: "Bump CUDA-Q Commit"
7+
8+
jobs:
9+
update-cudaq-commit:
10+
name: Bump CUDA-Q Commit
11+
runs-on: ubuntu-latest
12+
if: ${{ github.repository == 'NVIDIA/cudaqx' }}
13+
permissions:
14+
contents: write # Required to push changes
15+
pull-requests: write # Required to open PRs
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
with:
21+
ref: main
22+
23+
- name: Fetch the latest commit
24+
run: |
25+
SHA=$(curl -s "https://api.github.com/repos/NVIDIA/cuda-quantum/commits/main" | jq -r '.sha')
26+
echo "Latest SHA: $SHA"
27+
echo "sha=$SHA" >> $GITHUB_ENV
28+
29+
- name: Check if SHA has changed
30+
id: check_change
31+
run: |
32+
CURRENT_SHA=$(jq -r '.cudaq.ref' .cudaq_version)
33+
if [[ "${{ env.sha }}" == "$CURRENT_SHA" ]]; then
34+
echo "No changes in SHA. Skipping PR creation."
35+
echo "changed=false" >> $GITHUB_OUTPUT
36+
else
37+
echo "SHA has changed. Proceeding to create PR."
38+
echo "changed=true" >> $GITHUB_OUTPUT
39+
fi
40+
41+
- name: Update .cudaq_version file
42+
if: ${{ steps.check_change.outputs.changed == 'true' }}
43+
run: |
44+
jq '.cudaq.ref = "${{ env.sha }}"' .cudaq_version > .cudaq_version.tmp
45+
mv .cudaq_version.tmp .cudaq_version
46+
echo "Updated SHA in .cudaq_version"
47+
48+
- name: Commit and push changes
49+
if: ${{ steps.check_change.outputs.changed == 'true' }}
50+
run: |
51+
git config --global user.email "[email protected]"
52+
git config --global user.name "GitHub Action"
53+
BRANCH_NAME="update-cudaq-sha-$(date +%s)"
54+
git checkout -b $BRANCH_NAME
55+
git add .cudaq_version
56+
git commit -m "Update dependency SHA to ${{ env.sha }}"
57+
git push origin $BRANCH_NAME
58+
59+
- name: Create Pull Request
60+
if: ${{ steps.check_change.outputs.changed == 'true' }}
61+
env:
62+
GITHUB_TOKEN: ${{ github.token }}
63+
run: |
64+
gh pr create \
65+
--title "Bump CUDA-Q commit" \
66+
--body "Auto update to the latest CUDA-Q commit" \
67+
--head "${BRANCH_NAME}" \
68+
--base "main"

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ project(CUDAQX
1616
LANGUAGES C CXX)
1717

1818
set(CUDAQX_ALL_LIBS "qec;solvers")
19-
set(CUDAQX_ENABLE_LIBS "" CACHE STRING
19+
set(CUDAQX_ENABLE_LIBS "all" CACHE STRING
2020
"Semicolon-separated list of libs to build (${CUDAQX_ALL_LIBS}), or \"all\".")
2121

2222
# We don't want to handle "all" later, thus expand it here.
@@ -45,9 +45,9 @@ include(CUDA-QX)
4545
# Options
4646
# ==============================================================================
4747

48-
option(CUDAQX_INCLUDE_TESTS "Generate build targets for unit tests." OFF)
49-
option(CUDAQX_INCLUDE_DOCS "Generate build targets for the docs." OFF)
50-
option(CUDAQX_BINDINGS_PYTHON "Generate build targets for python bindings." OFF)
48+
option(CUDAQX_INCLUDE_TESTS "Generate build targets for unit tests." ON)
49+
option(CUDAQX_INCLUDE_DOCS "Generate build targets for the docs." ON)
50+
option(CUDAQX_BINDINGS_PYTHON "Generate build targets for python bindings." ON)
5151

5252
# Top-level External Dependencies
5353
# ==============================================================================

docs/sphinx/components/qec/introduction.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -870,8 +870,8 @@ Here's a complete example of running a memory experiment:
870870
871871
# Create code and decoder
872872
code = qec.get_code('steane')
873-
decoder = qec.get_decoder('steane_lut',
874-
code.get_parity())
873+
decoder = qec.get_decoder('single_error_lut',
874+
code.get_parity())
875875
876876
# Configure noise
877877
noise = cudaq.noise_model()
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2024 NVIDIA Corporation & Affiliates. *
3+
* All rights reserved. *
4+
* *
5+
* This source code and the accompanying materials are made available under *
6+
* the terms of the Apache License 2.0 which accompanies this distribution. *
7+
******************************************************************************/
8+
#pragma once
9+
10+
#include "cudaq/solvers/operators/molecule/fermion_compiler.h"
11+
12+
namespace cudaq::solvers {
13+
14+
/// @brief Helper function used by the Bravyi-Kitaev transformation.
15+
cudaq::spin_op seeley_richard_love(std::size_t i, std::size_t j,
16+
std::complex<double> coef, int n_qubits);
17+
18+
/// @brief Map fermionic operators to spin operators via the
19+
/// Bravyi-Kitaev transformation.
20+
class bravyi_kitaev : public fermion_compiler {
21+
public:
22+
cudaq::spin_op generate(const double constant, const cudaqx::tensor<> &hpq,
23+
const cudaqx::tensor<> &hpqrs,
24+
const cudaqx::heterogeneous_map &options) override;
25+
26+
CUDAQ_EXTENSION_CREATOR_FUNCTION(fermion_compiler, bravyi_kitaev)
27+
};
28+
CUDAQ_REGISTER_TYPE(bravyi_kitaev)
29+
} // namespace cudaq::solvers

libs/solvers/lib/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ add_library(cudaq-solvers SHARED
1515
operators/molecule/drivers/pyscf_driver.cpp
1616
operators/molecule/fermion_compilers/fermion_compiler.cpp
1717
operators/molecule/fermion_compilers/jordan_wigner.cpp
18+
operators/molecule/fermion_compilers/bravyi_kitaev.cpp
1819
operators/molecule/molecule.cpp
1920
operators/graph/max_cut.cpp
2021
operators/graph/clique.cpp

0 commit comments

Comments
 (0)