Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: JuliaSmoothOptimizers/PartitionedVectors.jl
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.1.1
Choose a base ref
...
head repository: JuliaSmoothOptimizers/PartitionedVectors.jl
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 9 commits
  • 16 files changed
  • 6 contributors

Commits on Feb 20, 2023

  1. Update Project.toml

    Add the new version of PartitionedStructures, to avoid package conflicts in PartiallySeparableNLPModels
    paraynaud committed Feb 20, 2023
    2
    Copy the full SHA
    a235446 View commit details

Commits on Apr 11, 2023

  1. add benchmark

    RAYNAUD Paul (raynaudp) authored and paraynaud committed Apr 11, 2023
    Copy the full SHA
    2879888 View commit details
  2. fix benchmark package dependencies

    RAYNAUD Paul (raynaudp) authored and paraynaud committed Apr 11, 2023
    Copy the full SHA
    8fe04eb View commit details

Commits on Nov 6, 2024

  1. fix documentation + tutorial + test + build

    paraynaud committed Nov 6, 2024
    Copy the full SHA
    736b81c View commit details
  2. Apply JSOBestieTemplate update

    tmigot authored and paraynaud committed Nov 6, 2024
    Copy the full SHA
    d9190dd View commit details

Commits on Dec 16, 2024

  1. Apply JSOBestieTemplate update

    tmigot authored and paraynaud committed Dec 16, 2024
    Copy the full SHA
    8d5803d View commit details

Commits on Dec 29, 2024

  1. Bump to Krylov.jl 0.9.8 (#51)

    * Update Project.toml
    
    * Update krylov.jl
    
    * Update krylov.jl
    
    * Update krylov.jl
    
    * Update Project.toml
    amontoison authored Dec 29, 2024
    Copy the full SHA
    2095df9 View commit details
  2. 🤖 Format .jl files (#43)

    Co-authored-by: paraynaud <paraynaud@users.noreply.github.com>
    github-actions[bot] and paraynaud authored Dec 29, 2024
    Copy the full SHA
    77933f3 View commit details
  3. Release 0.1.3

    amontoison committed Dec 29, 2024
    2
    Copy the full SHA
    b7bb373 View commit details
3 changes: 3 additions & 0 deletions .breakage/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[deps]
GitHub = "bc5e4493-9b4d-5f90-b8aa-2b2bcaad7a26"
PkgDeps = "839e9fc8-855b-5b3c-a3b7-2833d3dd1f59"
18 changes: 18 additions & 0 deletions .breakage/get_jso_users.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import GitHub, PkgDeps # both export users()

length(ARGS) >= 1 || error("specify at least one JSO package as argument")

jso_repos, _ = GitHub.repos("JuliaSmoothOptimizers")
jso_names = [splitext(x.name)[1] for x jso_repos]

name = splitext(ARGS[1])[1]
name jso_names || error("argument should be one of ", jso_names)

dependents = String[]
try
global dependents = filter(x -> x jso_names, PkgDeps.users(name))
catch e
# package not registered; don't insert into dependents
end

println(dependents)
8 changes: 8 additions & 0 deletions .copier-answers.jso.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
PackageName: "PartitionedVectors"
PackageOwner: "JuliaSmoothOptimizers"
PackageUUID: "9d5e22db-ddc8-46c9-8309-91b035e7f733"
_src_path: "https://github.com/JuliaSmoothOptimizers/JSOBestieTemplate.jl"
_commit: "v0.13.0"
AddBreakage: true
AddBenchmark: false
AddBenchmarkCI: true
165 changes: 165 additions & 0 deletions .github/workflows/Breakage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# Ref: https://securitylab.github.com/research/github-actions-preventing-pwn-requests
name: Breakage

# read-only repo token
# no access to secrets
on:
pull_request:

jobs:
# Build dynamically the matrix on which the "break" job will run.
# The matrix contains the packages that depend on ${{ env.pkg }}.
# Job "setup_matrix" outputs variable "matrix", which is in turn
# the output of the "getmatrix" step.
# The contents of "matrix" is a JSON description of a matrix used
# in the next step. It has the form
# {
# "pkg": [
# "PROPACK",
# "LLSModels",
# "FletcherPenaltySolver"
# ]
# }
setup_matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.getmatrix.outputs.matrix }}
env:
pkg: ${{ github.event.repository.name }}
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: 1
arch: x64
- id: getmatrix
run: |
julia -e 'using Pkg; Pkg.Registry.add(RegistrySpec(url = "https://github.com/JuliaRegistries/General.git"))'
julia --project=.breakage -e 'using Pkg; Pkg.update(); Pkg.instantiate()'
pkgs=$(julia --project=.breakage .breakage/get_jso_users.jl ${{ env.pkg }})
vs='["latest", "stable"]'
# Check if pkgs is empty, and set it to a JSON array if necessary
if [[ -z "$pkgs" || "$pkgs" == "String[]" ]]; then
echo "No packages found; exiting successfully."
exit 0
fi
vs='["latest", "stable"]'
matrix=$(jq -cn --argjson deps "$pkgs" --argjson vers "$vs" '{pkg: $deps, pkgversion: $vers}') # don't escape quotes like many posts suggest
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
break:
needs: setup_matrix
if: needs.setup_matrix.result == 'success' && needs.setup_matrix.outputs.matrix != ''
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.setup_matrix.outputs.matrix) }}

steps:
- uses: actions/checkout@v4

# Install Julia
- uses: julia-actions/setup-julia@v2
with:
version: 1
arch: x64
- uses: actions/cache@v4
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@v1

# Breakage test
- name: 'Breakage of ${{ matrix.pkg }}, ${{ matrix.pkgversion }} version'
env:
PKG: ${{ matrix.pkg }}
VERSION: ${{ matrix.pkgversion }}
run: |
set -v
mkdir -p ./breakage
git clone https://github.com/JuliaSmoothOptimizers/$PKG.jl.git
cd $PKG.jl
if [ $VERSION == "stable" ]; then
TAG=$(git tag -l "v*" --sort=-creatordate | head -n1)
if [ -z "$TAG" ]; then
TAG="no_tag"
else
git checkout $TAG
fi
else
TAG=$VERSION
fi
export TAG
julia -e 'using Pkg;
PKG, TAG, VERSION = ENV["PKG"], ENV["TAG"], ENV["VERSION"]
joburl = joinpath(ENV["GITHUB_SERVER_URL"], ENV["GITHUB_REPOSITORY"], "actions/runs", ENV["GITHUB_RUN_ID"])
open("../breakage/breakage-$PKG-$VERSION", "w") do io
try
TAG == "no_tag" && error("No tag for $VERSION")
pkg"activate .";
pkg"instantiate";
pkg"dev ../";
if TAG == "latest"
global TAG = chomp(read(`git rev-parse --short HEAD`, String))
end
pkg"build";
pkg"test";
print(io, "[![](https://img.shields.io/badge/$TAG-Pass-green)]($joburl)");
catch e
@error e;
print(io, "[![](https://img.shields.io/badge/$TAG-Fail-red)]($joburl)");
end;
end'
- uses: actions/upload-artifact@v4
with:
name: breakage-${{ matrix.pkg }}-${{ matrix.pkgversion }}
path: breakage/breakage-*

upload:
needs: break
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
path: breakage
pattern: breakage-*
merge-multiple: true

- run: ls -R
- run: |
cd breakage
echo "| Package name | latest | stable |" > summary.md
echo "|--|--|--|" >> summary.md
count=0
for file in breakage-*
do
if [ $count == "0" ]; then
name=$(echo $file | cut -f2 -d-)
echo -n "| $name | "
else
echo -n "| "
fi
cat $file
if [ $count == "0" ]; then
echo -n " "
count=1
else
echo " |"
count=0
fi
done >> summary.md
- name: PR comment with file
uses: thollander/actions-comment-pull-request@v2
with:
filePath: breakage/summary.md
25 changes: 25 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Run benchmarks

on:
pull_request:
types: [labeled, opened, synchronize, reopened]

# Only trigger the benchmark job when you add `run benchmark` label to the PR
jobs:
Benchmark:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'run benchmark')
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@latest
with:
version: 1
- uses: julia-actions/julia-buildpkg@latest
- name: Install dependencies
run: julia -e 'using Pkg; pkg"add PkgBenchmark BenchmarkCI@0.1"'
- name: Run benchmarks
run: julia -e 'using BenchmarkCI; BenchmarkCI.judge()'
- name: Post results
run: julia -e 'using BenchmarkCI; BenchmarkCI.postjudge()'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -24,4 +24,12 @@ docs/site/
Manifest.toml

# working repositories
dvpt/**
dvpt/**

# Related to BenchmarkCI
/.benchmarkci
/benchmark/*.json

# Related to PkgBenchmark
benchmark/*.json
benchmark/judgement.md
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PartitionedVectors"
uuid = "9d5e22db-ddc8-46c9-8309-91b035e7f733"
authors = ["Paul Raynaud <paul.raynaud@polymtl.ca>"]
version = "0.1.1"
version = "0.1.3"

[deps]
Krylov = "ba0b0d4f-ebba-5204-a429-3ac8c609bfb7"
@@ -10,9 +10,9 @@ LinearOperators = "5c8ed15e-5a4c-59e4-a42b-c7e8811fb125"
PartitionedStructures = "a6683cb1-4e99-4d03-b5b5-b79ed0acabcf"

[compat]
Krylov = "0.9.0"
Krylov = "0.9.8"
LinearOperators = "2.4.0"
PartitionedStructures = "0.1.4"
PartitionedStructures = "0.1.4, 0.1.5"
julia = "^1.6.0"

[extras]
16 changes: 16 additions & 0 deletions benchmark/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
Krylov = "ba0b0d4f-ebba-5204-a429-3ac8c609bfb7"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LinearOperators = "5c8ed15e-5a4c-59e4-a42b-c7e8811fb125"
PartitionedStructures = "a6683cb1-4e99-4d03-b5b5-b79ed0acabcf"
PartitionedVectors = "9d5e22db-ddc8-46c9-8309-91b035e7f733"
PkgBenchmark = "32113eaa-f34f-5b0d-bd6c-c81e245fc73d"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"

[compat]
Krylov = "0.9.0"
LinearOperators = "2.4.0"
PartitionedStructures = "0.1.2"
PkgBenchmark = "0.2"
StatsBase = "0.33.21"
67 changes: 67 additions & 0 deletions benchmark/benchmarks.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
using LinearAlgebra, StatsBase
using BenchmarkTools
using Krylov, LinearOperators
using PartitionedStructures
using PartitionedVectors

const PS = PartitionedStructures

const SUITE = BenchmarkGroup()

N = 5
n = 8
element_variables = [[1, 2, 3, 4], [3, 4, 5, 6], [5, 6, 7], [5, 6, 8], Int[]]

epv = PS.create_epv(element_variables; type = Float32, n)
pv_x = PartitionedVector(element_variables; T = Float32, n)

epm = PS.epm_from_epv(epv)
PS.update!(epm, epv, Float32(2.0) * epv; verbose = false)
lo_epm = LinearOperators.LinearOperator(epm)

solver = Krylov.CgSolver(pv_x)

pv_gradient = PartitionedVector(element_variables; T = Float32, n)
for i = 1:N
nie = pv_gradient[i].nie
pv_gradient[i] = rand(Float32, nie)
end

res = similar(pv_x)

Krylov.solve!(solver, lo_epm, -pv_gradient)
SUITE["Krylov small PartitionedVectors"] = BenchmarkGroup()
SUITE["Krylov small PartitionedVectors"] =
@benchmarkable Krylov.solve!(solver, lo_epm, -pv_gradient)

SUITE["small broadcast"] = BenchmarkGroup()
SUITE["small broadcast"] = @benchmarkable res .= pv_gradient .+ 3 .* pv_gradient

N = 1500
n = 20000
nie = 15
element_variables = map((i -> sample(1:n, nie, replace = false)), 1:N)

epv = PS.create_epv(element_variables; type = Float32, n)
pv_x = PartitionedVector(element_variables; T = Float32, n)

epm = PS.epm_from_epv(epv)
PS.update!(epm, epv, Float32(2.0) * epv; verbose = false)
lo_epm = LinearOperators.LinearOperator(epm)

solver = Krylov.CgSolver(pv_x)

pv_gradient = PartitionedVector(element_variables; T = Float32, n)
for i = 1:N
nie = pv_gradient[i].nie
pv_gradient[i] = rand(Float32, nie)
end

res = similar(pv_x)

Krylov.solve!(solver, lo_epm, -pv_gradient)
SUITE["Krylov big PartitionedVectors"] = BenchmarkGroup()
SUITE["Krylov big PartitionedVectors"] = @benchmarkable Krylov.solve!(solver, lo_epm, -pv_gradient)

SUITE["big broadcast"] = BenchmarkGroup()
SUITE["big broadcast"] = @benchmarkable res .= pv_gradient .+ 3 .* pv_gradient
7 changes: 7 additions & 0 deletions benchmark/run_benchmark.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using PkgBenchmark

commit = benchmarkpkg("PartitionedVectors") #dernier commit sur la branche sur laquelle on se trouve
master = benchmarkpkg("PartitionedVectors", "main") # branche master
judgement = judge(commit, master)

export_markdown("benchmark/judgement.md", judgement)
4 changes: 4 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -7,3 +7,7 @@ PartitionedVectors = "9d5e22db-ddc8-46c9-8309-91b035e7f733"

[compat]
Documenter = "~0.27"
Krylov = "0.9.8"
LinearOperators = "2.4.0"
PartitionedStructures = "0.1.4, 0.1.5"
julia = "^1.6.0"
Loading