147 questions
0
votes
0
answers
114
views
Structured grid with irregular shape in PETSc (DM context)
I have a finite diference problem in structured grid in PETSc, and DM context helps me to create the matrix really easy, DM give me a whole matrix of rectangular domain that is good to me because I'm ...
0
votes
1
answer
168
views
Build PETSc matrix with ghost line?
I know PETSc allows its vectors to carry ghost values thanks to VecCreateGhost() or VecMPISetGhost()functions.
Does anyone know if there is similar functions to create a matrix with ghost lines ?
...
5
votes
2
answers
19k
views
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 ...
0
votes
0
answers
292
views
How to convert pyop2.petsc_base.Mat matrix to any of scipy\numpy sparse formats?
Say I have a matrix M:
>>> print type(M)
<class 'pyop2.petsc_base.Mat'>
>>> dir(M)
['Snapshot', '_Assembly', '_Versioned__version', '__call__', '__class__', '__delattr__', '...
0
votes
0
answers
197
views
PETSC. Run program without using mpiexec
How i can run program, that writen using PETSC, in multiple threads without ./mpiexec -n <>?
Maybe i need init MPI separately? Can u get reference to example how init MPI with PetscInitialize()...
1
vote
1
answer
699
views
PETSC 3.3 - How to compile and have all libpetscSOMETHING.so files?
I tried to compile PESTC using this configuration:
./configure --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --download-f-blas-lapack=1 --download-openmpi --with-shared-libraries
make PETSC_DIR=/...
1
vote
1
answer
203
views
PETSC_VIEWER_DRAW_WORLD shows nothing
I just started with PETSC and I'm trying to plot a matrix using matView. My code is like:
MatCreateSeqAIJWithArrays(PETSC_COMM_WORLD, nodes, nodes, rows, cols, values, net); //I want to visualize "...
0
votes
1
answer
74
views
Segfault with operator() for KiFMM when using MPI
I am using KiFMM and PETSc for my code. It had no problems for the serial version, but when I am trying to use MPI with 2 nodes I am now getting an error at (*trgPos)(j,i), which is of type DblNumMat ...
0
votes
1
answer
62
views
type of expanded C macro
What type and value does PETSC_COMM_WORLD in the following header expand to?
Is it just a redefinition for MPI_Comm with extern scope?
#define PETSC_EXTERN extern PETSC_VISIBILITY_PUBLIC
...
0
votes
0
answers
80
views
PETSc C macro within struct
In PETSc, a number of common-use structures such as Vec, Mat, IS, etc. are defined similarly, as in the 4 snippets below.
Questions:
when and how is PETSCHEADER expanded? I am writing the foreign ...
1
vote
2
answers
2k
views
PETSC Build Error : C compiler does not work
I am trying to install PETSc on Cygwin terminal by invoking following command..
./configure --with-cc='win32fe cl' --with-fc='win32fe ifort' --with-cxx='win32fe cl' --download-fblaslapack
and
/...
0
votes
1
answer
883
views
Unable to generate makefile for basic PETSc program
I have a very basic program using PETSC
#include "PETSC/petsc.h"
#include "PETSC/petscsys.h"
#include "PETSC/petscmat.h"
int main(int argc, char *argv[]) {
PetscMPIInt rank,size;
...
2
votes
2
answers
117
views
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 ...
3
votes
2
answers
238
views
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:
...
2
votes
1
answer
2k
views
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 ...
0
votes
1
answer
113
views
PETSc error for mpicc
I am using a code in C for hydro simulations with radiative transfer. There is need for PETSc, which I got compiled on my local machine. But on compiling my code I get the error message: error: ’...
4
votes
1
answer
202
views
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 ...
0
votes
1
answer
113
views
Replace whole row using MatSetValuesStencil with INSERT_VALUES
I am using Petsc Ksp routines.
I construct an operator using MatSetValuesStencil, where in each call of this function I specify one row matrix values of length 5.
There is a case where I sometimes ...
0
votes
1
answer
520
views
Load matrix from file with use of Octave C++ API
Is it possible to load the matrix in PETSc binary format from external file at runtime with use of Octave C++ API? I've found the Doxygen documentation, but I can't find anything useful among so many ...
1
vote
1
answer
406
views
Using fp_trap to find cause of floating point exceptions in PETSc?
I'm not sure if this question belongs here or not. But I am having a problem with my code with PETSc saying that there is a floating point error. It is similar to the problem discussed in the links ...
0
votes
0
answers
988
views
Error installing petsc with homebrew
I tried installing petsc with homebrew on OSX 10.10.1 with:
$brew install petsc
I get one error installing one dependency:
==> Installing petsc dependency: hypre
==> Using Homebrew-provided ...
0
votes
0
answers
717
views
pseudo-arc length continuation petsc4py
I have been a user of pseudo arc-length continuation, nonlinear solvers... in Trilinos LOCA (c++) for years but I recently come across the python package petsc4py. This simplified a lot my programming ...
2
votes
1
answer
358
views
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 ...
0
votes
2
answers
1k
views
PETSc - MatLUFactor - No support for this operation for this object type
I'm trying to program LU decomposition app in PETSc. My idea was, that the program will print the unfactorized matrix, then the factorized matrix and count time taken by a factorization itself.
I've ...
2
votes
0
answers
597
views
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 ...
1
vote
1
answer
4k
views
PETSc undefined reference
I have a pretty beginners' question, but I'm really lost now. I'm beginning with PETSc, but I have problems with compilation of my code. I'm trying to use my own Makefile, but compiler keeps yelling "...
5
votes
2
answers
1k
views
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 ...
1
vote
0
answers
134
views
Petsc Mex file crashes
I have a working code that solves a certain problem by using KSPSolve from Petsc (using gmres solver with ilu pre-conditioner).
I wanted to call this code from MATLAB so I coded a mex-file.
However, ...
0
votes
1
answer
252
views
Using MPI to distribute the job between the processors but all the processors are doing the whole job instead of doing just some part of it
I have a c++ code that can be run in parallel but with shared memory methods. I linked the code to PETSc and PETSc is able to run the code in parallel but with distributed memory method. When I run ...
1
vote
0
answers
59
views
Inserting -nan+iG at matrix entry using SLEPc
I got a "Inserting -nan+iG error" at function MatSetValues.
My code goes like this:
I first use code below to change a double into PETScScalar (I am using Complex version).
for(i=0;i<nz;i++)temp[...
0
votes
1
answer
271
views
Substituting user-defined matrices into PETSc matrices
I have sequential block AIJ matrices which are written in c++ and I am going to use PETSc to create MPI matrices. So, I have to substitute my sparse block AIJ matrices into MPI block AIJ PETSc ...
0
votes
1
answer
979
views
using PETSc in gfortran, but it didn't compile
I want to test and use PESTc in fortran, so I wrote something very simple and null like (petscexe.F):
PROGRAM petscexe
INCLUDE 'petscsys.h'
END PROGRAM petscexe
to see if the header file can ...
3
votes
1
answer
186
views
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 / ...
3
votes
4
answers
5k
views
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 ...
0
votes
1
answer
659
views
generating petsc binary file using python
I am trying to create a PETSC binary file using python. I try to run the script on bash shell but I get an error
$ python -c 'print file.shape\n import sys,os\n sys.path.append(os.path.join(os....
0
votes
1
answer
645
views
creal and cimag problems with Clang 3.4
I am compiling a library with Petsc using Clang 3.4 and get:
error: use of undeclared identifier 'creal'
it follows from the following define:
petscmath.h:121:38: note: expanded from macro '...
0
votes
1
answer
1k
views
Howto enable stronger optimization builds
I am trying to build PETSc and have problems to enable optimization. Without specifying, PETSc always creates a debugging build, but I can turn that off with passing --with-debugging=0 to cmake. ...
0
votes
2
answers
214
views
C and MPI: function works differently with same data
I have successfully wrote a complicate function with PETSc library (it's a MPI-based scientific library for parallel solving huge linear systems). This library provides its own "malloc" version and ...
2
votes
1
answer
3k
views
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 ...
2
votes
2
answers
1k
views
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 ...
0
votes
3
answers
1k
views
easy petsc function call in a class
The following question might be easy to answer, but I did not find any solution in the Internet. To put it in a nutshell, I put some petsc function calls in a class.
The following equation solver ...
10
votes
1
answer
4k
views
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 ...
1
vote
0
answers
111
views
PETSc PF objects and user defined functions
Presently I am working with a large PETSc program which needs to be modular. I need to use PF objects in PETSc (at least I guess so as I need to pass functions as arguments with enough flexibility ...
2
votes
2
answers
415
views
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 ...
3
votes
3
answers
7k
views
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='...
6
votes
1
answer
5k
views
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, ...
0
votes
2
answers
9k
views
Difference between "ASCII" and "Binary" formats in PETSc
I wanted to know what the difference is between binary format and ASCII format. The thing is I need to use PETSc to do some matrix manipulations and all my matrices are stored in text files.
PETSc ...