Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit b32ebf4

Browse files
committed
Merge remote-tracking branch 'origin/master' into s/fix-rebase
2 parents 0237121 + 69c416a commit b32ebf4

File tree

9 files changed

+83
-19
lines changed

9 files changed

+83
-19
lines changed

.github/workflows/CompatHelper.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: CompatHelper
2+
3+
on:
4+
schedule:
5+
- cron: '00 * * * *'
6+
issues:
7+
types: [opened, reopened]
8+
9+
jobs:
10+
build:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
julia-version: [1.2.0]
15+
julia-arch: [x86]
16+
os: [ubuntu-latest]
17+
steps:
18+
- uses: julia-actions/setup-julia@latest
19+
with:
20+
version: ${{ matrix.julia-version }}
21+
- name: Pkg.add("CompatHelper")
22+
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
23+
- name: CompatHelper.main()
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
run: julia -e 'using CompatHelper; CompatHelper.main()'

.github/workflows/TagBot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: TagBot
2+
on:
3+
schedule:
4+
- cron: 0 * * * *
5+
jobs:
6+
TagBot:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: JuliaRegistries/TagBot@v1
10+
with:
11+
token: ${{ secrets.GITHUB_TOKEN }}

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ os:
44
- linux
55
- osx
66
julia:
7-
- 1.2
7+
- 1.3
88
- nightly
99
matrix:
1010
allow_failures:

Project.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "SparsityDetection"
22
uuid = "684fba80-ace3-11e9-3d08-3bc7ed6f96df"
33
authors = ["Shashi Gowda", "Chris Rackauckas <contact@chrisrackauckas.com>"]
4-
version = "0.1.1"
4+
version = "0.2.0"
55

66
[deps]
77
Cassette = "7057c7e9-c182-5462-911a-8362d720325c"
@@ -10,11 +10,14 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1010
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
1111

1212
[compat]
13+
Cassette = "0.2, 0.3"
14+
SpecialFunctions = "0.8, 0.9, 0.10"
1315
julia = "1"
1416

1517
[extras]
1618
FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41"
19+
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
1720
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1821

1922
[targets]
20-
test = ["Test", "FiniteDiff"]
23+
test = ["FiniteDiff", "SafeTestsets", "Test"]

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SparsityDetection.jl
22

3-
[![Build Status](https://travis-ci.org/JuliaDiffEq/SparsityDetection.jl.svg?branch=master)](https://travis-ci.org/JuliaDiffEq/SparsityDetection.jl)
3+
[![Build Status](https://travis-ci.org/SciML/SparsityDetection.jl.svg?branch=master)](https://travis-ci.org/SciML/SparsityDetection.jl)
44
[![Build status](https://ci.appveyor.com/api/projects/status/iruuqu4hxq00vo3s?svg=true)](https://ci.appveyor.com/project/ChrisRackauckas/sparsitydetection-jl)
55

66
This is a package for automatic Jacobian and Hessian sparsity pattern detection
@@ -10,6 +10,16 @@ numerically, and instead works by non-standard interpretation in order to
1010
check every branch for connectivity in order to determine an accurate sparsity
1111
pattern.
1212

13+
If you use this package, please cite the following:
14+
15+
```
16+
@article{gowda2019sparsity,
17+
title={Sparsity Programming: Automated Sparsity-Aware Optimizations in Differentiable Programming},
18+
author={Gowda, Shashi and Ma, Yingbo and Churavy, Valentin and Edelman, Alan and Rackauckas, Christopher},
19+
year={2019}
20+
}
21+
```
22+
1323
## Example
1424

1525
Suppose we had the function
@@ -36,9 +46,12 @@ vector of length 30 and takes in a vector of length 30, and `sparsity!` spits
3646
out a `Sparsity` object which we can turn into a `SparseMatrixCSC`:
3747

3848
```julia
39-
using SparsityDetection
49+
using SparsityDetection, SparseArrays
50+
input = rand(10)
51+
output = similar(input)
4052
sparsity_pattern = sparsity!(f,output,input)
4153
jac = Float64.(sparse(sparsity_pattern))
54+
4255
```
4356

4457
## API

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
environment:
22
matrix:
3-
- julia_version: 1.1
4-
- julia_version: nightly
3+
- julia_version: 1.3
4+
# - julia_version: nightly
55

66
platform:
77
- x86 # 32-bit

src/index.jl

Lines changed: 0 additions & 5 deletions
This file was deleted.

test/common.jl

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,32 @@
11
### Rules
22
using Test
3-
using Cassette
4-
import Cassette: tag, untag, Tagged, metadata, hasmetadata, istagged
5-
using SparseArrays
6-
using SparsityDetection
7-
import SparsityDetection: abstract_run, HessianSparsityContext,
8-
JacobianSparsityContext, TermCombination, HessInput
9-
using Test
3+
using Cassette, SparsityDetection
4+
using SparseArrays, Test
5+
6+
using Cassette: tag, untag, Tagged, metadata, hasmetadata, istagged
7+
using SparsityDetection: Path, BranchesPass, SparsityContext, Fixed,
8+
Input, Output, pset, Tainted, istainted,
9+
alldone, reset!, HessianSparsityContext
10+
using SparsityDetection: TermCombination
1011

1112
Term(i...) = TermCombination(Set([Dict(j=>1 for j in i)]))
1213

1314
function jactester(f, Y, X, args...)
1415
ctx, val = jacobian_sparsity(f, Y, X, args...; raw=true)
16+
val = nothing
17+
while true
18+
val = Cassette.overdub(ctx,
19+
f,
20+
tag(Y, ctx, Output()),
21+
tag(X, ctx, Input()),
22+
map(arg -> arg isa Fixed ?
23+
arg.value :
24+
tag(arg, ctx, pset()), args)...)
25+
println("Explored path: ", path)
26+
alldone(path) && break
27+
reset!(path)
28+
end
29+
return ctx, val
1530
end
1631

1732
jactestmeta(args...) = jactester(args...)[1].metadata

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using SafeTestsets
12
include("common.jl")
23

34
@testset "Jacobian Sparsity" begin include("jacobian.jl") end

0 commit comments

Comments
 (0)