Skip to content

Commit

Permalink
Parallel Testing using ReTestItems
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Feb 12, 2024
1 parent 1260566 commit d7d1e95
Show file tree
Hide file tree
Showing 42 changed files with 3,644 additions and 3,636 deletions.
9 changes: 4 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,14 @@ Optimisers = "0.3"
Pkg = "1.9"
PrecompileTools = "1.2"
Random = "1.9"
ReTestItems = "1.23.1"
Reexport = "1"
ReverseDiff = "1.15"
SafeTestsets = "0.1"
Setfield = "1"
SparseArrays = "1.9"
StableRNGs = "1"
Statistics = "1.9"
Test = "1.9"
TestSetExtensions = "3"
Tracker = "0.2.31"
TruncatedStacktraces = "1.1"
WeightInitializers = "0.1.4"
Expand All @@ -108,13 +107,13 @@ LuxTestUtils = "ac9de150-d08f-4546-94fb-7472b5760531"
Optimisers = "3bd65402-5787-11e9-1adc-39752487f4e2"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
ReTestItems = "817f1d60-ba6b-4fd5-9520-3cf149f6a823"
Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestSetExtensions = "98d24dd4-01ad-11ea-1b02-c9a08f80db04"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[targets]
test = ["ADTypes", "Aqua", "ChainRulesCore", "ComponentArrays", "Flux", "Functors", "LuxAMDGPU", "LuxCUDA", "LuxCore", "LuxLib", "LuxTestUtils", "Optimisers", "Random", "SafeTestsets", "Setfield", "StableRNGs", "Statistics", "Test", "TestSetExtensions", "Zygote"]
test = ["ADTypes", "Aqua", "ChainRulesCore", "ComponentArrays", "Flux", "Functors", "LuxAMDGPU", "LuxCUDA", "LuxCore", "LuxLib", "LuxTestUtils", "Optimisers", "Random", "Setfield", "StableRNGs", "Statistics", "Test", "Zygote", "ReTestItems", "Reexport", "Logging"]
9 changes: 4 additions & 5 deletions docs/tutorials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ using Distributed

addprocs(parse(Int, get(ENV, "LUX_DOCUMENTATION_NWORKERS", "1")))

@everywhere const LUX_DOCUMENTATION_NWORKERS = parse(
Int, get(ENV, "LUX_DOCUMENTATION_NWORKERS", "1"))
@everywhere const LUX_DOCUMENTATION_NWORKERS = parse(Int,
get(ENV, "LUX_DOCUMENTATION_NWORKERS", "1"))
@info "Lux Tutorial Build Running tutorials with $(LUX_DOCUMENTATION_NWORKERS) workers."
@everywhere const CUDA_MEMORY_LIMIT = 100 ÷ LUX_DOCUMENTATION_NWORKERS

Expand All @@ -30,8 +30,7 @@ pmap(enumerate(TUTORIALS)) do (i, (d, p))
name = "$(i)_$(first(rsplit(p, "/")))"
p_ = get_example_path(p)
OUTPUT = joinpath(@__DIR__, "src", "tutorials")
return Literate.markdown(
p_, joinpath(OUTPUT, d); execute=true, name, documenter=true,
preprocess=Base.Fix1(preprocess, p_))
return Literate.markdown(p_, joinpath(OUTPUT, d); execute=true, name,
documenter=true, preprocess=Base.Fix1(preprocess, p_))
end
end
3 changes: 1 addition & 2 deletions src/Lux.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ PrecompileTools.@recompile_invalidations begin

import LuxCore: AbstractExplicitLayer, AbstractExplicitContainerLayer,
initialparameters, initialstates, parameterlength, statelength,
update_state,
trainmode, testmode, setup, apply, display_name
update_state, trainmode, testmode, setup, apply, display_name
import LuxDeviceUtils: AbstractLuxDevice, AbstractLuxGPUDevice, AbstractLuxDeviceAdaptor
end

Expand Down
4 changes: 1 addition & 3 deletions src/chainrules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ function CRC.rrule(::typeof(merge), nt1::NamedTuple{F1}, nt2::NamedTuple{F2}) wh
dnt2 = NamedTuple((f2 => getproperty(dy, f2) for f2 in F2))
return (NoTangent(), dnt1, dnt2)
end
function ∇merge(dy::Union{NoTangent, ZeroTangent})
return (NoTangent(), NoTangent(), NoTangent())
end
∇merge(::Union{NoTangent, ZeroTangent}) = (NoTangent(), NoTangent(), NoTangent())
return y, ∇merge
end

Expand Down
14 changes: 7 additions & 7 deletions src/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ This function has been deprecated. Use [`cpu_device`](@ref) instead.
:::
"""
function cpu(x)
Base.depwarn(
"`cpu` has been deprecated and will be removed in v0.6. Use `cpu_device` instead.",
:cpu)
Base.depwarn("`cpu` has been deprecated and will be removed in v0.6. Use \
`cpu_device` instead.", :cpu)
return (cpu_device())(x)
end

Expand All @@ -30,10 +29,11 @@ inside performance critical code will cause massive slowdowns due to type infere
:::
"""
function gpu(x)
@warn "Using `gpu` inside performance critical code will cause massive slowdowns due to type inference failure. Please update your code to use `gpu_device` API." maxlog=1
@warn "Using `gpu` inside performance critical code will cause massive slowdowns due \
to type inference failure. Please update your code to use `gpu_device` \
API." maxlog=1

Base.depwarn(
"`gpu` has been deprecated and will be removed in v0.6. Use `gpu_device` instead.",
:gpu)
Base.depwarn("`gpu` has been deprecated and will be removed in v0.6. Use \
`gpu_device` instead.", :gpu)
return (gpu_device())(x)
end
40 changes: 0 additions & 40 deletions src/stacktraces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,6 @@ function disable_stacktrace_truncation!(; disable::Bool=true)
end
end

# NamedTuple / Tuples -- Lux uses them quite frequenty (states) making the error messages
# too verbose
@static if VERSION v"1.9" && !TruncatedStacktraces.DISABLE
function Base.show(io::IO, t::Type{<:Tuple})
if (TruncatedStacktraces.VERBOSE[] ||
!hasfield(t, :parameters) ||
length(t.parameters) == 0)
invoke(show, Tuple{IO, Type}, io, t)
else
try
fields = t.parameters
fields_truncated = length(fields) > 2 ? "$(fields[1]),$(fields[2]),…" :
(length(fields) == 2 ? "$(fields[1]),$(fields[2])" :
(length(fields) == 1 ? "$(fields[1])" : ""))
print(io, "Tuple{$fields_truncated}")
catch
invoke(show, Tuple{IO, Type}, io, t)
end
end
end

function Base.show(io::IO, t::Type{<:NamedTuple})
if (TruncatedStacktraces.VERBOSE[] ||
!hasfield(t, :parameters) ||
length(t.parameters) == 0)
invoke(show, Tuple{IO, Type}, io, t)
else
try
fields = first(t.parameters)
fields_truncated = length(fields) > 2 ? "$(fields[1]),$(fields[2]),…" :
(length(fields) == 2 ? "$(fields[1]),$(fields[2])" :
(length(fields) == 1 ? "$(fields[1])" : ""))
print(io, "NamedTuple{($fields_truncated),…}")
catch
invoke(show, Tuple{IO, Type}, io, t)
end
end
end
end

# Lux Layers
## layers/basic.jl
@truncate_stacktrace WrappedFunction
Expand Down
16 changes: 0 additions & 16 deletions test/aqua.jl

This file was deleted.

7 changes: 7 additions & 0 deletions test/aqua_tests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@testitem "Aqua: Quality Assurance" begin
using Aqua, ChainRulesCore

Aqua.test_all(Lux; piracies=false)
Aqua.test_piracies(Lux;
treat_as_own=[ChainRulesCore.frule, ChainRulesCore.rrule, Core.kwcall])
end
Loading

0 comments on commit d7d1e95

Please sign in to comment.