Skip to content
5 changes: 2 additions & 3 deletions .ci/run_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ end

proj = abspath(joinpath(@__DIR__, ".."))
cmd = """Base.runtests(["LinearAlgebra"]; propagate_project=true, ncores=$ncores)"""
withenv("JULIA_NUM_THREADS" => 1) do
run(`$(Base.julia_cmd()) --project=$proj --compiled-modules=existing -e $cmd`)
end
run(addenv(`$(Base.julia_cmd()) --project=$proj --compiled-modules=existing -e $cmd`,
"JULIA_NUM_THREADS" => 1, "JULIA_PRUNE_OLD_LA" => true))
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,24 @@ This package performs some type piracy and is also included in the sysimage, whi
To use a development version of this package, you can choose one of the following methods:

1. **Change the UUID in the project file and load the package:**
This approach will produce warnings and may lead to method ambiguities between the development version and the one in the sysimage, but it can be used for basic experimentation.

Start `julia` as
```julia
JULIA_PRUNE_OLD_LA=true julia +nightly --compiled-modules=existing --project
```
where it is assumed that one is already within the `LinearAlgebra` directory. Otherwise, adjust
the project path accordingly. The `julia +nightly` command above assumes that `juliaup` is being used
to launch `julia`, but one may substitute this with the path to the julia executable.

Within the `julia` session, load the `LinearAlgebra` module after pruning the one in the sysimage. This may be done as
```julia
include("test/prune_old_LA.jl") && using LinearAlgebra
```

2. **Build Julia with the custom `LinearAlgebra` commit:**
Modify the commit in `stdlib/LinearAlgebra.version` and build Julia.

Modify the commit in [`stdlib/LinearAlgebra.version`](https://github.com/JuliaLang/julia/blob/master/stdlib/LinearAlgebra.version) and build Julia. This requires one to push the development branch
to `GitHub` or an equivalent platform.

3. **Build a custom sysimage with the new `LinearAlgebra`:**
- Install `PackageCompiler`.
Expand Down
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ENV["JULIA_PRUNE_OLD_LA"] = "true"
include("../test/prune_old_LA.jl")

using LinearAlgebra
Expand Down
6 changes: 6 additions & 0 deletions test/bitarray.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

module TestBitArray

isdefined(Main, :pruned_old_LA) || @eval Main include("prune_old_LA.jl")

using LinearAlgebra, Test, Random
Expand Down Expand Up @@ -95,3 +99,5 @@ b2 = bitrand(v1)

b1 = bitrand(n1, n1)
@check_bit_operation diag(b1)

end # module
4 changes: 3 additions & 1 deletion test/prune_old_LA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ methods_to_delete =
:acsch
]

prune_old_LA = parse(Bool, get(ENV, "JULIA_PRUNE_OLD_LA", "false"))

let
LA = get(Base.loaded_modules, Base.PkgId(Base.UUID("37e2e46d-f89d-539d-b4ee-838fcccc9c8e"), "LinearAlgebra"), nothing)
if LA !== nothing
if LA !== nothing && prune_old_LA
@assert hasmethod(*, Tuple{Matrix{Float64}, Matrix{Float64}})
for methss in methods_to_delete
meths = getglobal(Base, methss)
Expand Down