Skip to content

Update Project.toml #865

Update Project.toml

Update Project.toml #865

Workflow file for this run

name: CI
on:
push:
branches:
- main
- master
tags: ['*']
pull_request:
workflow_dispatch:
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created
actions: write
contents: read
strategy:
fail-fast: false
matrix:
version:
- '1.10' # LTS
- '1.11' # Stable
- '1.12' # Latest
os:
- ubuntu-latest
- macOS-latest
- windows-latest
arch:
- x64
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: x64
- uses: julia-actions/cache@v2
with:
# Key on OS + Julia + Project/Manifest hash + commit to avoid stale caches
key: ${{ runner.os }}-julia-${{ matrix.version }}-${{ hashFiles('Project.toml') }}-${{ hashFiles('Manifest.toml') }}-${{ github.sha }}
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y mpich libmpich-dev libfftw3-dev
- name: Install MPI packages (Linux)
if: runner.os == 'Linux'
run: |
julia --project=. -e '
using Pkg
Pkg.add(["MPI", "PencilArrays", "PencilFFTs"])
ENV["JULIA_MPI_BINARY"] = "system"
Pkg.build("MPI")
'
- name: Install system dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install fftw
- name: Install system dependencies (Windows)
if: runner.os == 'Windows'
run: |
julia --project=. -e 'using Pkg; Pkg.add("FFTW"); Pkg.build("FFTW"); using FFTW; println("FFTW version: ", FFTW.version)'
- uses: julia-actions/julia-buildpkg@v1
- name: Instantiate and precompile
run: |
julia --project=. -e 'using Pkg; Pkg.instantiate(); Pkg.precompile()'
- name: Verify FFTW availability
run: |
julia --project=. -e 'try using FFTW; println("FFTW OK") catch e; println("FFTW missing: ", e); exit(1) end'
- name: Run tests with enhanced error handling
uses: julia-actions/julia-runtest@v1
env:
SHTNSKIT_TEST_VERBOSE: "1"
SHTNSKIT_PHI_SCALE: "dft"
SHTNSKIT_FORCE_FFTW: "1"
# Advanced features testing
SHTNSKIT_TEST_ADVANCED: "true"
SHTNSKIT_TEST_AD: "true"
SHTNSKIT_TEST_PARALLEL: "true" # Enable parallel tests
SHTNSKIT_RUN_MPI_TESTS: "1" # Enable MPI tests (Linux only)
SHTNSKIT_TEST_PERFORMANCE: "true"
# JET.jl type stability tests (disabled for Julia 1.12 due to compatibility/performance issues)
SHTNSKIT_RUN_JET_TESTS: ${{ matrix.version != '1.12' && '1' || '0' }}
# Aqua.jl quality assurance tests
SHTNSKIT_RUN_AQUA_TESTS: "1"
# SHTns testing with fallback handling
SHTNSKIT_GRACEFUL_FALLBACK: "true"
# Resource limits for CI stability
OMP_NUM_THREADS: 2
OPENBLAS_NUM_THREADS: 1
JULIA_NUM_THREADS: 2
- name: Run comprehensive serial tests
run: |
julia --project=. -e '
println("Running comprehensive serial test suite...")
include("test/test_serial.jl")
println("Serial test suite complete!")
'
env:
SHTNSKIT_TEST_VERBOSE: "1"
JULIA_NUM_THREADS: 2
- name: Run MPI comprehensive tests (Linux only)
if: runner.os == 'Linux'
run: |
mpiexec -n 4 julia --project=. test/parallel/test_mpi_comprehensive.jl
env:
SHTNSKIT_TEST_VERBOSE: "1"
OMP_NUM_THREADS: 1
OPENBLAS_NUM_THREADS: 1
- name: Test advanced optimizations (if available)
run: |
julia --project=. -e '
using SHTnsKit
println(" Testing advanced optimizations...")
try
# Test LoopVectorization integration
using LoopVectorization
println(" LoopVectorization.jl available")
catch
println(" LoopVectorization.jl not available - skipping turbo tests")
end
try
# Test AD extensions
using Zygote, ForwardDiff
println(" AD packages available")
# Basic AD test
cfg = create_config(Float64, 10, 10, 1)
qlm = randn(ComplexF64, cfg.nlm)
# Test Zygote AD
loss(x) = sum(abs2, synthesize(cfg, real.(x)))
grad_zygote = Zygote.gradient(loss, qlm)[1]
println(" Zygote AD working: gradient norm = $(norm(grad_zygote))")
# Test ForwardDiff AD (simplified)
loss_real(x) = sum(abs2, synthesize(cfg, x))
grad_fd = ForwardDiff.gradient(loss_real, real.(qlm))
println(" ForwardDiff AD working: gradient norm = $(norm(grad_fd))")
catch e
println(" AD testing failed: $(e)")
println("This is acceptable - AD extensions are optional")
end
println(" Advanced optimization testing complete!")
'
- name: Test performance optimizations
run: |
julia --project=. -e '
using SHTnsKit
println(" Testing performance optimizations...")
cfg = create_config(Float64, 30, 30, 1)
qlm = randn(ComplexF64, cfg.nlm)
try
# Test SIMD operations
qlm_copy = copy(qlm)
result = turbo_apply_laplacian!(cfg, qlm_copy)
println(" SIMD Laplacian working")
# Test threading if available
if Threads.nthreads() > 1
qlm_out = similar(qlm)
threaded_apply_costheta_operator!(cfg, qlm, qlm_out)
println(" Threaded operations working with $(Threads.nthreads()) threads")
else
println(" Single-threaded environment - threading tests skipped")
end
# Test advanced pooling
pool = get_advanced_pool(cfg, :test)
println(" Advanced memory pooling working")
catch e
println(" Performance optimization test failed: $(e)")
println("This may indicate missing optimizations - check implementation")
end
println(" Performance testing complete!")
'
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v5
with:
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
# Removed duplicate docs job. See the 'Documentation' job below.
benchmark:
name: Performance Benchmarks
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- uses: julia-actions/cache@v2
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y mpich libmpich-dev libfftw3-dev
- uses: julia-actions/julia-buildpkg@v1
- name: Instantiate and precompile (benchmark)
run: |
julia --project=. -e 'using Pkg; Pkg.instantiate(); Pkg.precompile()'
- name: Run performance benchmarks
run: |
julia --project=. -e '
using SHTnsKit
using BenchmarkTools
# Try to load LoopVectorization extension (optional)
loopvec_available = try
using LoopVectorization
true
catch
println("LoopVectorization not available - turbo benchmarks will be skipped")
false
end
println(" Running performance benchmarks...")
# Different problem sizes
test_sizes = [10, 20, 30]
for lmax in test_sizes
println("\n=== Testing lmax = $lmax ===")
cfg = create_gauss_config(lmax, lmax + 2; nlon=2*lmax + 1)
alm = randn(ComplexF64, lmax+1, lmax+1)
spatial_data = randn(cfg.nlat, cfg.nlon)
# Synthesis benchmark
t_synth = @belapsed synthesis($cfg, $alm; real_output=true)
println("Synthesis: $(t_synth*1000)ms")
# Analysis benchmark
t_anal = @belapsed analysis($cfg, $spatial_data)
println("Analysis: $(t_anal*1000)ms")
# Matrix operator benchmark (using cos(θ) operator)
try
mx = zeros(Float64, 2*cfg.nlm)
mul_ct_matrix(cfg, mx)
alm_out = similar(alm)
t_op = @belapsed SH_mul_mx($cfg, $mx, $alm, $alm_out)
println("Matrix operator: $(t_op*1000)ms")
catch
println("Matrix operator: not available")
end
# Turbo benchmark if LoopVectorization is available
if loopvec_available
try
alm_copy = copy(alm)
t_turbo = @belapsed turbo_apply_laplacian!($cfg, $alm_copy)
println("Turbo Laplacian: $(t_turbo*1000)ms")
catch e
println("Turbo Laplacian: error - $e")
end
else
println("Turbo Laplacian: skipped (LoopVectorization not installed)")
end
end
println("\n Benchmark complete!")
'
docs:
name: Documentation
runs-on: ubuntu-latest
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
permissions:
actions: write # needed to allow julia-actions/cache to proactively delete old caches that it has created
contents: write
statuses: write
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- uses: julia-actions/cache@v2
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libfftw3-dev
- name: Configure doc environment
shell: julia --project=docs --color=yes {0}
run: |
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-docdeploy@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
- name: Run doctests
shell: julia --project=docs --color=yes {0}
run: |
using Documenter: DocMeta, doctest
using SHTnsKit
DocMeta.setdocmeta!(SHTnsKit, :DocTestSetup, :(using SHTnsKit); recursive=true)
doctest(SHTnsKit)