[petsc-users] cannot open source file "petsc.h"

Evstafyeva,Tamara te307 at cam.ac.uk
Fri Feb 4 05:11:37 CST 2022


Hi all again,

Thanks again for your help and very quick replies. I managed to fix it at the end – unfortunately I cannot exactly pin-point what went wrong as I was trying different things until they worked – not very scientific of me xD. But the steps were as follows, I am not sure if this will be useful at all, but here it is anyway,


  1.  Based on our emails, I decided to specify the same cxx, cc, fc flags for PETSC when configuring it as in the Chombo’s Make.defs.local file (the file we use to compile the Chombo library). For example, in my case I had to use COPTFLAGS="-O3 -xCOMMON-AVX512" CXXOPTFLAGS="-O3 -xCOMMON-AVX512" as per the flags I use to compile Chombo. And of course, one has to use -lpetsc in syslibflags.


  1.  Then I created a module-file to set my environment variables, like this



#%Module



set PETSC_DIR "$::env(HOME)/petsc"

set PETSC_ARCH "arch-linux-c-debug"

prepend-path LD_LIBRARY_PATH "$PETSC_DIR/$PETSC_ARCH/lib"

prepend-path LIBRARY_PATH "$PETSC_DIR/$PETSC_ARCH/lib"

prepend-path CPATH "$PETSC_DIR/include:$PETSC_DIR/$PETSC_ARCH/include"

prepend-path PKG_CONFIG_PATH "$PETSC_DIR/$PETSC_ARCH/lib/pkgconfig"

prepend-path CMAKE_PREFIX_PATH "$PETSC_DIR/$PETSC_ARCH/"

setenv PETSC_DIR $PETSC_DIR

setenv PETSC_ARCH $PETSC_ARCH



  1.  Loading module, and compiling everything magically got rid off the error.

Best,

Tamara


From: Mark Adams <mfadams at lbl.gov>
Date: Friday, 4 February 2022, 03:35
To: Jed Brown <jed at jedbrown.org>
Cc: Evstafyeva,Tamara <te307 at cam.ac.uk>, petsc-users <petsc-users at mcs.anl.gov>
Subject: Re: [petsc-users] cannot open source file "petsc.h"


On Thu, Feb 3, 2022 at 6:12 PM Jed Brown <jed at jedbrown.org<mailto:jed at jedbrown.org>> wrote:
"Evstafyeva,Tamara" <te307 at cam.ac.uk<mailto:te307 at cam.ac.uk>> writes:

> Thanks for your prompt reply. I am attaching the makefile; the line for execution “make all -j 4”
>
> I guess using both was my attempt at trying multiple things until they work – using either one or the other produced the same error for me.

petsc.pc isn't being used here. What's probably happening is that Chombo's mk/Make.test has rules (not just variables) and those rules are replacing PETSc rules. Mark Adams (Cc'd) works with Chombo and will know for sure.

It seems like you are trying to build a makefile system for Chombo, with PETSc, from scratch. I think you want to go through Chombo. They have worked out makefiles with PETSc and we don't want to try to recreate that.
It appears that you did not find any instructions on building Chombo with PETSc, including example makefiles. They exist, but I don't know anything about the Chombo distribution and support.
I would contact Chombo and see if they can help you.

I wish I could be of more help,
Good luck,
Mark


I'm mildly afraid of Chombo and would use Makefile.user to extract exactly the information you want from PETSc.

Alternatively, include only ${PETSC_DIR}/lib/petsc/conf/variables from PETSc and append the variables as needed to Chombo. The downside of this is that some variables are not namespaced so there could be conflicts depending on Chombo's naming conventions.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220204/1ec7bdf5/attachment.html>


More information about the petsc-users mailing list