Questions tagged [petsc]

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.

145 questions
2
votes
1 answer

The same named entity in PETSc and MPI - conflict

I have an existing Fortran code using MPI for parallel work. I am interested in adding some of the PETSc solvers (KSP specifically), however when including the relevant .h or .h90 files (petsc, petscsys, petscksp, etc...) I get a problem with…
2
votes
2 answers

what is the role of the comma in below statements?

Currently reading into PETSc when I came up to this syntax in C/C++: PetscInt i, n = 10, col[3], its; PetscScalar neg_one = -1.0, one = 1.0, value[3]; I do not understand the meaning of the commas here. Has it to do with tuples? Or is there…
Michael
  • 7,407
  • 8
  • 41
  • 84
2
votes
1 answer

How to construct petsc matrices?

I'm using petsc4py and now face some problems. I have a number of small petsc dense matrices mij, and I want to construct them to a big matrix M like this: [ m11 m12 m13 ] M = | m21 m22 m23 | , [ m31 m32 m33 ] A mcve code…
Ji Zhang
  • 128
  • 1
  • 11
2
votes
1 answer

PETSC DMDA vec values are assigned to wrang place

I recently started learning PETSc and encountered a problem while trying to accomplish some simple task. What is wrong with this code: static char help[] = "Test 2d DMDAs Vecs.\n\n"; #include #include #include…
avb1003
  • 251
  • 2
  • 7
2
votes
1 answer

How do I fix version error when installing petsc4py for use in openmdao

I am trying to install petsc4py with direction found on the Python website but I am getting an error. How do I fix this cant find correct version error? My overall goal is to be able to use openMDAO but I need to start with getting petsc4py…
CodeGuyRoss
  • 786
  • 1
  • 10
  • 23
2
votes
1 answer

Why Valgrind reports an invalid write of size 8 on the assignment of a char* in PETSc?

I have a bad termination of my application in PETSc. I have checked what is going on with Valgrind, but I don't understand its report: ==97331== Invalid write of size 8 ==97331== at 0x10007FED5: PetscHeaderCreate_Private (inherit.c:40) ==97331==…
guhur
  • 2,500
  • 1
  • 23
  • 33
2
votes
2 answers

GHCi linker error with FFI-imported MPI constants (via c2hs)

I'm figuring out how haskell-mpi works by rewriting the binding. I'm trying to re-use the MPICH installation that was set up by installing PETSc (which is working fine). Question: make main gives me a correct module in GHCi, but when I request to…
ocramz
  • 816
  • 6
  • 18
2
votes
1 answer

petsc4py: Creating AIJ Matrix from csc_matrix results in TypeError

I am trying to create a petsc-matrix form an already existing csc-matrix. With this in mind I created the following example code: import numpy as np import scipy.sparse as sp import math as math from petsc4py import PETSc n=100 A =…
2
votes
1 answer

PETSc - MatMultScale? Matrix X vector X scalar

I'm using PETSc and I wanted to do something like, I know I can do: Mat A Vec x,y MatMult(A,x,y) VecScale(y,0.5) I was just curious if there is a function that would do all of these in one shot. It seems like it would save a…
Miguel
  • 1,293
  • 1
  • 13
  • 30
2
votes
0 answers

Domain Decomposition with PETSc

Does anyone have any experience on Domain Decomposition using PETSc library? I have used PETSc for creating my vectors and matrix within my c++ code. I also used KSP to solve the linear system. I used follwoing examples tp learn about DD in PETSc…
Nazi
  • 67
  • 1
  • 7
2
votes
1 answer

Problems when linking a PETSc program when using CMake

I'm on Ubuntu 13.04 64-bit and I'm attempting to build a "Hello world" program in PETSc using CMake. I have the following program solve1.c (loosely based on ex1.c from the PETSc examples), which solves a simple system of linear equations: /* minimal…
rettvest
  • 1,237
  • 1
  • 12
  • 16
2
votes
2 answers

Solving the Poisson equation on multiple GPUs located on different cluster nodes interacting by the MPI protocol

I'm trying to solve the Poisson equation in real space on a multi GPUs architecture using a code in C/CUDA with the MPI library. For the moment, I'm only interested in solving the problem in a periodic box. But in the future, I may want to look at…
Alex
  • 160
  • 11
2
votes
2 answers

Graceful way to check if a PETSc vector/matrix has been destroyed?

For a unit test, I'm trying to make sure that a PETSc vector has been destroy. However, I can't seem to find an adequate command that does this gracefully. The best I've been able to do is call VecSetType(...) and look at the error. However, this…
1
vote
0 answers

PETSc: OMP+MKL in MatShell

I am trying to use a custom matvec operator with PETSc MatShell in Fortran and inside of it, I want to use a mix of OpenMP and MKL multithreading (blas). The OpenMP and MKL threads are indeed launched, but htop shows that only the OpenMP threads…
Astor
  • 288
  • 1
  • 7
1
vote
1 answer

Thetis example North Sea AttributeError: 'VectorElement' object has no attribute '__dict__'

I have tried to fix this error for quiet some time but can't find how to fix it. Is there someone who could help me out? It is an error when running the nort sea 2d model from thetis. [https://thetisproject.org/demos/demo_2d_north_sea.py.html…
S_bolh
  • 11
  • 1
1
2
3
9 10