Skip to content

Commit a31fc79

Browse files
authored
More py to rs (#235)
* Move more Python code into the Rust side
1 parent 7e8ea06 commit a31fc79

430 files changed

Lines changed: 194155 additions & 9132 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# CUDA Build Check - Verifies CUDA-related crates compile correctly
2+
# Note: Full runtime testing requires cuQuantum SDK which is not available in CI
3+
# For actual GPU testing, use a self-hosted runner with CUDA and cuQuantum installed
4+
5+
name: CUDA Build Check
6+
7+
env:
8+
RUSTFLAGS: -C debuginfo=0
9+
RUST_BACKTRACE: 1
10+
11+
on:
12+
push:
13+
branches: [ "main", "master", "development", "dev" ]
14+
paths:
15+
- 'crates/pecos-cuquantum/**'
16+
- 'crates/pecos-cuquantum-sys/**'
17+
- 'python/pecos-rslib-cuda/**'
18+
- '.github/workflows/cuda-build-check.yml'
19+
pull_request:
20+
branches: [ "main", "master", "development", "dev" ]
21+
paths:
22+
- 'crates/pecos-cuquantum/**'
23+
- 'crates/pecos-cuquantum-sys/**'
24+
- 'python/pecos-rslib-cuda/**'
25+
- '.github/workflows/cuda-build-check.yml'
26+
27+
concurrency:
28+
group: ${{ github.workflow }}-${{ github.ref }}
29+
cancel-in-progress: true
30+
31+
jobs:
32+
cuda-build-check:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v6
36+
37+
- name: Free disk space
38+
run: |
39+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
40+
sudo apt-get clean
41+
df -h
42+
43+
- name: Install Rust
44+
run: |
45+
curl https://sh.rustup.rs -sSf | sh -s -- -y
46+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
47+
export PATH="$HOME/.cargo/bin:$PATH"
48+
49+
- name: Set up Rust
50+
run: rustup override set stable && rustup update
51+
52+
- name: Cache Rust
53+
uses: Swatinem/rust-cache@v2
54+
with:
55+
save-if: ${{ github.ref_name == 'main' || github.ref_name == 'master' || github.ref_name == 'development' || github.ref_name == 'dev' }}
56+
57+
- name: Install CUDA Toolkit
58+
uses: Jimver/cuda-toolkit@v0.2.30
59+
id: cuda-toolkit
60+
with:
61+
cuda: '12.6.3'
62+
method: 'network'
63+
sub-packages: '["nvcc", "cudart-dev"]'
64+
non-cuda-sub-packages: '["libcublas", "libcublas-dev"]'
65+
66+
- name: Check pecos-cuquantum-sys compiles (stub mode)
67+
run: |
68+
echo "Building pecos-cuquantum-sys (will use stubs since cuQuantum SDK is not installed)..."
69+
cargo check -p pecos-cuquantum-sys
70+
71+
- name: Check pecos-cuquantum compiles (stub mode)
72+
run: |
73+
echo "Building pecos-cuquantum (will use stubs since cuQuantum SDK is not installed)..."
74+
cargo check -p pecos-cuquantum
75+
76+
- name: Check pecos-rslib-cuda compiles (stub mode)
77+
run: |
78+
echo "Building pecos-rslib-cuda Python bindings..."
79+
cargo check -p pecos-rslib-cuda
80+
81+
- name: Run clippy on CUDA crates
82+
run: |
83+
echo "Running clippy on CUDA crates..."
84+
cargo clippy -p pecos-cuquantum-sys -p pecos-cuquantum -p pecos-rslib-cuda -- -D warnings
85+
86+
- name: Verify stub mode detection
87+
run: |
88+
echo "Verifying that build correctly detects stub mode..."
89+
# The crates should compile but is_cuquantum_available() should return false
90+
cargo build -p pecos-cuquantum --release
91+
# Note: We can't actually run the binary to test is_cuquantum_available()
92+
# because it requires the cuQuantum runtime, but the build succeeding
93+
# in stub mode means the detection is working
94+
95+
# Documentation for setting up GPU testing
96+
cuda-testing-info:
97+
runs-on: ubuntu-latest
98+
steps:
99+
- name: CUDA Testing Requirements
100+
run: |
101+
echo "=============================================="
102+
echo "CUDA GPU Testing Requirements"
103+
echo "=============================================="
104+
echo ""
105+
echo "Full runtime tests for pecos-rslib-cuda require:"
106+
echo " 1. NVIDIA GPU with CUDA support"
107+
echo " 2. CUDA Toolkit 12.x installed"
108+
echo " 3. cuQuantum SDK installed"
109+
echo ""
110+
echo "To run GPU tests locally:"
111+
echo " 1. Install CUDA Toolkit: https://developer.nvidia.com/cuda-downloads"
112+
echo " 2. Install cuQuantum SDK: https://developer.nvidia.com/cuquantum-sdk"
113+
echo " 3. Run: cargo test -p pecos-cuquantum --features cuda"
114+
echo " 4. Build Python package: maturin develop -m python/pecos-rslib-cuda/Cargo.toml"
115+
echo ""
116+
echo "For self-hosted CI runners with GPU support:"
117+
echo " - Use runners labeled with 'cuda' or 'gpu'"
118+
echo " - Ensure cuQuantum SDK is pre-installed"
119+
echo " - Run: cargo test -p pecos-cuquantum"
120+
echo "=============================================="

.github/workflows/go-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ jobs:
4141
go-version: ["stable"] # Latest stable (experimental bindings)
4242

4343
steps:
44-
- uses: actions/checkout@v4
44+
- uses: actions/checkout@v6
4545

4646
- name: Set up Go ${{ matrix.go-version }}
47-
uses: actions/setup-go@v5
47+
uses: actions/setup-go@v6
4848
with:
4949
go-version: ${{ matrix.go-version }}
5050

.github/workflows/go-version-consistency.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
check-go-versions:
2323
runs-on: ubuntu-latest
2424
steps:
25-
- uses: actions/checkout@v4
25+
- uses: actions/checkout@v6
2626

2727
- name: Check Go package consistency
2828
run: |

.github/workflows/julia-release.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
architecture: x86_64
9797

9898
steps:
99-
- uses: actions/checkout@v4
99+
- uses: actions/checkout@v6
100100
with:
101101
ref: ${{ inputs.sha || github.sha }}
102102

@@ -107,7 +107,7 @@ jobs:
107107
if: runner.os != 'Windows'
108108
run: |
109109
echo "Installing LLVM using pecos..."
110-
cargo run -p pecos --features cli --release -- llvm install
110+
cargo run -p pecos --features cli --release -- install llvm
111111
112112
echo "Setting LLVM environment variables..."
113113
export PECOS_LLVM=$(cargo run -p pecos --features cli --release -- llvm find 2>/dev/null)
@@ -124,7 +124,7 @@ jobs:
124124
shell: pwsh
125125
run: |
126126
Write-Host "Installing LLVM using pecos..."
127-
cargo run -p pecos --features cli --release -- llvm install
127+
cargo run -p pecos --features cli --release -- install llvm
128128
129129
Write-Host "Setting LLVM environment variables..."
130130
$env:PECOS_LLVM = (cargo run -p pecos --features cli --release -- llvm find 2>$null)
@@ -259,7 +259,7 @@ jobs:
259259
os: macos-latest
260260
architecture: aarch64
261261
steps:
262-
- uses: actions/checkout@v4
262+
- uses: actions/checkout@v6
263263
with:
264264
ref: ${{ inputs.sha || github.sha }}
265265

@@ -337,7 +337,7 @@ jobs:
337337
needs.test_binaries.result == 'success'
338338
runs-on: ubuntu-latest
339339
steps:
340-
- uses: actions/checkout@v4
340+
- uses: actions/checkout@v6
341341
with:
342342
ref: ${{ inputs.sha || github.sha }}
343343

@@ -465,7 +465,7 @@ jobs:
465465
needs.test_binaries.result == 'success'
466466
runs-on: ubuntu-latest
467467
steps:
468-
- uses: actions/checkout@v4
468+
- uses: actions/checkout@v6
469469
with:
470470
ref: ${{ inputs.sha || github.sha }}
471471

@@ -627,7 +627,7 @@ jobs:
627627
628628
- name: Create GitHub Release and Upload Binaries
629629
if: startsWith(github.ref, 'refs/tags/jl-')
630-
uses: softprops/action-gh-release@v1
630+
uses: softprops/action-gh-release@v2
631631
with:
632632
files: release-bundle/binaries/*.tar.gz
633633
body: |

.github/workflows/julia-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
julia-version: ["1"] # Latest stable (experimental bindings)
4242

4343
steps:
44-
- uses: actions/checkout@v4
44+
- uses: actions/checkout@v6
4545

4646
- name: Set up Julia ${{ matrix.julia-version }}
4747
uses: julia-actions/setup-julia@v2
@@ -58,7 +58,7 @@ jobs:
5858
# if: runner.os != 'Windows'
5959
# run: |
6060
# echo "Installing LLVM using pecos..."
61-
# cargo run -p pecos --features cli --release -- llvm install
61+
# cargo run -p pecos --features cli --release -- install llvm
6262
#
6363
# echo "Setting LLVM environment variables..."
6464
# export PECOS_LLVM=$(cargo run -p pecos --features cli --release -- llvm find 2>/dev/null)
@@ -75,7 +75,7 @@ jobs:
7575
# shell: pwsh
7676
# run: |
7777
# Write-Host "Installing LLVM using pecos..."
78-
# cargo run -p pecos --features cli --release -- llvm install
78+
# cargo run -p pecos --features cli --release -- install llvm
7979
#
8080
# Write-Host "Setting LLVM environment variables..."
8181
# $env:PECOS_LLVM = (cargo run -p pecos --features cli --release -- llvm find 2>$null)

.github/workflows/julia-update-hash.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
pull-requests: write
2525

2626
steps:
27-
- uses: actions/checkout@v4
27+
- uses: actions/checkout@v6
2828
with:
2929
fetch-depth: 0
3030
token: ${{ secrets.GITHUB_TOKEN }}
@@ -48,7 +48,7 @@ jobs:
4848
grep -n "GitSource" julia/PECOS.jl/deps/build_tarballs.jl
4949
5050
- name: Create Pull Request
51-
uses: peter-evans/create-pull-request@v5
51+
uses: peter-evans/create-pull-request@v8
5252
with:
5353
token: ${{ secrets.GITHUB_TOKEN }}
5454
commit-message: "Update Julia build hash for ${{ github.ref_name }}"

.github/workflows/julia-version-consistency.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
check-julia-versions:
2323
runs-on: ubuntu-latest
2424
steps:
25-
- uses: actions/checkout@v4
25+
- uses: actions/checkout@v6
2626

2727
- name: Check Julia version consistency
2828
run: |

0 commit comments

Comments
 (0)