Ask help for PETSc

Chen, Changjun cjchen at
Mon Sep 15 16:20:55 CDT 2008

Dear Satish:
    I have tried to rebuild the PETSc with option --with-shared=1, it works!  The executable file reduces to less than 1 MB.
Thank you very much!

From: owner-petsc-users at [owner-petsc-users at] On Behalf Of Satish Balay [balay at]
Sent: Monday, September 15, 2008 3:30 PM
To: petsc-users at
Subject: Re: Ask help for PETSc

On Mon, 15 Sep 2008, Chen, Changjun wrote:

> Hi Sir,

> My name is Changjun Chen. I am a postdoc in Michigan State
> University. Recently I use your perfect software PETSc. It is very
> good. But I still have one problem. I need your help.

> It is about the size of final executable. When I compile it, it is
> over 60 MB. This is too large. Maybe it have all the linear equation
> solvers.  but among them, I only need one method, for example JACOBI
> method, I do not need others.  So how could I compile the codes that
> only contains this method?  Thanks

You might have to replace the code in PCRegisterAll() to include only
1 PC type to do this. [similar change to other register routines.]

However the whole goal of PETSc is to provide easy experimentation of
various solvers at runtime.

The primary reason the executable is huge is probably due to debug
symbols. To verify - you can run 'strip' on the executable.

Another thing you can do is build with the option
'--with-shared=1'. This would leave most of the PETSc compiled in
shared libraries - thus keeping the application executable very small.


More information about the petsc-users mailing list