Conversation
src/PETSc.jl called MPI.Init at module top level, which runs only while the package precompiles. Under mpiexec with a stale cache, the rank that precompiled started a worker that inherited the launcher's environment and waited forever for its peers in MPI_Init, so the run sat at 0% CPU with no error. The call is gone; initialize still sets up MPI at run time. Loading PETSc on 2 ranks against a stale cache now takes about 30 s.
A' * x and transpose(A) * x threw a MethodError: the transposed products existed but no method could reach them. isapprox(v, w; rtol) threw too, and on a vector made from a Julia array every norm type after the first came back as 0, because PETSc took them as already cached.
set_values!, ksp \ b, the CSR PetscMat constructor and dof_slot only took Vectors of the library's exact element types, so a view, an Int32 index vector or an offset array was a MethodError or an ArgumentError. They now take any vector or integer. Vectors that already have the library's types still go to PETSc without a copy; anything else is copied once. ksp \ b returns x with the axes of b. set_values! also checks that num_rows and num_cols fit the index vectors it is given. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes found while checking the Vec and Mat methods against what
BaseandLinearAlgebra.Bugs
A' * x,transpose(A) * xandmul!(y, A', x)threw aMethodError. They now callMatMultHermitianTranspose/MatMultTranspose.PetscVecbuilt from a Julia array, every norm after the first came back as 0 (norm(v)gave 5, thennorm(v, NORM_1)gave 0). PETSc saw the other norm types as already cached. The vector is now assembled once when it's created.isapprox(v, w; rtol = …)threw aMethodError.src/PETSc.jlcalledMPI.Initat top level, which runs inside the precompile process. The call is gone;initializestill sets up MPI.UndefVarError; they now throw anArgumentError.Additions
norm(v, p)for p = 1, 2, Inf;norm(A, 2);opnorm(A, 1)andopnorm(A, Inf).size(_, d),axesandndimson vectors and matrices, as for Julia arrays.set_values!,ksp \ b, the CSRPetscMatconstructor anddof_slotaccept any vector or integer type (views, other element types, offset arrays). Exact-typeVectors still pass to PETSc without a copy.