PETSc, pronounced PET-see (the S is silent), is a suite of data structures and routines for the scalable (parallel) solution of scientific applications modeled by partial differential equations.
Questions tagged [petsc]
145 questions
9
votes
1 answer
scipy sparse matrices as an input for petsc4py
I can't seem to find a way how to efficiently load scipy sparse matrices, e.g. csr_matrix, into a petsc4py matrix, e.g. PETSc.Mat().createAIJ. I found this thread, but I'm not able to apply it.
I would also appreciate a pointer where this stuff is…

zonksoft
- 2,400
- 1
- 24
- 36
6
votes
1 answer
PETSc solving linear system with ksp guide
I am starting use PETSc library to solve linear system of equations in parallel. I have installed all packages, build and run successfully the examples in petsc/src/ksp/ksp/examples/tutorials/ folder, for example ex.c
But I couldn't understand how…

Nurlan
- 2,860
- 19
- 47
- 64
5
votes
2 answers
How to set up a 3d FEM solver with PETSc Scalable Nonlinear Equations Solvers?
In 3.3 they had a grate news - an example of FEM solving using only PETCs SNES on GPU. I am new to PETSc and have a problem - I need to create a sphere in 3d space and apply forces to it... so I need a 3d FEM (if possible on GPU, no MPI required for…

DuckQueen
- 772
- 10
- 62
- 134
4
votes
1 answer
Petsc - combine distributed vector into local vector
I am using Petsc, and I would like to combine a distributed Vec so that every process has a complete copy of the Vec. I have a minimal example which starts with an array of data, constructs an MPI Vec from it, and then tries to use a VecScatter to…

Tony Ruth
- 1,358
- 8
- 19
4
votes
2 answers
Location of mpi.h
I have a code on my computer uses Petsc which depends on mpi. On my computer it works well. I put it on cluster, exported paths of gcc, Petsc and openmpi (although I was using mpich on my computer I hope openmpi will also work) to LD_LIBRARY_PATH…

Shibli
- 5,879
- 13
- 62
- 126
4
votes
1 answer
library design of PETSc FFI in Haskell
I would like to make (a subset of) the PETSc library available from Haskell via a FFI interface in order to hide the memory and error management from the user;
built PETSc 3.5.3 with shared libraries with the command shown below, the test suite…

ocramz
- 816
- 6
- 18
3
votes
2 answers
Read sparse matrix from ascii file into python
I have a Fortran code using the parallel PETSc sparse matrix format mpiaij.
I want to do some analysis of these matrices so I want to read them into python.
I tried the binary output in Fortran and binary input from petsc4py but apparently they are…

Maurice
- 93
- 6
3
votes
2 answers
do..while(0) function-like C macro wrapper in c2hs
I'd like to wrap a function-like C macro in a C function (and in turn wrap it in Haskell with a {#fun ... #} block), but the c2hs preprocessor chokes on the do.. while(0) syntax;
here's the code:
module TestMacro where
#c
#define TestF1(n) do{if…

ocramz
- 816
- 6
- 18
3
votes
1 answer
PetscMalloc vs PetscMallocX
What is the rule of thumb for using PetscMalloc2 (PetscMallocX) instead of PetscMalloc twice (X times)? Should the chunks have similar sizes, or is it always more efficient to allocate them together / at the same time? The manual says "Allocates 2…

Armut
- 969
- 8
- 22
3
votes
4 answers
Using PETSc on makefile within my user-defined makefile
I am new in PETSc. I have a big c++ code and I want to add PETSc to some of the files that I already have, so I have to change my makefile in a way that it can compile PETSc as well.
Is it possible to have two different makefiles and then call PETSc…

Nazi
- 67
- 1
- 7
3
votes
3 answers
PETSc example not working
I have Windows 7 OS.
I have followed the instructions from the PETSc web page; in the command prompt of VS 2005 I have opened cygwin and installed PETSc with the command:
./configure --with-cc='win32fe cl' --with-fc=0 --with-mpi=0…

user1487833
- 33
- 1
- 5
2
votes
1 answer
Convert a list of Vector to a matrix with petsc4py
I have a list of vectors that I want to gather in a single matrix Z. Here is the code I tried to use :
import sys, slepc4py
slepc4py.init(sys.argv)
from petsc4py import PETSc
from slepc4py import SLEPc
n = 5
d = 10
l = [] # creation of the list…

Thomas
- 263
- 3
- 14
2
votes
1 answer
Attempting to compile through MacOS Terminal: "No such file or directory"
I'm trying to compile this project from DTU. This project requires that PETSc be installed.
I have installed PETSc to /Users/hornymoose/petsc-3.13.3/
I have extracted the zip from GitHub to /Users/hornymoose/dtu
The DTU project's makefile has the…

hornymoose
- 21
- 2
2
votes
0 answers
Petsc code has no parallel speed-up on 2990WX platform
While I run my code on a old Intel Xeon platform(X5650@2.67GHz), the parallel efficiency seems good that 80%~95% speed-up with twice processor usage. However, when I run the same code on on AMD 2990WX platform, I cannot get any acceleration with any…

Nothingts
- 21
- 2
2
votes
1 answer
VSCode Itellisense with python C extension module (petsc4py)
I'm currently using a python module called petsc4py (https://pypi.org/project/petsc4py/). My main issue is that none of the typical intellisense features seems to work with this module.
I'm guessing it might have something to do with it being a C…

Miguel
- 1,293
- 1
- 13
- 30