[petsc-users] calling PETSc from C++

Matthew Knepley knepley at gmail.com
Mon Mar 12 16:52:05 CDT 2012


On Mon, Mar 12, 2012 at 4:49 PM, Francis Poulin <fpoulin at uwaterloo.ca>wrote:

> Hello,
>
> Yes my examples work fine.   I have looked in the makefile for the
> examples and it looks fairly complicated.  One thing I noticed is that I
> wasn't  using the mpicc that is in my petsc directory.  I went back and
> made sure that I am using the mpicc that was build by PETSc.  That changes
> things, but now I cannot compile the code whereas before I could.
>
> Do you have a suggestion as to how I can most easily adapt the makefile
> from the examples into the code we are building?
>

The makefiles are simple. Here is building an executable:

myProg: myProg.o otherSource.o anotherSource.o
       ${CLINKER} -o myProg ${PETSC_TS_LIB}


   Matt


> Thanks for the help,
> Francis
>
> On 2012-03-12, at 4:41 PM, Jed Brown wrote:
>
> On Mon, Mar 12, 2012 at 15:37, Francis Poulin <fpoulin at uwaterloo.ca>wrote:
>
>> I am trying to call Petsc from a C++ program and having difficulties.
>>  I'm using v3.2.6 and I can run all the examples so I assumed that
>> everything was installed ok.  The body of the function is very simple, see
>> below.  I get a segmentation fault.   In my installation I used mpich
>>
>> I have a colleague who also installed openmp and this works for him on
>> the same version of Petsc.  Could it be that Petsc is confused because I
>> have two different MPI's installed?  I am hoping that it will use the one
>> that it configured but I do have the other MPI in the same path.
>>
>
> Yes, the most likely scenario is that your application was linked with a
> different MPI than PETSc was compiled with. It is probably a makefile that
> uses the wrong MPI. Can you build PETSc examples?
>
>
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120312/46913efb/attachment.htm>


More information about the petsc-users mailing list