JuliaParallel / PETSc.jl

Julia wrappers for the PETSc library
Other
114 stars 37 forks source link

Neither example works... #174

Closed JianghuiDu closed 2 years ago

JianghuiDu commented 2 years ago

First example:

using PETSc
n   =  11
Δx  =  1. / (n - 1)
nnz =  ones(Int64,n); nnz[2:n-1] .= 3;
A   =  PETSc.MatSeqAIJ{Float64}(n,n,nnz);

ERROR: AssertionError: initialized(PETSc.PetscLibType{Float64, Int64, String}("C:\\Users\\Jianghui\\.julia\\artifacts\\e3422549e74b8579bb24ea945fc1507bbc52fc72\\bin\\libpetsc_double_real_Int64.dll"))
Stacktrace:
 [1] PETSc.MatSeqAIJ{Float64}(m::Int64, n::Int64, nnz::Vector{Int64})
   @ PETSc C:\Users\Jianghui\.julia\packages\PETSc\LSdRz\src\mat.jl:198
 [2] top-level scope
   @ REPL[38]:1

Second example:

using PETSc, MPI
S = PETSc.SNES{Float64}(MPI.COMM_SELF; ksp_rtol=1e-4, pc_type="none")

ERROR: MethodError: no method matching (PETSc.SNES{Float64, PetscLib} where PetscLib)(::MPI.Comm;
ksp_rtol=0.0001, pc_type="none")
Closest candidates are:
  (PETSc.SNES{Float64, PetscLib} where PetscLib)(::Union{Type{PETSc.PetscLibType{Float64, Int64, String}}, PETSc.PetscLibType{Float64, Int64, String}}, ::MPI.Comm; snessetfromoptions, options...)
at C:\Users\Jianghui\.julia\packages\PETSc\LSdRz\src\snes.jl:57
Stacktrace:
 [1] top-level scope
   @ REPL[40]:1

Windows 10, Julia 1.6.3. Am I missing something?

boriskaus commented 2 years ago

Apologies, forgot to update the examples. PR #175 should address this (let me know if not).

Also note that significant changes to the package are coming as @jkozdon wrapped nearly the full PETSc package already, in the branch /jek/gen. You can install that with

julia>] add PETSc@jek/gen

At this stage, with the documentation incomplete, you can often learn most by looking at the /test directory,

JianghuiDu commented 2 years ago

Thanks! Sounds great to have the whole PETSc in Julia.