Skip to content
This repository has been archived by the owner on Sep 28, 2024. It is now read-only.

CI overhaul #154

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 0 additions & 13 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
steps:
- label: ":julia: Run tests on 1.6 LTS"
plugins:
- JuliaCI/julia#v1:
version: "1.6"
- JuliaCI/julia-test#v1:
coverage: false
agents:
queue: "juliagpu"
cuda: "*"
timeout_in_minutes: 60
# Don't run Buildkite if the commit message includes the text [skip tests]
if: build.message !~ /\[skip tests\]/

- label: ":julia: Run tests on Julia-latest"
plugins:
- JuliaCI/julia#v1:
Expand Down
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ updates:
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
ignore:
- dependency-name: "crate-ci/typos"
update-types: ["version-update:semver-patch"]
56 changes: 15 additions & 41 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,70 +1,44 @@
name: CI
env:
DATADEPS_ALWAYS_ACCEPT: true
on:
push:
branches: '*'
pull_request:
branches:
- main
paths-ignore:
- 'docs/**'
tags: '*'
pull_request:
push:
branches:
- main
paths-ignore:
- 'docs/**'
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/') }}
schedule:
- cron: '17 14 * * 5'
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
group:
- Core
version:
- '1.6'
- '1'
# - 'nightly'
os:
- ubuntu-latest
- macos-latest
- windows-latest
arch:
- x64
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v3
with:
files: lcov.info
docs:
name: Documentation
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: '1'
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-docdeploy@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
julia --project=docs --code-coverage=user -e '
using Documenter: DocMeta, doctest
using NeuralOperators
DocMeta.setdocmeta!(NeuralOperators, :DocTestSetup, :(using NeuralOperators); recursive=true)
doctest(NeuralOperators)'
depwarn: error
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v3
with:
file: lcov.info
file: lcov.info
37 changes: 37 additions & 0 deletions .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Documentation

on:
push:
branches:
- main
- 'release-'
tags: '*'
pull_request:
schedule:
- cron: '17 14 * * 5'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@latest
with:
version: '1'
- name: Install dependencies
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
- name: Build and deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key
run: julia --project=docs/ --code-coverage=user docs/make.jl
- name: Doctest
run: |
julia --project=docs --code-coverage=user -e '
using Documenter: DocMeta, doctest
using NeuralOperators
DocMeta.setdocmeta!(NeuralOperators, :DocTestSetup, :(using NeuralOperators); recursive=true)
doctest(NeuralOperators)'
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v3
with:
file: lcov.info
41 changes: 41 additions & 0 deletions .github/workflows/Downgrade.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Downgrade
on:
pull_request:
branches:
- main
paths-ignore:
- 'docs/**'
push:
branches:
- main
paths-ignore:
- 'docs/**'
schedule:
- cron: '17 14 * * 5'
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
group:
- Core
version:
- '1'
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
- uses: cjdoris/julia-downgrade-compat-action@v1
with:
skip: Pkg,TOML
- uses: julia-actions/cache@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
13 changes: 13 additions & 0 deletions .github/workflows/SpellCheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Spell Check

on: [pull_request]

jobs:
typos-check:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v3
- name: Check spelling
uses: crate-ci/[email protected]
1 change: 1 addition & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[default.extend-words]
30 changes: 16 additions & 14 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,34 @@ version = "0.4.7"

[deps]
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
CUDAKernels = "72cfdca4-0801-4ab0-bf6a-d52aa10adc57"
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
GeometricFlux = "7e08b658-56d3-11e9-2997-919d5b31e4ea"
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Tullio = "bc48ee85-29a4-5162-ae0b-a64e1601d4bc"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[compat]
CUDA = "3, 4, 5"
CUDAKernels = "0.3, 0.4"
ChainRulesCore = "1"
FFTW = "1"
Flux = "0.13"
GeometricFlux = "0.13"
KernelAbstractions = "0.7, 0.8"
Statistics = "1"
Tullio = "0.3"
Zygote = "0.6"
julia = "1.6"
Aqua = "0.8"
CUDA = "3.5, 4, 5"
ChainRulesCore = "1.15"
FFTW = "1.3.0"
Flux = "0.13.4"
GeometricFlux = "0.13.5"
Graphs = "1.6"
SafeTestsets = "0.1"
Statistics = "1.10"
Test = "1"
Tullio = "0.3.1"
Zygote = "0.6.61"
julia = "1.10"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Graphs", "Test"]
test = ["Aqua", "Graphs", "SafeTestsets", "Test"]
2 changes: 0 additions & 2 deletions src/NeuralOperators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ using Flux
using FFTW
using Tullio
using CUDA
using CUDAKernels
using KernelAbstractions
using Zygote
using ChainRulesCore
using GeometricFlux
Expand Down
12 changes: 6 additions & 6 deletions src/Transform/chebyshev_transform.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
export ChebyshevTransform

struct ChebyshevTransform{N, S} <: AbstractTransform
modes::NTuple{N, S} # N == ndims(x)
struct ChebyshevTransform{nMinus1, S} <: AbstractTransform
modes::Tuple{S,Vararg{S,nMinus1}} # nMinus1 == ndims(x)-1
end

Base.ndims(::ChebyshevTransform{N}) where {N} = N
Base.ndims(::ChebyshevTransform{nMinus1}) where {nMinus1} = nMinus1 + 1
Base.eltype(::Type{ChebyshevTransform}) = Float32

function transform(t::ChebyshevTransform{N}, 𝐱::AbstractArray) where {N}
return FFTW.r2r(𝐱, FFTW.REDFT10, 1:N) # [size(x)..., in_chs, batch]
function transform(t::ChebyshevTransform{nMinus1}, 𝐱::AbstractArray) where {nMinus1}
return FFTW.r2r(𝐱, FFTW.REDFT10, 1:(nMinus1+1)) # [size(x)..., in_chs, batch]
end

function truncate_modes(t::ChebyshevTransform, 𝐱̂::AbstractArray)
Expand All @@ -31,7 +31,7 @@ function ∇r2r(Δ::AbstractArray{T}, kind, dims) where {T}
# derivative of r2r turns out to be r2r
Δx = FFTW.r2r(Δ, kind, dims)

# rank 4 correction: needs @bischtob to elaborate the reason using this.
# rank 4 correction: needs @bischtob to elaborate the reason using this.
# (M,) = size(Δ)[dims]
# a1 = fill!(similar(Δ, M), one(T))
# CUDA.@allowscalar a1[1] = a1[end] = zero(T)
Expand Down
6 changes: 3 additions & 3 deletions src/Transform/fourier_transform.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export FourierTransform

struct FourierTransform{N, S} <: AbstractTransform
modes::NTuple{N, S} # N == ndims(x)
struct FourierTransform{nMinus1, S} <: AbstractTransform
modes::Tuple{S,Vararg{S,nMinus1}} # nMinus1 == ndims(x)-1
end

Base.ndims(::FourierTransform{N}) where {N} = N
Base.ndims(::FourierTransform{nMinus1}) where {nMinus1} = nMinus1+1
Base.eltype(::Type{FourierTransform}) = ComplexF32

function transform(ft::FourierTransform, 𝐱::AbstractArray)
Expand Down
3 changes: 3 additions & 0 deletions test/DeepONet/DeepONet.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
using NeuralOperators
using CUDA; CUDA.allowscalar(false)
using Flux
@testset "DeepONet" begin
@testset "proper construction" begin
deeponet = DeepONet((32, 64, 72), (24, 48, 72), σ, tanh)
Expand Down
2 changes: 2 additions & 0 deletions test/FNO/FNO.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using NeuralOperators
using Flux
@testset "FourierNeuralOperator" begin
m = FourierNeuralOperator()

Expand Down
2 changes: 2 additions & 0 deletions test/NOMAD/NOMAD.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using NeuralOperators
using Flux
@testset "NOMAD" begin
@testset "proper construction" begin
nomad = NOMAD((32, 64, 72), (24, 48, 72), σ, tanh)
Expand Down
4 changes: 0 additions & 4 deletions test/Transform/Transform.jl

This file was deleted.

16 changes: 0 additions & 16 deletions test/Transform/chebyshev_transform.jl

This file was deleted.

22 changes: 0 additions & 22 deletions test/Transform/fourier_transform.jl

This file was deleted.

13 changes: 13 additions & 0 deletions test/chebyshev_transform.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using NeuralOperators
using Zygote
ch = 6
batch = 7
𝐱 = rand(30, 40, 50, ch, batch)
t = ChebyshevTransform((3, 4, 5))
@test ndims(t) == 3
@test size(transform(t, 𝐱)) == (30, 40, 50, ch, batch)
@test size(truncate_modes(t, transform(t, 𝐱))) == (3, 4, 5, ch, batch)
@test size(inverse(t, truncate_modes(t, transform(t, 𝐱)), size(𝐱))) ==
(3, 4, 5, ch, batch)
g = gradient(x -> sum(inverse(t, truncate_modes(t, transform(t, x)), size(𝐱))), 𝐱)
@test size(g[1]) == (30, 40, 50, ch, batch)
Loading
Loading