Skip to content

Commit 8fa97f5

Browse files
committed
Initial commit to populate the repo
0 parents  commit 8fa97f5

File tree

772 files changed

+165924
-0
lines changed

Some content is hidden

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

772 files changed

+165924
-0
lines changed

.clang-format

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
BasedOnStyle: LLVM
2+
AlwaysBreakTemplateDeclarations: Yes
3+
IncludeCategories:
4+
- Regex: '^<'
5+
Priority: 4
6+
- Regex: '^"(llvm|llvm-c|clang|clang-c|mlir|mlir-c)/'
7+
Priority: 3
8+
- Regex: '^"(qoda|\.\.)/'
9+
Priority: 2
10+
- Regex: '.*'
11+
Priority: 1

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.sh text eol=lf

.gitignore

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Editor backup files
2+
*~
3+
4+
# Patch files
5+
*.orig
6+
*.rej
7+
8+
# Compiled Object files
9+
*.slo
10+
*.lo
11+
*.o
12+
*.obj
13+
*.x
14+
# Precompiled Headers
15+
*.gch
16+
*.pch
17+
18+
# Compiled Dynamic libraries
19+
*.so
20+
*.dylib
21+
*.dll
22+
23+
# Fortran module files
24+
*.mod
25+
*.smod
26+
27+
# Compiled Static libraries
28+
*.lai
29+
*.la
30+
*.a
31+
*.lib
32+
33+
**/Output/
34+
**/.lit*.txt
35+
36+
# Executables
37+
*.exe
38+
*.out
39+
*.app
40+
**/out/
41+
/*build/
42+
/*Build/
43+
/plugins/
44+
/other_library_builds/
45+
/.cproject
46+
/.project
47+
/.settings/
48+
**/*.jar
49+
**/.ptp*
50+
*.ab
51+
/dist/
52+
/*egg*/
53+
/python/*egg*
54+
/*tmp*/
55+
/wheelhouse/
56+
**/.ipynb_checkpoints
57+
compile_commands.json
58+
**/*.dat
59+
**/.antlr
60+
__pycache__/
61+
62+
# IDE files
63+
.vscode/*
64+
.theia/*
65+
66+
# Container files
67+
**/.docker/*
68+
69+
# LSP files
70+
.cache/*
71+
72+
# LLVM/MLIR files
73+
*.ll
74+
*.bc
75+
76+
# Build results
77+
[Bb]in/
78+
[Oo]bj/
79+
*.bson
80+
*.csv
81+
*.bin
82+
docs/sphinx/_doxygen
83+
docs/sphinx/_mdgen
84+
**/_build/*
85+
86+
# macOS
87+
.DS_Store

.gitmodules

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[submodule "tpls/fmt"]
2+
path = tpls/fmt
3+
url = https://github.com/fmtlib/fmt
4+
[submodule "tpls/googletest-src"]
5+
path = tpls/googletest-src
6+
url = https://github.com/google/googletest
7+
[submodule "tpls/rpclib"]
8+
path = tpls/rpclib
9+
url = https://github.com/rpclib/rpclib
10+
[submodule "tpls/llvm"]
11+
path = tpls/llvm
12+
url = https://github.com/llvm/llvm-project.git
13+
shallow = true
14+
[submodule "tpls/eigen"]
15+
path = tpls/eigen
16+
url = https://gitlab.com/libeigen/eigen.git
17+
[submodule "tpls/armadillo"]
18+
path = tpls/armadillo
19+
url = https://gitlab.com/conradsnicta/armadillo-code.git
20+
[submodule "tpls/ensmallen"]
21+
path = tpls/ensmallen
22+
url = https://github.com/mlpack/ensmallen
23+
[submodule "tpls/spdlog"]
24+
path = tpls/spdlog
25+
url = https://github.com/gabime/spdlog

.licenserc.yaml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
header:
2+
license:
3+
spdx-id: Apache-2.0
4+
copyright-owner: NVIDIA Corporation & Affiliates
5+
software-name: CUDA Quantum
6+
7+
content: |
8+
Copyright (c) 2023 NVIDIA Corporation & Affiliates.
9+
All rights reserved.
10+
11+
This source code and the accompanying materials are made available under
12+
the terms of the Apache License 2.0 which accompanies this distribution.
13+
14+
pattern: |
15+
Apache License 2.0
16+
17+
paths:
18+
- '**'
19+
20+
paths-ignore:
21+
- '**/*.md'
22+
- '**/*.rst'
23+
- '**/*.patch'
24+
- '**/*.config'
25+
- '**/.*'
26+
- '**/.*/**'
27+
- '**/Doxyfile.in'
28+
- 'docs/sphinx/examples'
29+
- 'LICENSE'
30+
- 'NOTICE'
31+
- 'build'
32+
- 'tpls'
33+
- 'docs/sphinx/_templates'
34+
- 'runtime/cudaq/algorithms/optimizers/nlopt/nlopt-src'
35+
36+
comment: on-failure
37+
38+
license-location-threshold: 80

Building.md

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Building CUDA Quantum from Source
2+
3+
To learn more about how to use CUDA Quantum, please take a look at the [CUDA
4+
Quantum Documentation][cudaq_docs]. The page also contains [installation
5+
instructions][official_install] for officially released packages.
6+
7+
[cudaq_docs]: https://developer.nvidia.com/cudaq
8+
[official_install]: todo
9+
10+
This document contains instructions for how to build CUDA Quantum from source.
11+
This is only needed if you would like to try out the latest (unreleased) version
12+
that is currently under development in this repository and/or if you would like
13+
to add your own modifications to this code base.
14+
15+
To build the CUDA Quantum source code locally, fork this repository and follow
16+
the [instructions for setting up your environment](./Dev_Setup.md). Once you
17+
have done that, you should be able to run the [build
18+
script](./scripts/build_cudaq.sh) to build and install CUDA Quantum in a local
19+
folder. The path where CUDA Quantum will be installed can be configured by
20+
setting the environment variable `CUDAQ_INSTALL_PREFIX`. If you customize this
21+
path or do not work in our dev container, you either need to invoke the
22+
built/installed binaries with the full path or modify your path variables as
23+
follows:
24+
25+
```bash
26+
export PATH="${CUDAQ_INSTALL_PREFIX}/bin:${PATH}"
27+
export PYTHONPATH="${CUDAQ_INSTALL_PREFIX}:${PYTHONPATH}"
28+
```
29+
30+
Our dev container comes with a prebuilt version of LLVM which is used to build
31+
CUDA Quantum. If you are working outside our container, please see the
32+
instructions for [building CUDA Quantum with a custom LLVM
33+
version](#building-cudaq-with-a-custom-llvm-version).
34+
35+
Once you have built CUDA Quantum, you should be able to run the tests and
36+
confirm that they pass by navigating to the `build` folder and entering the
37+
command `ctest`. If all tests pass, you are all set to [start
38+
developing](./Developing.md).
39+
40+
## GPU accelerated backends
41+
42+
CUDA Quantum comes with a range of simulator backends for testing and debugging
43+
application code. In addition to simulators that run on CPUs, there are also
44+
multiple backends leveraging [cuQuantum][cuquantum] for GPU accelerated
45+
simulation. This repository does not require you to have a GPU; if no GPU is
46+
detected, the corresponding backends will simply be omitted from the build.
47+
48+
To use or develop GPU-based simulators, you will need to make sure you have a
49+
suitable NVIDIA GPU with the [latest driver][nvidia_driver] installed. You can
50+
confirm the GPU is properly detected running the command `nvidia-smi`.
51+
52+
If you are working in our dev container, please add a `--gpus=all` flag to the
53+
list of `runArgs` in the
54+
[.devcontainer/devcontainer.json](.devcontainer/devcontainer.json) file and
55+
relaunch the container. It is unfortunately not possible to define a dev
56+
container that enables GPU support depending on the system configuration (see
57+
[this issue](https://github.com/airo-ugent/airo-ros/issues/17)).
58+
59+
If you are not working in our dev container, you may need to specify the correct
60+
path to your cuQuantum installation by setting the environment variable
61+
`CUQUANTUM_INSTALL_PREFIX`.
62+
63+
[cuquantum]: https://developer.nvidia.com/cuquantum-sdk
64+
[nvidia_driver]: https://www.nvidia.com/download/index.aspx
65+
66+
## Building CUDA Quantum with a custom LLVM version
67+
68+
CUDA Quantum is intended to be built using the LLVM commit that the submodule is
69+
set to. If you need to update the LLVM commit, or if you are not using the
70+
prebuilt version of that commit in our dev container, LLVM will need to be built
71+
from source. To configure our build scripts, please set the LLVM submodule to
72+
the desired commit, and set the following environment variable, replacing
73+
`<installation_path>` with the path where the freshly built LLVM tools and
74+
libraries should be installed:
75+
76+
```bash
77+
export LLVM_INSTALL_PREFIX=<installation_path>
78+
```
79+
80+
The CUDA Quantum [build script](./scripts/build_cudaq.sh) checks if
81+
`llvm-config` is available in the bin subfolder of that directory, and will
82+
automatically invoke the [LLVM build script](./scripts/build_llvm.sh) if it is
83+
not.
84+
85+
Please note that building LLVM may take a while and you should have about 64GB
86+
of memory available for the build. Please configure your Docker container
87+
settings accordingly. If you are working on Windows, the amount of resources
88+
that are available within a container is determined by the WSL settings. Please
89+
create or modify the [WSL configuration file][wsl_config] if necessary.
90+
91+
[wsl_config]: https://learn.microsoft.com/en-us/windows/wsl/wsl-config

0 commit comments

Comments
 (0)