Skip to content

Commit

Permalink
Merge branch 'main' into edits-to-Deutsch
Browse files Browse the repository at this point in the history
  • Loading branch information
schweitzpgi authored Dec 12, 2024
2 parents 9582466 + 95134fd commit beaa276
Show file tree
Hide file tree
Showing 12 changed files with 91 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ jobs:
fi
image_tag=`docker inspect $cudaq_image --format='{{json .Config.Labels}}' | jq -r '."org.opencontainers.image.version"'`
docs_version="CUDA_QUANTUM_VERSION=${image_tag%-base}"
docs_version="CUDA_QUANTUM_VERSION=$(echo $image_tag | sed -re 's/^(cu[0-9]+-)?(.*)-base$/\2/')"
docker image rm $cudaq_image
docker image prune --force
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:
options:
- nightly
- anyon
- infleqtion
- ionq
- iqm
- oqc
Expand Down Expand Up @@ -650,6 +651,51 @@ jobs:
fi
shell: bash

- name: Submit to Infleqtion test server
if: (success() || failure()) && (inputs.target == 'infleqtion' || github.event_name == 'schedule' || inputs.target == 'nightly')
run: |
echo "### Submit to Infleqtion server" >> $GITHUB_STEP_SUMMARY
export SUPERSTAQ_API_KEY='${{ secrets.SUPERSTAQ_API_KEY }}'
set +e # Allow script to keep going through errors
test_err_sum=0
cpp_tests="docs/sphinx/targets/cpp/infleqtion.cpp"
for filename in $cpp_tests; do
[ -e "$filename" ] || echo "::error::Couldn't find file ($filename)"
nvq++ --target infleqtion $filename
test_status=$?
if [ $test_status -eq 0 ]; then
./a.out
test_status=$?
if [ $test_status -eq 0 ]; then
echo ":white_check_mark: Successfully ran test: $filename" >> $GITHUB_STEP_SUMMARY
else
echo ":x: Test failed (failed to execute): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
else
echo ":x: Test failed (failed to compile): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
done
python_tests="docs/sphinx/targets/python/infleqtion.py"
for filename in $python_tests; do
[ -e "$filename" ] || echo "::error::Couldn't find file ($filename)"
python3 $filename 1> /dev/null
test_status=$?
if [ $test_status -eq 0 ]; then
echo ":white_check_mark: Successfully ran test: $filename" >> $GITHUB_STEP_SUMMARY
else
echo ":x: Test failed (failed to execute): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
done
set -e # Re-enable exit code error checking
if [ ! $test_err_sum -eq 0 ]; then
echo "::error::${test_err_sum} tests failed. See step summary for a list of failures"
exit 1
fi
shell: bash

- name: Submit to ${{ inputs.target }}
# The full set of tests used by this step is currently only supported on
# Quantinuum. The other supported tests are tested by the step above.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,13 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import cudaq\n",
"from cudaq import spin\n",
"import numpy as np\n",
"\n",
"cudaq.set_target('nvidia')\n",
"# cudaq.set_target('qpp-cpu') # Uncomment this line if no GPUs are available"
"import numpy as np\n"
]
},
{
Expand All @@ -65,7 +62,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
type=str,
choices=["qpp-cpu", "nvidia", "nvidia-mgpu"],
help=
"Quantum simulator backend. Default is qpp-cpu. See https://nvidia.github.io/cuda-quantum/0.6.0/using/simulators.html for more options.",
"Quantum simulator backend. Default is qpp-cpu. See https://nvidia.github.io/cuda-quantum for more options.",
)
argparser.add_argument(
"-d",
Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx/applications/python/hadamard_test.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"![Htest2](./images/htestfactored.png)\n",
"\n",
"By preparing this circuit, and repeatedly measuring the ancilla qubit, we estimate the expectation value as $$P(0)-P(1) = Re \\bra{\\psi} O \\ket{\\phi}.$$\n",
"\,
"\n",
"\n",
"The following sections demonstrate how this can be performed in CUDA-Q."
]
Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx/applications/python/vqe_advanced.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"[\u001b[38;2;255;000;000mwarning\u001b[0m] Target \u001b[38;2;000;000;255mnvidia-mqpu\u001b[0m: \u001b[38;2;000;000;255mThis target is deprecating. Please use the 'nvidia' target with option 'mqpu,fp32' or 'mqpu' (fp32 is the default precision option) by adding the command line option '--target-option mqpu,fp32' or passing it as cudaq.set_target('nvidia', option='mqpu,fp32') in Python. Please refer to CUDA-Q \u001b]8;;https://nvidia.github.io/cuda-quantum/latest/using/backends/platform.html#nvidia-mqpu-platform\u001b\\documentation\u001b]8;;\u001b\\ for more information.\u001b[0m\n"
"[\u001b[38;2;255;000;000mwarning\u001b[0m] Target \u001b[38;2;000;000;255mnvidia-mqpu\u001b[0m: \u001b[38;2;000;000;255mThis target is deprecating. Please use the 'nvidia' target with option 'mqpu,fp32' or 'mqpu' (fp32 is the default precision option) by adding the command line option '--target-option mqpu,fp32' or passing it as cudaq.set_target('nvidia', option='mqpu,fp32') in Python. Please refer to CUDA-Q \u001b]8;;https://nvidia.github.io/cuda-quantum/latest/using/backends/platform\u001b\\documentation\u001b]8;;\u001b\\ for more information.\u001b[0m\n"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx/examples/python/building_kernels.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
"### Applying Gates\n",
"\n",
"\n",
"After a kernel is constructed, gates can be applied to start building out a quantum circuit. All the predefined gates in CUDA-Q can be found [here](https://nvidia.github.io/cuda-quantum/latest/api/default_ops.html#unitary-operations-on-qubits).\n",
"After a kernel is constructed, gates can be applied to start building out a quantum circuit. All the predefined gates in CUDA-Q can be found [here](https://nvidia.github.io/cuda-quantum/latest/api/default_ops).\n",
"\n",
"\n",
"Gates can be applied to all qubits in a register:"
Expand Down
4 changes: 3 additions & 1 deletion docs/sphinx/examples/python/building_kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ def kernel(state: cudaq.State):
# ### Applying Gates
#
#
# After a kernel is constructed, gates can be applied to start building out a quantum circuit. All the predefined gates in CUDA-Q can be found [here](https://nvidia.github.io/cuda-quantum/latest/api/default_ops.html#unitary-operations-on-qubits).
# After a kernel is constructed, gates can be applied to start building out a quantum circuit.
# All the predefined gates in CUDA-Q can be found here:
# https://nvidia.github.io/cuda-quantum/api/default_ops.
#
#
# Gates can be applied to all qubits in a register:
Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx/examples/python/executing_kernels.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"source": [
"Note that there is a subtle difference between how `sample` is executed with the target device set to a simulator or with the target device set to a QPU. In simulation mode, the quantum state is built once and then sampled $s$ times where $s$ equals the `shots_count`. In hardware execution mode, the quantum state collapses upon measurement and hence needs to be rebuilt over and over again.\n",
"\n",
"There are a number of helpful tools that can be found in the API [here](https://nvidia.github.io/cuda-quantum/latest/api/languages/python_api.html#cudaq.SampleResult) to process the `Sample_Result` object produced by `sample`."
"There are a number of helpful tools that can be found in the [API docs](https://nvidia.github.io/cuda-quantum/latest/api/languages/python_api) to process the `Sample_Result` object produced by `sample`."
]
},
{
Expand Down
31 changes: 27 additions & 4 deletions docs/sphinx/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,43 @@ CUDA-Q Releases

**latest**

The latest version of CUDA-Q is on the main branch of our `GitHub repository <https://github.com/NVIDIA/cuda-quantum>`__ and is also available as a Docker image. More information about installing the nightly builds can be found :doc:`here <using/install/install>`
The latest version of CUDA-Q is on the main branch of our `GitHub repository <https://github.com/NVIDIA/cuda-quantum>`__
and is also available as a Docker image. More information about installing the nightly builds can be found
:doc:`here <using/install/install>`

- `Docker image (nightly builds) <https://catalog.ngc.nvidia.com/orgs/nvidia/teams/nightly/containers/cuda-quantum>`__
- `Documentation <https://nvidia.github.io/cuda-quantum/latest>`__
- `Examples <https://github.com/NVIDIA/cuda-quantum/tree/main/docs/sphinx/examples>`__

**0.9.0**

We are very excited to share a new toolset added for modeling and manipulating the dynamics of physical systems.
The new API allows to define and execute a time evolution under arbitrary operators. For more information, take
a look at the `docs <https://nvidia.github.io/cuda-quantum/0.9.0/using/backends/dynamics.html>`__.
The 0.9.0 release furthermore includes a range of contribution to add new backends to CUDA-Q, including backends
from `Anyon Technologies <https://nvidia.github.io/cuda-quantum/0.9.0/using/backends/hardware.html#anyon-technologies-anyon-computing>`__,
`Ferimioniq <https://nvidia.github.io/cuda-quantum/0.9.0/using/backends/simulators.html#fermioniq>`__, and
`QuEra Computing <https://nvidia.github.io/cuda-quantum/0.9.0/using/backends/hardware.html#quera-computing>`__,
as well as updates to existing backends from `ORCA <https://nvidia.github.io/cuda-quantum/latest/using/backends/hardware.html#orca-computing>`__
and `OQC <https://nvidia.github.io/cuda-quantum/0.9.0/using/backends/hardware.html#oqc>`__.
We hope you enjoy the new features - also check out our new notebooks and examples to dive into CUDA-Q.

- `Docker image <https://catalog.ngc.nvidia.com/orgs/nvidia/teams/quantum/containers/cuda-quantum>`__
- `Python wheel <https://pypi.org/project/cuda-quantum/0.9.0>`__
- `C++ installer <https://github.com/NVIDIA/cuda-quantum/releases/0.9.0>`__
- `Documentation <https://nvidia.github.io/cuda-quantum/0.9.0>`__
- `Examples <https://github.com/NVIDIA/cuda-quantum/tree/releases/v0.9.0/docs/sphinx/examples>`__

The full change log can be found `here <https://github.com/NVIDIA/cuda-quantum/releases/0.9.0>`__.

**0.8.0**

The 0.8.0 release adds a range of changes to improve the ease of use and performance with CUDA-Q.
The changes listed below highlight some of what we think will be the most useful features and changes
to know about. While the listed changes do not capture all of the great contributions, we would like
to extend many thanks for every contribution, in particular those from external contributors.

- `Docker image <https://catalog.ngc.nvidia.com/orgs/nvidia/teams/quantum/containers/cuda-quantum>`__
- `Docker image <https://catalog.ngc.nvidia.com/orgs/nvidia/teams/quantum/containers/cuda-quantum/tags>`__
- `Python wheel <https://pypi.org/project/cuda-quantum/0.8.0>`__
- `C++ installer <https://github.com/NVIDIA/cuda-quantum/releases/0.8.0>`__
- `Documentation <https://nvidia.github.io/cuda-quantum/0.8.0>`__
Expand All @@ -30,7 +53,7 @@ The full change log can be found `here <https://github.com/NVIDIA/cuda-quantum/r
The 0.7.1 release adds simulator optimizations with significant performance improvements and
extends their functionalities. The `nvidia-mgpu` backend now supports user customization of the
gate fusion level as controlled by the `CUDAQ_MGPU_FUSE` environment variable documented
`here <https://nvidia.github.io/cuda-quantum/latest/using/backends/simulators.html>`__.
`here <https://nvidia.github.io/cuda-quantum/0.7.1/using/backends/simulators.html>`__.
It furthermore adds a range of bug fixes and changes the Python wheel installation instructions.

- `Docker image <https://catalog.ngc.nvidia.com/orgs/nvidia/teams/quantum/containers/cuda-quantum/tags>`__
Expand All @@ -46,7 +69,7 @@ The full change log can be found `here <https://github.com/NVIDIA/cuda-quantum/r
The 0.7.0 release adds support for using :doc:`NVIDIA Quantum Cloud <using/backends/nvqc>`,
giving you access to our most powerful GPU-accelerated simulators even if you don't have an NVIDIA GPU.
With 0.7.0, we have furthermore greatly increased expressiveness of the Python and C++ language frontends.
Check out our `documentation <https://nvidia.github.io/cuda-quantum/latest/using/quick_start.html>`__
Check out our `documentation <https://nvidia.github.io/cuda-quantum/0.7.0/using/quick_start.html>`__
to get started with the new Python syntax support we have added, and `follow our blog <https://developer.nvidia.com/cuda-q>`__
to learn more about the new setup and its performance benefits.

Expand Down
4 changes: 2 additions & 2 deletions lib/Optimizer/CodeGen/ConvertToQIRProfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ namespace {
/// trivial pass only does this preparation work. It performs no analysis and
/// does not rewrite function body's, etc.

static const std::vector<std::string> measurementFunctionNames{
static constexpr std::array<const char *, 3> measurementFunctionNames{
cudaq::opt::QIRMeasureBody, cudaq::opt::QIRMeasure,
cudaq::opt::QIRMeasureToRegister};

Expand Down Expand Up @@ -564,7 +564,7 @@ struct QIRProfilePreparationPass
func.getFunctionType().getParams(), module);

// Apply irreversible attribute to measurement functions
for (auto &funcName : measurementFunctionNames) {
for (auto *funcName : measurementFunctionNames) {
Operation *op = SymbolTable::lookupSymbolIn(module, funcName);
auto funcOp = llvm::dyn_cast_if_present<LLVM::LLVMFuncOp>(op);
if (funcOp) {
Expand Down
5 changes: 4 additions & 1 deletion runtime/nvqir/custatevec/CuStateVecCircuitSimulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ class CuStateVecCircuitSimulator
void *newDeviceStateVector;
HANDLE_CUDA_ERROR(cudaMalloc((void **)&newDeviceStateVector,
stateDimension * sizeof(CudaDataType)));

HANDLE_CUDA_ERROR(cudaMemset(newDeviceStateVector, 0,
stateDimension * sizeof(CudaDataType)));
// Place the state data on device. Could be that
// we just need the zero state, or the user could have provided one
void *otherState;
Expand Down Expand Up @@ -283,6 +284,8 @@ class CuStateVecCircuitSimulator
void *newDeviceStateVector;
HANDLE_CUDA_ERROR(cudaMalloc((void **)&newDeviceStateVector,
stateDimension * sizeof(CudaDataType)));
HANDLE_CUDA_ERROR(cudaMemset(newDeviceStateVector, 0,
stateDimension * sizeof(CudaDataType)));
constexpr int32_t threads_per_block = 256;
uint32_t n_blocks =
(stateDimension + threads_per_block - 1) / threads_per_block;
Expand Down

0 comments on commit beaa276

Please sign in to comment.