<html><head><meta http-equiv="content-type" content="text/html; charset=us-ascii"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div><br></div> Please send your attempted makefile and we'll see if we can get it working.<div><br></div><div> I am not sure if we can organize the include files as Fortran compiler include files easily. We've always used the preprocessor approach. The Intel compiler docs indicate the procedure for finding the Fortran compiler include files <a href="https://www.intel.com/content/www/us/en/develop/documentation/fortran-compiler-oneapi-dev-guide-and-reference/top/program-structure/use-include-files.html">https://www.intel.com/content/www/us/en/develop/documentation/fortran-compiler-oneapi-dev-guide-and-reference/top/program-structure/use-include-files.html</a> is the same as for the preprocessor include files so I don't understand how the using the Fortran compiler include file approach would make the makefiles any simpler for users?</div><div><br></div><div><div><br></div><div> Barry</div><div><br><div><br><blockquote type="cite"><div>On Nov 3, 2022, at 8:58 PM, Jianbo Long <longtuteng249@gmail.com> wrote:</div><br class="Apple-interchange-newline"><div><div dir="ltr"><div class="gmail_default" style="font-size:large">Hello,</div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large">I'm struggling to make my FORTRAN code work with petsc as I cannot link the required header files (e.g., petscksp.h) and compiled library files to my FORTRAN code. </div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large">Compiling petsc was not a problem. However, even with the fortran examples (see those on <a href="https://petsc.org/main/docs/manual/fortran/">https://petsc.org/main/docs/manual/fortran/</a>) and the guide on using petsc in c++ and fortran codes (see Section "Writing C/C++ or Fortran Applications" at <a href="https://petsc.org/main/docs/manual/getting_started/">https://petsc.org/main/docs/manual/getting_started/</a>), I still cannot make my FORTRAN code work. </div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large">The Fortran test code is exactly the example code ex83f.F90 (see attached files). Aftering following the 2nd method in the Guide (see the picture below), I still get errors:</div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large">petsc/finclude/petscksp.h: No such file or directory<br></div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large">Even if I set up the path of the header file correctly in my own makefile without using environment variables, I still can only find the file "petscksp.h" for my code. Of course, the trouble is that all other headers files required by KSP are recursively included in this petscksp.h file, and I have no way to link them together for my Fortran code. </div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large">So, here are my questions:</div><div class="gmail_default" style="font-size:large">1) in the Guide, how exactly are we supposed to set up the environment variables PETSC_DIR and PETSC_ARCH ? More details and examples would be extremely helpful !</div><div class="gmail_default" style="font-size:large">2) Is there a way to get rid of the <b>preprocessor</b> statement </div><div class="gmail_default" style="font-size:large"><div class="gmail_default"> <span style="font-size:small">#include <petsc/finclude/petscvec.h></span></div></div><div class="gmail_default" style="font-size:large">when using c++/Fortran codes ?<br></div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large">For example, when using MUMPS package in a Fortran code, we can simply use <b>compiler</b> 'include', rather than a preprocessor, to extract all required variables for the user's codes :</div><div class="gmail_default" style="font-size:large"> INCLUDE 'zmumps_struc.h'</div><div class="gmail_default" style="font-size:large">where the header file zmumps_struc.h is already provided in the package. Similarly, I think it's much more portable and easier when using petsc in other codes if we can make it work to use petsc. </div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large">(Note: similar issues were discussed before, see <a href="https://lists.mcs.anl.gov/mailman/htdig/petsc-users/2019-January/037499.html">https://lists.mcs.anl.gov/mailman/htdig/petsc-users/2019-January/037499.html</a>. Unfortunately, I have no clue about the solution archived there ...)</div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large">Any thoughts and solutions would be much appreciated !</div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large">Thanks,</div><div class="gmail_default" style="font-size:large">Jianbo Long</div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large"><span id="cid:ii_la1rc4d71"><image.png></span><br></div></div>
<span id="cid:f_la1r9ud30"><ex83f.F90></span></div></blockquote></div><br></div></div></body></html>