You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In PETSc, the command-line option -log_view will show an overview with timings and memory allocations of the simulation, once the simulation is finalised. This is currently not working, but would be handy to have (good for benchmarking and running simulations).
I recall that -log_view is treated slightly different than other parameter options and should be set at the beginning of the simulation, but @psanan can probably explain this better.
The text was updated successfully, but these errors were encountered:
using PETSc
using MPI
petsclib = PETSc.getlib()
PETSc.initialize(petsclib)
# Start the logger
PETSc.LibPETSc.PetscLogDefaultBegin(petsclib)
# Run some PETSc codeusing SparseArrays: spdiagm
PetscScalar = petsclib.PetscScalar
Nq =100
n = Nq -2
x =range(PetscScalar(0), length = Nq, stop =1)[2:(end-1)]
Δx =PetscScalar(x.step)
A =spdiagm(
-1=>-ones(PetscScalar, n -1),
0=>2ones(PetscScalar, n),
1=>-ones(PetscScalar, n -1),
) / Δx^2
κ =2PetscScalar(π)
u(x) =sin(κ * x)
f(x) = κ^2*sin(κ * x)
ksp = PETSc.KSP(A; ksp_monitor =true);
v = ksp \f.(x);
ϵ =sqrt(sum((v -u.(x)) .^2* Δx))
# Dump the logger
viewer = PETSc.LibPETSc.PETSC_VIEWER_STDOUT_(petsclib, MPI.COMM_SELF)
PETSc.LibPETSc.PetscLogView(petsclib, viewer)
# Finalize PETSc
PETSc.finalize(petsclib)
(This obviously isn't clean yet, and the calls to LibPETSc should be hidden in some way).
I tried pushing log_view directly but got some errors from PETSc on finalize. My guess is they want the options set with PetscInitialize whereas we use PetscInitializeNoArguments
In PETSc, the command-line option
-log_view
will show an overview with timings and memory allocations of the simulation, once the simulation is finalised. This is currently not working, but would be handy to have (good for benchmarking and running simulations).I recall that
-log_view
is treated slightly different than other parameter options and should be set at the beginning of the simulation, but @psanan can probably explain this better.The text was updated successfully, but these errors were encountered: