Computational Science Stack Exchange is a question and answer site for scientists using computers to solve scientific problems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've made a matrix, and now I want to draw it on the screen to make a basic check of correctness. The documentation for MatAssemblyEnd() states that I can pass an option to do this:

-mat_view_draw - PetscDraws nonzero structure of matrix, using MatView() and PetscDrawOpenX().

But when I run my program with this option, I get the following error:

[0]PETSC ERROR: --------------------- Error Message ------------------------------------
[0]PETSC ERROR: No support for this operation for this object type!
[0]PETSC ERROR: Viewer type draw not supported!
[0]PETSC ERROR: ------------------------------------------------------------------------

Does PETSc still support drawing to X terminals? Or is this just an indication of a bug somewhere in my code?

share|improve this question
up vote 3 down vote accepted

Configure probably did not find X11. You can check whether it was found using

$ grep '\<PETSC_HAVE_X\>' $PETSC_DIR/$PETSC_ARCH/include/petscconf.h 
#ifndef PETSC_HAVE_X
#define PETSC_HAVE_X 1

If you don't see PETSC_HAVE_X defined, try reconfiguring --with-x (perhaps with a path, see ./configure --help for details on what to specify).

share|improve this answer
I don't get PETSC_HAVE_X, but I do see #ifndef PETSC_HAVE_X11 #define PETSC_HAVE_X11 1. Should that also work? – Dan Apr 11 '12 at 23:47
Yeah, the macro depends on the version of PETSc. What matrix type are you using? – Jed Brown Apr 11 '12 at 23:52
I'm using SEQAIJ. And the version of PETSc I'm using is 3.2. – Dan Apr 12 '12 at 5:30
Send the full error message to – Jed Brown Apr 12 '12 at 13:33
I checked the configuration options, and --with-x isn't in there. I think that's probably the problem. – Dan Apr 16 '12 at 16:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.