<div dir="ltr">Thanks, I have the rosenbrock1f.F90 example compiling and running now with both 3.7 and 3.8. Transferring this setup knowledge to my codebase, I ran into a problem, since I setup my module a little differently than the rosenbrock1f example. In the specification part of the module, I put a Tao object, e.g using the rosebrock1f as an example I do:<div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><br></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>#include <petsc/finclude/petscdef.h></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>module commondat</div><div>PetscReal :: alpha</div><div>PetscInt :: n</div><div>Tao :: taotest</div><div>end module commondat</div></blockquote></div><div><br></div><div>The compiler throws errors on this however. :</div><div><div>commondat.F90(22): error #5082: Syntax error, found '::' when expecting one of: => = . [ % ( :</div><div>      Tao :: taotest</div><div>----------^</div><div>commondat.F90(22): error #6274: This statement must not appear in the specification part of a module.</div><div>      Tao :: taotest</div><div>------^</div><div>commondat.F90(22): error #6793: The POINTER attribute is required.   [TAO]</div><div>      Tao :: taotest</div><div>------^</div></div><div><br></div><div>What is the right way to use this? Do I have to define a type within the module for the Tao object to be in? Or is this an issue in 3.7 when using only the petscdef.h instead of petsc.h?</div><div><br></div><div>And thanks for the advice on moving to Petsc 3.8, we work with some Petsc people, who know our code base, so will discuss with them on working towards that.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 6, 2017 at 5:59 PM, 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On Oct 6, 2017, at 11:18 PM, Randy Michael Churchill <<a href="mailto:rchurchi@pppl.gov">rchurchi@pppl.gov</a>> wrote:<br>
><br>
> 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?<br>
<br>
</span>  You should really pus this "existing, larger codebase" to transition to PETSc 3.8 sooner, rather than later. Especially for developments in Fortran it will make life better for everyone. We are always willing to help users, once they have read the changes information, with information to make transitioning to the latest PETSc version easy. For any parts of the code in C, transitioning from 3.7 to 3.8 should be really simple.<br>
<span class="HOEnZb"><font color="#888888"><br>
   Barry<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
><br>
> 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.<br>
><br>
> I built v3.8 from source, and the petsctao module is in the library file, and now the make works.<br>
><br>
> commondat.F90<br>
> module commondat<br>
> #include <petsc/finclude/petscdef.h><br>
>       use petsc<br>
>       PetscReal    ::    alpha<br>
>       PetscInt     ::    n<br>
> end module commondat<br>
><br>
> program rosenbrock1f<br>
> #include <petsc/finclude/petsctaodef.h><br>
>       use petsctao<br>
>       use commondat<br>
><br>
><br>
><br>
><br>
> On Fri, Oct 6, 2017 at 7:54 AM, Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>> wrote:<br>
> On Fri, Oct 6, 2017 at 7:36 AM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br>
><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>
><br>
> <a href="http://www.mcs.anl.gov/petsc/petsc-master/docs/manualpages/Sys/UsingFortran.html" rel="noreferrer" target="_blank">http://www.mcs.anl.gov/petsc/<wbr>petsc-master/docs/manualpages/<wbr>Sys/UsingFortran.html</a><br>
><br>
>    Matt<br>
><br>
><br>
>    Barry<br>
><br>
><br>
> > On Oct 5, 2017, at 11:48 PM, Randy Michael Churchill <<a href="mailto:rchurchi@pppl.gov">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/<wbr>petsc/petsc-dev/src/tao/<wbr>unconstrained/examples/<wbr>tutorials/rosenbrock1f.F90.<wbr>html</a>)<br>
><br>
><br>
><br>
><br>
> --<br>
> 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<br>
><br>
> <a href="https://www.cse.buffalo.edu/~knepley/" rel="noreferrer" target="_blank">https://www.cse.buffalo.edu/~<wbr>knepley/</a><br>
><br>
><br>
><br>
> --<br>
> R. Michael Churchill<br>
<br>
</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>