<div dir="ltr">So if I'm limited to petsc 3.7.6 for reasons of eventually using within an existing, larger codebase that depends on 3.7.6, is it possible to use TAO with a user-defined module in Fortran90 using 3.7.6?<div><br></div><div>I had tried the various forms of includes listed in the documentation, e.g. see below. I think I now realize this is an issue with the petsc installation on Edison, it does not seem to have the petsctao module in the library file (confirmed using nm -D on the library file). If I do the same include and use statement but with, for example, petscmat, it compiles fine. </div><div><br></div><div>I built v3.8 from source, and the petsctao module is in the library file, and now the make works. </div><div><br></div><div>commondat.F90</div><div>module commondat</div><div>#include <petsc/finclude/petscdef.h><br></div><div> use petsc</div><div><div style="font-size:12.8px"> PetscReal :: alpha</div><div style="font-size:12.8px"> PetscInt :: n</div><div style="font-size:12.8px">end module commondat</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">program <span style="font-size:12.8px">rosenbrock1f</span></div><div style="font-size:12.8px"><span style="font-size:small">#include <petsc/finclude/petsctaodef.h></span><br></div><div style="font-size:12.8px"><span style="font-size:small"> use petsctao</span></div><div style="font-size:12.8px"><span style="font-size:small"> </span><span style="font-size:12.8px">use commondat</span></div><div><br></div><div><br></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 6, 2017 at 7:54 AM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Fri, Oct 6, 2017 at 7:36 AM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Randy,<br>
<br>
First you absolutely must use version 3.8 or the master development copy. We improved and simplified dramatically how Fortran (90) is utilized from PETSc.<br>
<br>
Note that there is only one simple set of include files and modules for Fortran; see the newest documentation.<br><br></blockquote><div><br></div></span><div><a href="http://www.mcs.anl.gov/petsc/petsc-master/docs/manualpages/Sys/UsingFortran.html" target="_blank">http://www.mcs.anl.gov/petsc/<wbr>petsc-master/docs/manualpages/<wbr>Sys/UsingFortran.html</a><br></div><div><br></div><div> Matt</div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Barry<br>
<br>
<br>
> On Oct 5, 2017, at 11:48 PM, Randy Michael Churchill <<a href="mailto:rchurchi@pppl.gov" target="_blank">rchurchi@pppl.gov</a>> wrote:<br>
><br>
> A simple setup question with TAO: if I were to convert the rosenbrock1f.F90 example to use a module instead of common structures, how would I setup the include statements? I've tried various combinations (using petscXXXdef.h, petscXXX.h, petscXXX.h90, along with use petscXXX), but seem to get errors with all.<br>
><br>
> file:rosenbrock1f.h:<br>
> module commondat<br>
> PetscReal :: alpha<br>
> PetscInt :: n<br>
> end module commondat<br>
><br>
> file:rosenbrock1f.90:<br>
> program rosenbrock1f<br>
> !!include statements??? which and where???!!!<br>
> use commondat<br>
> ...<br>
><br>
> subroutine FormFunctionGradient(tao, X, f, G, dummy, ierr)<br>
> use commondat<br>
> implicit none<br>
> ...<br>
><br>
> (<a href="https://www.mcs.anl.gov/petsc/petsc-dev/src/tao/unconstrained/examples/tutorials/rosenbrock1f.F90.html" rel="noreferrer" target="_blank">https://www.mcs.anl.gov/petsc<wbr>/petsc-dev/src/tao/unconstrain<wbr>ed/examples/tutorials/<wbr>rosenbrock1f.F90.html</a>)<br>
<br>
</blockquote></span></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div class="m_4167366704723114707gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.caam.rice.edu/~mk51/" target="_blank">https://www.cse.buffalo.edu/~<wbr>knepley/</a><br></div></div></div></div></div>
</font></span></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">R. Michael Churchill</div></div>
</div>