Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging from dev and updating deployment scripts #64

Merged
merged 24 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
fb2108e
Re-enable tests
chemix-lunacy Mar 8, 2024
8991a93
Merge pull request #27 from oqc-community/jd/fix-linux-cargo-test
chemix-lunacy May 24, 2024
c4357b3
Updating build scripts to llvm 15 and cleanup
chemix-lunacy Jun 3, 2024
9ca8675
Merge pull request #51 from oqc-community/jd/llvm-update
chemix-lunacy Jun 12, 2024
982d6ca
Add cache refresh workflow
chemix-lunacy Jun 12, 2024
3e754ef
Merge pull request #52 from oqc-community/jd/cache-refresh-workflow
chemix-lunacy Jun 12, 2024
544d684
Add citation file
chemix-lunacy Jun 19, 2024
12c3a43
Switch built OS to 20.04 from latest
chemix-lunacy Jun 19, 2024
3140a19
Merge pull request #53 from oqc-community/jd/citation
chemix-lunacy Jun 20, 2024
f503f8d
Add style config files, enable on build
chemix-lunacy Jul 11, 2024
42c04d2
Apply formatting
chemix-lunacy Jul 11, 2024
645b06f
Remove redundant method
chemix-lunacy Jul 11, 2024
997e5bc
Add a codeowner
chemix-lunacy Jul 11, 2024
56733b2
Merge pull request #56 from oqc-community/jd/add_ben
chemix-lunacy Jul 11, 2024
b7600b0
Merge pull request #55 from oqc-community/jd/ruff
chemix-lunacy Jul 12, 2024
374602a
Move paper into its own folder
chemix-lunacy Jul 17, 2024
105be4f
Swap email around
chemix-lunacy Jul 17, 2024
be011fe
Merge pull request #57 from oqc-community/jd/cleanups
chemix-lunacy Jul 17, 2024
12f819d
Fix build documentation
chemix-lunacy Jul 31, 2024
6bb1c51
Merge pull request #58 from oqc-community/jd/documentation-cleanup
chemix-lunacy Aug 5, 2024
e592695
Add Python version testing matrix
chemix-lunacy Aug 5, 2024
8a89505
Merge pull request #60 from oqc-community/jd/python-version-matrix
chemix-lunacy Aug 5, 2024
61511fc
Merge remote-tracking branch 'refs/remotes/origin/develop' into jd/re…
chemix-lunacy Aug 5, 2024
1e6c6c3
Fix up bad CRC issue on deploy
chemix-lunacy Aug 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @jfriel-oqc @keriksson-rosenqvist @owen-oqc @hamidelmaazouz @chemix-lunacy
* @jfriel-oqc @keriksson-rosenqvist @owen-oqc @hamidelmaazouz @chemix-lunacy @bgsach
15 changes: 4 additions & 11 deletions .github/actions/install-llvm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ inputs:
os:
description: "The OS being built upon."
required: true
directory:
description: "The directory to install LLVM binaries to."
required: true
target:
description: "The build script target."
required: true

runs:
using: composite
Expand All @@ -22,9 +16,8 @@ runs:
id: cache-llvm
uses: actions/cache@v4
with:
path: ${{ inputs.directory }}
key: llvm-${{ inputs.version }}-${{ inputs.arch }}-${{ inputs.os }}-${{ inputs.target }}
restore-keys: llvm-${{ inputs.version }}-${{ inputs.arch }}-${{ inputs.os }}-${{ inputs.target }}
key: llvm-${{ inputs.version }}-${{ inputs.os }}
path: ${{ github.workspace }}/src/target/llvm${{ inputs.version }}-0

- name: Linux - Install build dependencies, ninja
run: sudo apt-get install -y ninja-build
Expand All @@ -48,8 +41,8 @@ runs:

- name: Configure LLVM Environment
run: |
Write-Output "RSQL_CACHE_DIR=${{ inputs.directory }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
Write-Output "LLVM_SYS_${{ inputs.version }}0_PREFIX=${{ inputs.directory }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
Write-Output "RSQL_CACHE_DIR=${{ github.workspace }}/src/target/llvm${{ inputs.version }}-0" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
Write-Output "LLVM_SYS_${{ inputs.version }}0_PREFIX=${{ github.workspace }}/src/target/llvm${{ inputs.version }}-0" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
Write-Output "RSQL_LLVM_FEATURE_VERSION=llvm${{ inputs.version }}-0" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh
if: ${{ steps.cache-llvm.outputs.cache-hit != 'true' }}
Expand Down
32 changes: 22 additions & 10 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,33 @@ run-name: Build from ${{ github.ref }}
jobs:
unit-tests:
name: Unit Tests
runs-on: [ubuntu-latest]
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
py_version: [ "3.10", "3.11", "3.12" ]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup rust toolchain
uses: ./.github/actions/rust-toolchain
with:
toolchain: 1.75.0
components: rustfmt clippy

- name: Set up Python 3.10
- name: Set up Python ${{ matrix.py_version }}
uses: actions/setup-python@v3
with:
python-version: "3.10"
python-version: ${{ matrix.py_version }}

- name: Install LLVM
uses: ./.github/actions/install-llvm
with:
os: "ubuntu-20.04"
version: "15"

- name: Build
run: |
sudo apt update
sudo apt install -y build-essential libffi-dev xz-utils powershell curl wget gnupg apt-transport-https
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
export PATH="/root/.cargo/bin:${PATH}"
export PATH="/root/.local/bin:$PATH"
pwsh ./build.ps1
pwsh ./build.ps1
shell: pwsh
36 changes: 36 additions & 0 deletions .github/workflows/cache-refresh.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Cache refresh

on:
schedule:
- cron: "0 0 1,6,11,16,21,26,31 * *" # Every 5 days, give or take.
workflow_dispatch:

permissions:
contents: write
actions: write

jobs:
refresh:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-20.04", "windows-2019", "macos-14", "macos-latest" ]

steps:
- uses: actions/checkout@v4
- name: Setup rust toolchain
uses: ./.github/actions/rust-toolchain
with:
toolchain: 1.75.0
components: rustfmt clippy
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.9
if: ${{ matrix.os != 'macos-14' && matrix.os != 'macos-latest' }}
- name: Install LLVM
uses: ./.github/actions/install-llvm
with:
version: "15"
os: ${{ matrix.os }}
11 changes: 5 additions & 6 deletions .github/workflows/deploy-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-20.04", "windows-2019", "macos-14", "macos-latest"]
os: ["ubuntu-20.04", "windows-2019", "macos-14"]
steps:
- uses: actions/checkout@v4
- name: Setup rust toolchain
Expand All @@ -22,19 +22,18 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: "3.10"
if: ${{ matrix.os != 'macos-14' && matrix.os != 'macos-latest' }}
if: ${{ matrix.os != 'macos-14' }}
- name: Install LLVM
uses: ./.github/actions/install-llvm
with:
version: "14"
version: "15"
os: ${{ matrix.os }}
directory: ${{ github.workspace }}/target/llvm
target: "pypi-build"
- name: "Run build script"
- name: Build
run: |
pwd
./build.ps1 -t "pypi-build"
shell: pwsh

- name: Artifacts - manylinux
uses: actions/upload-artifact@v4
with:
Expand Down
24 changes: 24 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
cff-version: 1.2.0
title: Rasqal
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: John
family-names: Dumbell
email: john.dumbell42@gmail.com
affiliation: Oxford Quantum Circuits (OQC)
repository-code: "https://github.com/oqc-community/rasqal"
url: "https://github.com/oqc-community/rasqal"
abstract: >-
Rasqal is a quantum-classical hybrid runtime that leans on
dynamic execution of hybrid IRs to optimize and synthesize
the circuits it sends to the QPU while executing the
classical parts itself. This approach means all
non-quantum variables are known at runtime, including
results from embedded quantum executions. Such information
is then used to enhance classical execution paths and
optimize circuit synthesis.
license: BSD-3-Clause
license-url: "https://github.com/oqc-community/rasqal/blob/develop/LICENSE"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Some of the key things this approach enables:
2. Enabling hybrid algorithms to be run on machines and tools with only a gate-level API available. This includes QASM API's if you use its simulation framework.
3. Lots of optimization potential when passed large amounts of classical context that a quantum algorithm uses to accentuate its own execution.

We also have a [full feature list and quick intro to its concepts](https://github.com/oqc-community/rasqal/blob/develop/features_and_concepts.md) as well as a [draft paper](https://github.com/oqc-community/rasqal/blob/develop/docs/Rasqal%20Draft%20v2.pdf) that covers its internals in excruciating detail.
We also have a [full feature list and quick intro to its concepts](https://github.com/oqc-community/rasqal/blob/develop/features_and_concepts.md) as well as a [draft paper](https://github.com/oqc-community/rasqal/blob/develop/docs/papers/Rasqal%20Draft%20v2.pdf) that covers its internals in excruciating detail.

If you have any features or ideas you'd like to see implemented feel free to raise a [feature request](https://github.com/oqc-community/Rasqal/issues/new?assignees=&labels=enhancement&projects=&template=feature_request.md&title=)!

Expand All @@ -19,7 +19,7 @@ If you have any features or ideas you'd like to see implemented feel free to rai

1. Install Rasqal in your favourite Python venv by running `pip install rasqal`. Our current testing is done with `v3.10` of Python.
2. Read the [quick start](https://github.com/oqc-community/rasqal/blob/develop/examples.md) and look at our [Python example](https://github.com/oqc-community/Rasqal/blob/develop/docs/examples.py).
3. (Optional) Read the [paper](https://github.com/oqc-community/rasqal/blob/develop/docs/Rasqal%20Draft%20v2.pdf) for a deep-dive into Rasqals concepts and data structures.
3. (Optional) Read the [paper](https://github.com/oqc-community/rasqal/blob/develop/docs/papers/Rasqal%20Draft%20v2.pdf) for a deep-dive into Rasqals concepts and data structures.

### Contributing

Expand Down
2 changes: 1 addition & 1 deletion building.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ When these tools have been downloaded you run `build.ps1` at `/src/build.ps1`. T
From this point you can build the Rust project with cargo and deal with it seperately.
But if you need to redeploy the wheel and test things from Python you need to run the build script again.

If you have issues you can look at the [CI cross-OS build script](https://github.com/oqc-community/rasqal/blob/develop/.github/workflows/deploy-wheels.yaml) and see what might be missing or out of date from the documentation.
If you have issues you can look at the [CI cross-OS build script](https://github.com/oqc-community/rasqal/blob/develop/.github/workflows/deploy-wheels.yml) and see what might be missing or out of date from the documentation.

#### Building LLVM from source

Expand Down
9 changes: 9 additions & 0 deletions docs/papers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Papers

This folder containers various papers that cover the different concepts that are on show in Rasqal and can be used for full reference to its ideas.

This is a quick summary of what each contains.

__Rasqal (Draft).__

Initial paper explaining foundational concepts and data structures. Covers initial implementation of the graph which powers the systems various functionality as well as the mini-runtime and deferred execution mechanisms.
File renamed without changes.
2 changes: 1 addition & 1 deletion features_and_concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ In fact the less the execution run looks like the incoming QIR the better, becau



If you are interested in a more thorough breakdown of its internals and concepts it has [a paper](https://github.com/oqc-community/rasqal/blob/develop/docs/Rasqal%20Draft%20v2.pdf) which goes into them in detail.
If you are interested in a more thorough breakdown of its internals and concepts it has [a paper](https://github.com/oqc-community/rasqal/blob/develop/docs/papers/Rasqal%20Draft%20v2.pdf) which goes into them in detail.

### Features

Expand Down
File renamed without changes.
12 changes: 4 additions & 8 deletions src/build-llvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rust-version = "1.64"
bitvec = "1.0"
const-str = "0.5"
lazy_static = "1.4"
llvm-sys-140 = { package = "llvm-sys", version = "140.0", optional = true }
llvm-sys-150 = { package = "llvm-sys", version = "150.0", optional = true }
log = "0.4"
mut_static = "5.0"

Expand All @@ -28,22 +28,18 @@ cc = "1.0"
lazy_static = "1.4"

[features]
llvm14-0 = ["llvm-sys-140"]
llvm15-0 = ["llvm-sys-150"]

# default to use llvm-sys for llvm linking
default = ["external-llvm-linking", "llvm14-0"]
default = ["external-llvm-linking", "llvm15-0"]
external-llvm-linking = []

# disable linking for local installation or packaging
# no-llvm-linking is marker used in the cfg checks
llvm14-0-no-llvm-linking = ["llvm14-0", "no-llvm-linking", "llvm-sys-140/disable-alltargets-init", "llvm-sys-140/no-llvm-linking"]
llvm15-0-no-llvm-linking = ["llvm15-0", "no-llvm-linking", "llvm-sys-150/disable-alltargets-init", "llvm-sys-150/no-llvm-linking"]

no-llvm-linking = []

# let us do the llvm linking
# internal-llvm-linking is marker used in the cfg checks
llvm14-0-rsql-llvm-linking = ["llvm14-0", "internal-llvm-linking", "llvm-sys-140/disable-alltargets-init", "llvm-sys-140/no-llvm-linking"]

internal-llvm-linking = []
download-llvm = []
build-llvm = []
Expand Down
76 changes: 4 additions & 72 deletions src/build-llvm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,78 +17,6 @@ extern crate cc;
#[macro_use]
extern crate lazy_static;

// Make sure one version of llvm features is used
#[cfg(all(
not(any(feature = "llvm11-0")),
not(any(feature = "llvm12-0")),
not(any(feature = "llvm13-0")),
not(any(feature = "llvm14-0")),
))]
compile_error!(
"One of the features `llvm11-0`, `llvm12-0`, `llvm13-0`, and `llvm14-0` must be used exclusive."
);

// Make sure only one llvm option is used.
#[cfg(any(
all(
feature = "llvm11-0",
any(feature = "llvm12-0", feature = "llvm13-0", feature = "llvm14-0")
),
all(
feature = "llvm12-0",
any(feature = "llvm11-0", feature = "llvm13-0", feature = "llvm14-0")
),
all(
feature = "llvm13-0",
any(feature = "llvm11-0", feature = "llvm12-0", feature = "llvm14-0")
),
all(
feature = "llvm14-0",
any(feature = "llvm11-0", feature = "llvm12-0", feature = "llvm13-0")
),
))]
compile_error!(
"Features `llvm11-0`, `llvm12-0`, `llvm13-0`, and `llvm14-0` must be used exclusive."
);

// Make sure one of the linking features is used
#[cfg(all(
not(any(feature = "rsql-llvm-linking")),
not(any(feature = "external-llvm-linking")),
not(any(feature = "no-llvm-linking")),
))]
compile_error!("One of the features `rsql/rsql-llvm-linking`, `rsql/external-llvm-linking`, and `rsql/no-llvm-linking` must be used exclusive.");

// Make sure only one linking option is used.
#[cfg(any(
all(
feature = "rsql-llvm-linking",
any(feature = "external-llvm-linking", feature = "no-llvm-linking")
),
all(
feature = "external-llvm-linking",
any(feature = "rsql-llvm-linking", feature = "no-llvm-linking")
),
all(
feature = "no-llvm-linking",
any(feature = "rsql-llvm-linking", feature = "external-llvm-linking")
),
))]
compile_error!("Features `rsql/rsql-llvm-linking`, `rsql/external-llvm-linking`, and `rsql/no-llvm-linking` are mutually exclusive.");

// if we are building or downloading, we cannot be externally linking
#[cfg(any(
all(
feature = "build-llvm",
any(feature = "download-llvm", feature = "external-llvm-linking")
),
all(
feature = "download-llvm",
any(feature = "build-llvm", feature = "external-llvm-linking")
),
))]
compile_error!("Features `rsql/build-llvm` and `rsql/download-llvm` are mutually exclusive.");

fn main() -> Result<(), Box<dyn Error>> {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=config.cmake");
Expand Down Expand Up @@ -278,6 +206,8 @@ fn get_llvm_tag() -> String {
"llvmorg-13.0.1".to_owned() // 75e33f7
} else if cfg!(feature = "llvm14-0") {
"llvmorg-14.0.6".to_owned() // 28c006
} else if cfg!(feature = "llvm15-0") {
"llvmorg-15.0.7".to_owned()
} else {
panic!("Unsupported LLVM version. The LLVM feature flags or RSQL_LLVM_TAG must be set.")
}
Expand Down Expand Up @@ -325,6 +255,8 @@ fn locate_llvm_config() -> Option<PathBuf> {
"13"
} else if cfg!(feature = "llvm14-0") {
"14"
} else if cfg!(feature = "llvm15-0") {
"15"
} else {
"unknown"
};
Expand Down
Binary file removed src/build-llvm/zipped/llvm14-0.7z
Binary file not shown.
14 changes: 14 additions & 0 deletions src/rasqal/.ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
fix-only = true

[format]
skip-magic-trailing-comma = true

[lint.flake8-unused-arguments]
ignore-variadic-names = true

[lint.flake8-annotations]
allow-star-arg-any = true
suppress-dummy-args = true

[lint.flake8-comprehensions]
allow-dict-calls-with-keyword-arguments = true
Loading
Loading