From eb082085d4cec43210443b027a64bac57ac79c0a Mon Sep 17 00:00:00 2001 From: Leandro Martinez Date: Fri, 31 Jan 2025 17:02:56 -0300 Subject: [PATCH 01/12] add AllocTest module and adapt tests to it --- src/Box.jl | 11 ++++++----- src/CellOperations.jl | 5 +++-- src/ParticleSystem.jl | 29 +++++++++++++++-------------- src/neighborlists.jl | 27 ++++++++++++++------------- test/runtests.jl | 24 ++++++++++++++++++------ 5 files changed, 56 insertions(+), 40 deletions(-) diff --git a/src/Box.jl b/src/Box.jl index 1ff44e8f..7b817ea2 100644 --- a/src/Box.jl +++ b/src/Box.jl @@ -468,16 +468,17 @@ end @test list == Tuple{Int64,Int64,Float64}[] end -@testitem "Stable Box update" begin +@testitem "Stable Box update" setup=[AllocTest] begin using CellListMap using StaticArrays using BenchmarkTools using LinearAlgebra: diag + using .AllocTest: Allocs # update with tuples box = Box([1, 1, 1], 0.1) a = @ballocated CellListMap.update_box($box; unitcell=(2, 2, 2), cutoff=0.2) evals = 1 samples = 1 - @test a == 0 + @test a == Allocs(0) new_box = CellListMap.update_box(box; unitcell=(2, 2, 2), cutoff=0.2) @test new_box.cutoff == 0.2 @test new_box.input_unit_cell.matrix == [2 0 0; 0 2 0; 0 0 2] @@ -485,7 +486,7 @@ end # update with SVector box = Box([1, 1, 1], 0.1) a = @ballocated CellListMap.update_box($box; unitcell=SVector(2, 2, 2), cutoff=0.2) evals = 1 samples = 1 - @test a == 0 + @test a == Allocs(0) new_box = CellListMap.update_box(box; unitcell=(2, 2, 2), cutoff=0.2) @test new_box.cutoff == 0.2 @test new_box.input_unit_cell.matrix == [2 0 0; 0 2 0; 0 0 2] @@ -495,7 +496,7 @@ end box = Box(limits(x), 0.1) new_x = rand(SVector{3,Float64}, 1500) a = @ballocated CellListMap.update_box($box; unitcell=$(limits(new_x)), cutoff=0.2) evals = 1 samples = 1 - @test a == 0 + @test a == Allocs(0) new_box = CellListMap.update_box(box; unitcell=limits(new_x), cutoff=0.2) @test new_box.cutoff == 0.2 @test diag(new_box.input_unit_cell.matrix) == limits(new_x).limits .+ 2.1 * 0.2 @@ -504,7 +505,7 @@ end box = Box([1 0 0; 0 1 0; 0 0 1], 0.1) new_matrix = SMatrix{3,3,Float64,9}(2, 0, 0, 0, 2, 0, 0, 0, 2) a = @ballocated CellListMap.update_box($box; unitcell=$new_matrix, cutoff=0.2) evals = 1 samples = 1 - @test a == 0 + @test a == Allocs(0) new_box = CellListMap.update_box(box; unitcell=new_matrix, cutoff=0.2) @test new_box.cutoff == 0.2 @test new_box.input_unit_cell.matrix == [2 0 0; 0 2 0; 0 0 2] diff --git a/src/CellOperations.jl b/src/CellOperations.jl index a0a24e08..261cd84e 100644 --- a/src/CellOperations.jl +++ b/src/CellOperations.jl @@ -354,16 +354,17 @@ function _minmax(x::AbstractVector{<:AbstractVector}) return SVector(xmin), SVector(xmax) end -@testitem "_minmax" begin +@testitem "_minmax" setup=[AllocTest] begin using BenchmarkTools using StaticArrays import CellListMap: _minmax + using .AllocTest: Allocs x = [[0.0, 0.5, 1.0], [0.5, 1.0, 0.0], [1.0, 0.0, 0.5]] @test _minmax(x) === (SVector(0.0, 0.0, 0.0), SVector(1.0, 1.0, 1.0)) x = [SVector(0.0, 0.5, 1.0), SVector(0.5, 1.0, 0.0), SVector(1.0, 0.0, 0.5)] @test _minmax(x) === (SVector(0.0, 0.0, 0.0), SVector(1.0, 1.0, 1.0)) a = @ballocated _minmax($x) evals = 1 samples = 1 - @test a == 0 + @test a == Allocs(0) end """ diff --git a/src/ParticleSystem.jl b/src/ParticleSystem.jl index 46530ca9..0da28e40 100644 --- a/src/ParticleSystem.jl +++ b/src/ParticleSystem.jl @@ -757,23 +757,24 @@ function update_unitcell!(sys, unitcell) return sys end -@testitem "update_unitcell!" begin +@testitem "update_unitcell!" setup=[AllocTest] begin using BenchmarkTools using LinearAlgebra: diag using StaticArrays using CellListMap + using .AllocTest: Allocs x = rand(SVector{3,Float64}, 1000) sys1 = ParticleSystem(xpositions=x, unitcell=[1, 1, 1], cutoff=0.1, output=0.0) update_unitcell!(sys1, SVector(2, 2, 2)) @test diag(sys1.unitcell) == [2, 2, 2] a = @ballocated update_unitcell!($sys1, SVector(2, 2, 2)) evals = 1 samples = 1 - @test a == 0 + @test a == Allocs(0) y = rand(SVector{3,Float64}, 1000) sys2 = ParticleSystem(xpositions=x, ypositions=y, unitcell=[1, 1, 1], cutoff=0.1, output=0.0) update_unitcell!(sys2, SVector(2, 2, 2)) @test diag(sys2.unitcell) == [2, 2, 2] a = @ballocated update_unitcell!($sys2, SVector(2, 2, 2)) evals = 1 samples = 1 - @test a == 0 + @test a == Allocs(0) # Test throwing error on updating non-periodic unit cells sys = ParticleSystem(xpositions=x, cutoff=0.1, output=0.0) @test_throws ArgumentError update_unitcell!(sys, [1, 1, 1]) @@ -848,13 +849,13 @@ end update_cutoff!(sys1, 0.2) @test sys1.cutoff == 0.2 a = @ballocated update_cutoff!($sys1, 0.1) evals = 1 samples = 1 - @test a == 0 + @test a == Allocs(0) y = rand(SVector{3,Float64}, 1000) sys2 = ParticleSystem(xpositions=x, ypositions=y, unitcell=[1, 1, 1], cutoff=0.1, output=0.0) update_cutoff!(sys2, 0.2) @test sys2.cutoff == 0.2 a = @ballocated update_cutoff!($sys2, 0.1) evals = 1 samples = 1 - @test a == 0 + @test a == Allocs(0) # Update cutoff of non-periodic systems x = coor(readPDB(CellListMap.argon_pdb_file)) @@ -864,14 +865,14 @@ end update_cutoff!(sys1, 10.0) @test sys1.unitcell ≈ [39.83 0.0 0.0; 0.0 39.96 0.0; 0.0 0.0 39.99] atol = 1e-2 a = @ballocated update_cutoff!($sys1, 8.0) evals = 1 samples = 1 - @test a == 0 + @test a == Allocs(0) sys2 = ParticleSystem(xpositions=x[1:50], ypositions=x[51:100], cutoff=8.0, output=0.0) @test unitcelltype(sys2) == NonPeriodicCell @test sys2.unitcell ≈ [35.63 0.0 0.0; 0.0 35.76 0.0; 0.0 0.0 35.79] atol = 1e-2 update_cutoff!(sys2, 10.0) @test sys2.unitcell ≈ [39.83 0.0 0.0; 0.0 39.96 0.0; 0.0 0.0 39.99] atol = 1e-2 a = @ballocated update_cutoff!($sys2, 8.0) evals = 1 samples = 1 - @test a == 0 + @test a == Allocs(0) end # @@ -953,37 +954,37 @@ end x = rand(SVector{3,Float64}, 1000) sys = ParticleSystem(xpositions=x, unitcell=[1.0, 1.0, 1.0], cutoff=0.1, output=0.0, parallel=false) a = @ballocated CellListMap.UpdateParticleSystem!($sys) samples = 1 evals = 1 - @test a == 0 + @test a == Allocs(0) y = rand(SVector{3,Float64}, 1000) sys = ParticleSystem(xpositions=x, ypositions=y, unitcell=[1.0, 1.0, 1.0], cutoff=0.1, output=0.0, parallel=false) a = @ballocated CellListMap.UpdateParticleSystem!($sys) samples = 1 evals = 1 - @test a == 0 + @test a == Allocs(0) # Test construction with more general abstract vectors x = @view(x[1:500]) sys = ParticleSystem(xpositions=x, unitcell=[1.0, 1.0, 1.0], cutoff=0.1, output=0.0, parallel=false) a = @ballocated CellListMap.UpdateParticleSystem!($sys) samples = 1 evals = 1 - @test a == 0 + @test a == Allocs(0) y = @view(y[1:500]) sys = ParticleSystem(xpositions=x, ypositions=y, unitcell=[1.0, 1.0, 1.0], cutoff=0.1, output=0.0, parallel=false) a = @ballocated CellListMap.UpdateParticleSystem!($sys) samples = 1 evals = 1 - @test a == 0 + @test a == Allocs(0) # Update with matrices x = rand(3, 500) sys = ParticleSystem(xpositions=x, unitcell=[1.0, 1.0, 1.0], cutoff=0.1, output=0.0, parallel=false) a = @ballocated CellListMap.UpdateParticleSystem!($sys) samples = 1 evals = 1 - @test a == 0 + @test a == Allocs(0) # Update non-periodic system x = rand(SVector{3,Float64}, 1000) sys = ParticleSystem(xpositions=x, cutoff=0.1, output=0.0, parallel=false) a = @ballocated CellListMap.UpdateParticleSystem!($sys) samples = 1 evals = 1 - @test a == 0 + @test a == Allocs(0) y = rand(SVector{3,Float64}, 1000) sys = ParticleSystem(xpositions=x, ypositions=y, cutoff=0.1, output=0.0, parallel=false) a = @ballocated CellListMap.UpdateParticleSystem!($sys) samples = 1 evals = 1 - @test a == 0 + @test a == Allocs(0) # Throw error when trying to *not* update lists with autoswap on: sys = ParticleSystem( diff --git a/src/neighborlists.jl b/src/neighborlists.jl index 1a514223..178030a1 100644 --- a/src/neighborlists.jl +++ b/src/neighborlists.jl @@ -423,10 +423,11 @@ end end -@testitem "Allocations" begin +@testitem "Allocations" setup=[AllocTest] begin using CellListMap using StaticArrays using BenchmarkTools + using .AllocTest: Allocs # # Single set of particles @@ -438,11 +439,11 @@ end neighborlist!(system) x = rand(SVector{3,Float64}, 10^3) allocs = @ballocated update!($system, $x) evals = 1 samples = 1 - @test allocs == 0 + @test allocs = Allocs(0) allocs = @ballocated update!($system, $x; cutoff=0.2) evals = 1 samples = 1 - @test allocs == 0 + @test allocs = Allocs(0) allocs = @ballocated neighborlist!($system) evals = 1 samples = 1 - @test allocs == 0 + @test allocs = Allocs(0) # Non-Periodic systems x = rand(SVector{3,Float64}, 10^3) @@ -450,11 +451,11 @@ end neighborlist!(system) x = rand(SVector{3,Float64}, 10^3) allocs = @ballocated update!($system, $x) evals = 1 samples = 1 - @test allocs == 0 + @test allocs = Allocs(0) allocs = @ballocated update!($system, $x; cutoff=0.2) evals = 1 samples = 1 - @test allocs == 0 + @test allocs = Allocs(0) allocs = @ballocated neighborlist!($system) evals = 1 samples = 1 - @test allocs == 0 + @test allocs = Allocs(0) # # Two sets of particles @@ -467,11 +468,11 @@ end x = rand(SVector{3,Float64}, 10^3) y = rand(SVector{3,Float64}, 10^3) allocs = @ballocated neighborlist!($system) evals = 1 samples = 1 - @test allocs == 0 + @test allocs = Allocs(0) allocs = @ballocated update!($system, $x, $y) evals = 1 samples = 1 - @test allocs == 0 + @test allocs = Allocs(0) allocs = @ballocated update!($system, $x, $y; cutoff=0.2) evals = 1 samples = 1 - @test allocs == 0 + @test allocs = Allocs(0) # Non-Periodic systems y = rand(SVector{3,Float64}, 10^3) @@ -480,11 +481,11 @@ end x = rand(SVector{3,Float64}, 10^3) y = rand(SVector{3,Float64}, 10^3) allocs = @ballocated neighborlist!($system) evals = 1 samples = 1 - @test allocs == 0 + @test allocs = Allocs(0) allocs = @ballocated update!($system, $x, $y) evals = 1 samples = 1 - @test allocs == 0 + @test allocs = Allocs(0) allocs = @ballocated update!($system, $x, $y; cutoff=0.2) evals = 1 samples = 1 - @test allocs == 0 + @test allocs = Allocs(0) end diff --git a/test/runtests.jl b/test/runtests.jl index 16de7375..e1845b28 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,15 +1,27 @@ -using TestItemRunner: @run_package_tests, @testitem +using TestItemRunner + +@testmodule AllocTest begin + # This module defines the Allocs struct and the comparison operators + # to conditionally compare the number of allocations based on the + # BUILD_IS_PRODUCTION_BUILD environment variable. + export Allocs + @kwdef struct Allocs + prodbuild::Bool = haskey(ENV, "BUILD_IS_PRODUCTION_BUILD") && ENV["BUILD_IS_PRODUCTION_BUILD"] == "true" + allocs::Int + end + Allocs(allocs::Int) = Allocs(; allocs) + import Base: ==, >, < + ==(a::Int, b::Allocs) = b.prodbuild ? a == b.allocs : true + <(a::Int, b::Allocs) = b.prodbuild ? a < b.allocs : true + ==(a::Allocs, b::Int) = a.prodbuild ? a.allocs == b : true + <(a::Allocs, b::Int) = a.prodbuild ? a.allocs < b : true +end @testitem "Aqua.test_all" begin import Aqua Aqua.test_all(CellListMap) end -#@testitem "Doctests" begin -# using Documenter -# doctest(CellListMap) -#end - @testitem "disjoint sets" begin using CellListMap From b50fbeecf2f5673ead9bf454323f6191510bd992 Mon Sep 17 00:00:00 2001 From: Leandro Martinez Date: Fri, 31 Jan 2025 17:09:51 -0300 Subject: [PATCH 02/12] update CI to not run coverage in general --- .github/workflows/ci.yml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d532072..20943e8b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,42 @@ jobs: exclude: - version: '1.6' os: macOS-latest + build_is_production_build: + - true + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: ${{ matrix.version }} + - uses: actions/cache@v3 + 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@latest + - uses: julia-actions/julia-runtest@latest + env: + BUILD_IS_PRODUCTION_BUILD: ${{ matrix.build_is_production_build }} + with: + coverage: false + tests-with-coverage: + name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + version: + - 'lts' + - 'pre' + os: + - ubuntu-latest + build_is_production_build: + - false steps: - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v2 @@ -39,6 +75,8 @@ jobs: ${{ runner.os }}- - uses: julia-actions/julia-buildpkg@latest - uses: julia-actions/julia-runtest@latest + env: + BUILD_IS_PRODUCTION_BUILD: false - uses: julia-actions/julia-processcoverage@v1 - uses: codecov/codecov-action@v4 with: From 2548c0dfe647e64f6cd5205c79a30abca8e53a20 Mon Sep 17 00:00:00 2001 From: Leandro Martinez Date: Fri, 31 Jan 2025 17:15:32 -0300 Subject: [PATCH 03/12] update TestItemRunner compat --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index dc2114d6..157f37b5 100644 --- a/Project.toml +++ b/Project.toml @@ -36,7 +36,7 @@ Random = "1.6" Setfield = "0.7, 0.8, 0.9, 1" StaticArrays = "1.6" Test = "1.6" -TestItemRunner = "0.2" +TestItemRunner = "1" TestItems = "0.1, 1" Unitful = "1.19" julia = "1.6" From b0e82fe3f8dd316b9acddaa80fb6a0afd378a927 Mon Sep 17 00:00:00 2001 From: Leandro Martinez Date: Fri, 31 Jan 2025 17:18:45 -0300 Subject: [PATCH 04/12] explicit import @testmodule --- src/CellListMap.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CellListMap.jl b/src/CellListMap.jl index dcdc58d3..45f77df5 100644 --- a/src/CellListMap.jl +++ b/src/CellListMap.jl @@ -1,7 +1,7 @@ module CellListMap using DocStringExtensions: TYPEDEF, TYPEDFIELDS -using TestItems: @testitem +using TestItems: @testitem, @testmodule using Compat: @compat using ProgressMeter: Progress, next! using Parameters: @unpack, @with_kw From 51bd698ba1fd6fe7c20f03fbf998ca6782e5ef88 Mon Sep 17 00:00:00 2001 From: Leandro Martinez Date: Fri, 31 Jan 2025 17:24:08 -0300 Subject: [PATCH 05/12] move AllocTest module to package code --- src/testing.jl | 17 +++++++++++++++++ test/runtests.jl | 17 ----------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/testing.jl b/src/testing.jl index 15ca59a2..75cd5b8c 100644 --- a/src/testing.jl +++ b/src/testing.jl @@ -1,3 +1,20 @@ +@testmodule AllocTest begin + # This module defines the Allocs struct and the comparison operators + # to conditionally compare the number of allocations based on the + # BUILD_IS_PRODUCTION_BUILD environment variable. + export Allocs + @kwdef struct Allocs + prodbuild::Bool = haskey(ENV, "BUILD_IS_PRODUCTION_BUILD") && ENV["BUILD_IS_PRODUCTION_BUILD"] == "true" + allocs::Int + end + Allocs(allocs::Int) = Allocs(; allocs) + import Base: ==, >, < + ==(a::Int, b::Allocs) = b.prodbuild ? a == b.allocs : true + <(a::Int, b::Allocs) = b.prodbuild ? a < b.allocs : true + ==(a::Allocs, b::Int) = a.prodbuild ? a.allocs == b : true + <(a::Allocs, b::Int) = a.prodbuild ? a.allocs < b : true +end + #= pathological_coordinates(N) diff --git a/test/runtests.jl b/test/runtests.jl index e1845b28..e5bf52d5 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,22 +1,5 @@ using TestItemRunner -@testmodule AllocTest begin - # This module defines the Allocs struct and the comparison operators - # to conditionally compare the number of allocations based on the - # BUILD_IS_PRODUCTION_BUILD environment variable. - export Allocs - @kwdef struct Allocs - prodbuild::Bool = haskey(ENV, "BUILD_IS_PRODUCTION_BUILD") && ENV["BUILD_IS_PRODUCTION_BUILD"] == "true" - allocs::Int - end - Allocs(allocs::Int) = Allocs(; allocs) - import Base: ==, >, < - ==(a::Int, b::Allocs) = b.prodbuild ? a == b.allocs : true - <(a::Int, b::Allocs) = b.prodbuild ? a < b.allocs : true - ==(a::Allocs, b::Int) = a.prodbuild ? a.allocs == b : true - <(a::Allocs, b::Int) = a.prodbuild ? a.allocs < b : true -end - @testitem "Aqua.test_all" begin import Aqua Aqua.test_all(CellListMap) From a60720fd80876f95bd6fa02ad993d61ec72f896d Mon Sep 17 00:00:00 2001 From: Leandro Martinez Date: Fri, 31 Jan 2025 17:29:47 -0300 Subject: [PATCH 06/12] move test module to runtests.jl and load TestItems on tests --- Project.toml | 3 ++- src/testing.jl | 16 ---------------- test/runtests.jl | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/Project.toml b/Project.toml index 157f37b5..367e671e 100644 --- a/Project.toml +++ b/Project.toml @@ -53,6 +53,7 @@ PDBTools = "e29189f1-7114-4dbd-93d0-c5673a921a58" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a" Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" +TestItems = "1c621080-faea-4a02-84b6-bbd5e436b8fe" [targets] -test = ["Test", "TestItemRunner", "Chemfiles", "NearestNeighbors", "ForwardDiff", "Unitful", "Measurements", "BenchmarkTools", "Aqua", "Documenter", "PDBTools"] +test = ["Test", "TestItemRunner", "Chemfiles", "NearestNeighbors", "ForwardDiff", "Unitful", "Measurements", "BenchmarkTools", "Aqua", "Documenter", "PDBTools", "TestItems"] diff --git a/src/testing.jl b/src/testing.jl index 75cd5b8c..a44ad1b0 100644 --- a/src/testing.jl +++ b/src/testing.jl @@ -1,19 +1,3 @@ -@testmodule AllocTest begin - # This module defines the Allocs struct and the comparison operators - # to conditionally compare the number of allocations based on the - # BUILD_IS_PRODUCTION_BUILD environment variable. - export Allocs - @kwdef struct Allocs - prodbuild::Bool = haskey(ENV, "BUILD_IS_PRODUCTION_BUILD") && ENV["BUILD_IS_PRODUCTION_BUILD"] == "true" - allocs::Int - end - Allocs(allocs::Int) = Allocs(; allocs) - import Base: ==, >, < - ==(a::Int, b::Allocs) = b.prodbuild ? a == b.allocs : true - <(a::Int, b::Allocs) = b.prodbuild ? a < b.allocs : true - ==(a::Allocs, b::Int) = a.prodbuild ? a.allocs == b : true - <(a::Allocs, b::Int) = a.prodbuild ? a.allocs < b : true -end #= pathological_coordinates(N) diff --git a/test/runtests.jl b/test/runtests.jl index e5bf52d5..d4696e2a 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,4 +1,22 @@ using TestItemRunner +using TestItems + +@testmodule AllocTest begin + # This module defines the Allocs struct and the comparison operators + # to conditionally compare the number of allocations based on the + # BUILD_IS_PRODUCTION_BUILD environment variable. + export Allocs + @kwdef struct Allocs + prodbuild::Bool = haskey(ENV, "BUILD_IS_PRODUCTION_BUILD") && ENV["BUILD_IS_PRODUCTION_BUILD"] == "true" + allocs::Int + end + Allocs(allocs::Int) = Allocs(; allocs) + import Base: ==, >, < + ==(a::Int, b::Allocs) = b.prodbuild ? a == b.allocs : true + <(a::Int, b::Allocs) = b.prodbuild ? a < b.allocs : true + ==(a::Allocs, b::Int) = a.prodbuild ? a.allocs == b : true + <(a::Allocs, b::Int) = a.prodbuild ? a.allocs < b : true +end @testitem "Aqua.test_all" begin import Aqua From 2098d268abe343b00090bd82dedfc9dd175d0768 Mon Sep 17 00:00:00 2001 From: Leandro Martinez Date: Fri, 31 Jan 2025 17:35:16 -0300 Subject: [PATCH 07/12] update compat entry --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 367e671e..d85b93c5 100644 --- a/Project.toml +++ b/Project.toml @@ -37,7 +37,7 @@ Setfield = "0.7, 0.8, 0.9, 1" StaticArrays = "1.6" Test = "1.6" TestItemRunner = "1" -TestItems = "0.1, 1" +TestItems = "1" Unitful = "1.19" julia = "1.6" From 36e6b88c56135c6d21ff6a13b90f7918eb38a18c Mon Sep 17 00:00:00 2001 From: Leandro Martinez Date: Fri, 31 Jan 2025 20:47:30 -0300 Subject: [PATCH 08/12] fix tests --- src/ParticleSystem.jl | 6 ++++-- src/neighborlists.jl | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/ParticleSystem.jl b/src/ParticleSystem.jl index 0da28e40..90235356 100644 --- a/src/ParticleSystem.jl +++ b/src/ParticleSystem.jl @@ -839,11 +839,12 @@ function update_cutoff!(sys::ParticleSystem2, cutoff) return sys end -@testitem "update_cutoff!" begin +@testitem "update_cutoff!" setup=[AllocTest] begin using BenchmarkTools using StaticArrays using CellListMap using PDBTools + using .AllocTest: Allocs x = rand(SVector{3,Float64}, 1000) sys1 = ParticleSystem(xpositions=x, unitcell=[1, 1, 1], cutoff=0.1, output=0.0) update_cutoff!(sys1, 0.2) @@ -947,10 +948,11 @@ function UpdateParticleSystem!(sys::ParticleSystem2, update_lists::Bool=true) end # this updates must be non-allocating in the serial case -@testitem "UpdateParticleSystem!" begin +@testitem "UpdateParticleSystem!" setup=[AllocTest] begin using BenchmarkTools using StaticArrays using CellListMap + using .AllocTest: Allocs x = rand(SVector{3,Float64}, 1000) sys = ParticleSystem(xpositions=x, unitcell=[1.0, 1.0, 1.0], cutoff=0.1, output=0.0, parallel=false) a = @ballocated CellListMap.UpdateParticleSystem!($sys) samples = 1 evals = 1 diff --git a/src/neighborlists.jl b/src/neighborlists.jl index 178030a1..a7ab1a3b 100644 --- a/src/neighborlists.jl +++ b/src/neighborlists.jl @@ -439,11 +439,11 @@ end neighborlist!(system) x = rand(SVector{3,Float64}, 10^3) allocs = @ballocated update!($system, $x) evals = 1 samples = 1 - @test allocs = Allocs(0) + @test allocs == Allocs(0) allocs = @ballocated update!($system, $x; cutoff=0.2) evals = 1 samples = 1 - @test allocs = Allocs(0) + @test allocs == Allocs(0) allocs = @ballocated neighborlist!($system) evals = 1 samples = 1 - @test allocs = Allocs(0) + @test allocs == Allocs(0) # Non-Periodic systems x = rand(SVector{3,Float64}, 10^3) @@ -451,11 +451,11 @@ end neighborlist!(system) x = rand(SVector{3,Float64}, 10^3) allocs = @ballocated update!($system, $x) evals = 1 samples = 1 - @test allocs = Allocs(0) + @test allocs == Allocs(0) allocs = @ballocated update!($system, $x; cutoff=0.2) evals = 1 samples = 1 - @test allocs = Allocs(0) + @test allocs == Allocs(0) allocs = @ballocated neighborlist!($system) evals = 1 samples = 1 - @test allocs = Allocs(0) + @test allocs == Allocs(0) # # Two sets of particles @@ -468,11 +468,11 @@ end x = rand(SVector{3,Float64}, 10^3) y = rand(SVector{3,Float64}, 10^3) allocs = @ballocated neighborlist!($system) evals = 1 samples = 1 - @test allocs = Allocs(0) + @test allocs == Allocs(0) allocs = @ballocated update!($system, $x, $y) evals = 1 samples = 1 - @test allocs = Allocs(0) + @test allocs == Allocs(0) allocs = @ballocated update!($system, $x, $y; cutoff=0.2) evals = 1 samples = 1 - @test allocs = Allocs(0) + @test allocs == Allocs(0) # Non-Periodic systems y = rand(SVector{3,Float64}, 10^3) @@ -481,11 +481,11 @@ end x = rand(SVector{3,Float64}, 10^3) y = rand(SVector{3,Float64}, 10^3) allocs = @ballocated neighborlist!($system) evals = 1 samples = 1 - @test allocs = Allocs(0) + @test allocs == Allocs(0) allocs = @ballocated update!($system, $x, $y) evals = 1 samples = 1 - @test allocs = Allocs(0) + @test allocs == Allocs(0) allocs = @ballocated update!($system, $x, $y; cutoff=0.2) evals = 1 samples = 1 - @test allocs = Allocs(0) + @test allocs == Allocs(0) end From ccf41f5984f7b3e19fcf54d1a00a4e804ccfa3bc Mon Sep 17 00:00:00 2001 From: Leandro Martinez Date: Fri, 31 Jan 2025 20:50:02 -0300 Subject: [PATCH 09/12] drop Julia 1.6 compatibility (set to 1.9) --- .github/workflows/ci.yml | 4 ++-- Project.toml | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 20943e8b..dc458945 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: fail-fast: false matrix: version: - - '1.6' + - '1.9' - 'lts' - 'pre' os: @@ -20,7 +20,7 @@ jobs: - macOS-latest - windows-latest exclude: - - version: '1.6' + - version: '1.9' os: macOS-latest build_is_production_build: - true diff --git a/Project.toml b/Project.toml index d85b93c5..75c3f1ca 100644 --- a/Project.toml +++ b/Project.toml @@ -25,21 +25,21 @@ Compat = "4.14.0" DocStringExtensions = "0.9" Documenter = "1.2.1" ForwardDiff = "0.10.13" -LinearAlgebra = "1.6" +LinearAlgebra = "1.9" Measurements = "2.11" NearestNeighbors = "0.4.16" PDBTools = "1.1" Parameters = "0.12" PrecompileTools = "1" ProgressMeter = "1.6" -Random = "1.6" +Random = "1.9" Setfield = "0.7, 0.8, 0.9, 1" StaticArrays = "1.6" -Test = "1.6" +Test = "1.9" TestItemRunner = "1" TestItems = "1" Unitful = "1.19" -julia = "1.6" +julia = "1.9" [extras] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" From 1c1bd88b190f24c8bde57d7ebc48ac8462a98a36 Mon Sep 17 00:00:00 2001 From: Leandro Martinez Date: Fri, 31 Jan 2025 20:54:31 -0300 Subject: [PATCH 10/12] update readme and downgrade CI for 1.9 requirement --- .github/workflows/Downgrade.yml | 4 ++-- README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Downgrade.yml b/.github/workflows/Downgrade.yml index 220149b8..c1b07e6e 100644 --- a/.github/workflows/Downgrade.yml +++ b/.github/workflows/Downgrade.yml @@ -16,8 +16,8 @@ jobs: strategy: matrix: version: - - '1.6' - - '^1.6' + - '1.9' + - '^1.9' steps: - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v1 diff --git a/README.md b/README.md index 5b98b96b..3c3f9872 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ USER GUIDE:
## Installation -Download and install Julia for your platform from [this http url](https://julialang.org/downloads/). Version 1.6 or greater is required. +Download and install Julia for your platform from [this http url](https://julialang.org/downloads/). Version 1.9 or greater is required. Install it as usual for registered Julia packages: From c35720e5d7864091e987728809a2bd63c99b0950 Mon Sep 17 00:00:00 2001 From: Leandro Martinez Date: Fri, 31 Jan 2025 21:04:28 -0300 Subject: [PATCH 11/12] update pdbtools compat entry --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 75c3f1ca..4bbb3a1f 100644 --- a/Project.toml +++ b/Project.toml @@ -28,7 +28,7 @@ ForwardDiff = "0.10.13" LinearAlgebra = "1.9" Measurements = "2.11" NearestNeighbors = "0.4.16" -PDBTools = "1.1" +PDBTools = "2" Parameters = "0.12" PrecompileTools = "1" ProgressMeter = "1.6" From 4d953388b894f8abca73d5b5fc43ccb8228413a8 Mon Sep 17 00:00:00 2001 From: Leandro Martinez Date: Fri, 31 Jan 2025 21:11:58 -0300 Subject: [PATCH 12/12] increase precompiletools compat requirement --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 4bbb3a1f..c91c1369 100644 --- a/Project.toml +++ b/Project.toml @@ -30,7 +30,7 @@ Measurements = "2.11" NearestNeighbors = "0.4.16" PDBTools = "2" Parameters = "0.12" -PrecompileTools = "1" +PrecompileTools = "1.2.1" ProgressMeter = "1.6" Random = "1.9" Setfield = "0.7, 0.8, 0.9, 1"