<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Apr 25, 2014 at 9:45 AM, Steve Ndengue <span dir="ltr"><<a href="mailto:steve.ndengue@gmail.com" target="_blank">steve.ndengue@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 bgcolor="#FFCC99" text="#000099">
    <div><font size="-1">Dear all, <br>
        <br>
        Sorry, I had a typo: I was still editing the .f90 program file
        instead of the .F90 file.<br>
        <br>
        However, now I am having troubles forming the matrice I would
        like to diagonalize.<br>
        Presently the size is not yet huge and it could be held in a
        previously computed matrix of dimension N*N.<br>
        <br>
        I am using the following to build the matrix and the compiling
        from the example 1 and slightly modified:<br>
        <br>
        ***<br>
        <i>!</i><i><br>
        </i><i>        CALL SlepcInitialize(PETSC_NULL_CHARACTER,ierr)</i><i><br>
        </i><i>        CALL MPI_Comm_rank(PETSC_COMM_WORLD,rank,ierr)</i><i><br>
        </i><i>        nn = N</i><i><br>
        </i><i>!        CALL
          PetscOptionsGetInt(PETSC_NULL_CHARACTER,'-n',n,flg,ierr)</i><i><br>
        </i><i>!</i><i><br>
        </i><i></i><i><br>
        </i><i>!</i><i><br>
        </i><i>! - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          - - - - - - - - </i><i><br>
        </i><i>!     Compute the operator matrix that defines the
          eigensystem, Ax=kx</i><i><br>
        </i><i>! - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          - - - - - - - - </i><i><br>
        </i><i><br>
        </i><i>      call MatCreate(PETSC_COMM_WORLD,A,ierr)</i><i><br>
        </i><i>      call
          MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,nn,nn,ierr)</i><i><br>
        </i><i>      call MatSetFromOptions(A,ierr)</i><i><br>
        </i><i>      call MatSetUp(A,ierr)</i><i><br>
        </i><i><br>
        </i><i>      call MatGetOwnershipRange(A,Istart,Iend,ierr)</i><i><br>
        </i><i>      do i=Istart,Iend-1</i><i><br>
        </i><i>      do j=0,nn-1</i><i><br>
        </i><i>      call
          MatSetValue(A,i,-1,j,-1,H_mat(i,j),INSERT_VALUES,ierr)</i><i><br>
        </i><i>      enddo</i><i><br>
        </i><i>      enddo</i><i><br>
        </i><i>      call MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY,ierr)</i><i><br>
        </i><i>      call MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY,ierr)!    
          ** Create eigensolver context</i><i><br>
        </i><i>      CALL EPSCreate(PETSC_COMM_WORLD,solver,ierr)</i><i><br>
        </i><i>!</i><i>     ** Set operators. In this case, it is a
          standard eigenvalue problem</i><i><br>
        </i><i>      CALL
          EPSSetOperators(solver,A,PETSC_NULL_OBJECT,ierr)</i><i><br>
        </i><i>print*,'here10,ierr',ierr</i><i><br>
        </i><i>      CALL EPSSetProblemType(solver,EPS_HEP,ierr)</i><i><br>
        </i><i>!     ** Set working dimensions</i><i><br>
        </i><i>      CALL
          EPSSETDimensions(solver,nstates,10*nstates,2*nstates)</i><i><br>
        </i><i>!     ** Set calculation of lowest eigenvalues</i><i><br>
        </i><i>      CALL
          EPSSetWhichEigenpairs(solver,EPS_SMALLEST_REAL)</i><i><br>
        </i><i><br>
        </i><i>!     ** Set solver parameters at runtime</i><i><br>
        </i><i>      CALL EPSSetFromOptions(solver,ierr)</i><i><br>
        </i><i>! - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          - - - - - - - - </i><i><br>
        </i><i>!     Solve the eigensystem</i><i><br>
        </i><i>! - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          - - - - - - - - </i><i><br>
        </i><i>      CALL EPSSolve(solver,ierr)</i><i><br>
        </i><i>print*,'here6'</i><i><br>
        </i><i>!     ** Optional: Get some information from the solver
          and display it</i><i><br>
        </i><i>      CALL EPSGetType(solver,tname,ierr)</i><i><br>
        </i><i>      if (rank .eq. 0) then</i><i><br>
        </i><i>        write(*,120) tname</i><i><br>
        </i><i>      endif</i><i><br>
        </i><i> 120  format (' Solution method: ',A)</i><i><br>
        </i><i>      CALL
          EPSGetDimensions(solver,nstates,PETSC_NULL_INTEGER,             
          &</i><i><br>
        </i><i>     &                      PETSC_NULL_INTEGER,ierr)</i><i><br>
        </i><i>      if (rank .eq. 0) then</i><i><br>
        </i><i>        write(*,130) nstates</i><i><br>
        </i><i>      endif</i><i><br>
        </i><i> 130  format (' Number of requested eigenvalues:',I4)</i><i><br>
        </i><i>! - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          - - - - - - - - </i><i><br>
        </i><i>!     Display solution and clean up</i><i><br>
        </i><i>! - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          - - - - - - - - </i><i><br>
        </i><i>      CALL
          EPSPrintSolution(solver,PETSC_NULL_OBJECT,ierr)</i><i><br>
        </i><i>      CALL EPSDestroy(solver,ierr)</i><i><br>
        </i><i>***</i><br>
        <br>
        I get the following error message when making the code:<br></font></div></div></blockquote><div><br></div><div>Run in the debugger, -start_in_debugger, and get a stack trace for the error.</div><div><br></div><div>
  Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFCC99" text="#000099"><div><font size="-1">
        ***<br>
        <i><b>[0]PETSC ERROR:
            ------------------------------------------------------------------------</b></i><i><b><br>
          </b></i><i><b>[0]PETSC ERROR: Caught signal number 11 SEGV:
            Segmentation Violation, probably memory access out of range</b></i><i><b><br>
          </b></i><i><b>[0]PETSC ERROR: Try option -start_in_debugger or
            -on_error_attach_debugger</b></i><i><b><br>
          </b></i><i><b>[0]PETSC ERROR: or see
            <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind" target="_blank">http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind</a>[0]PETSC
            ERROR: or try <a href="http://valgrind.org" target="_blank">http://valgrind.org</a> on GNU/linux and Apple Mac
            OS X to find memory corruption errors</b></i><i><b><br>
          </b></i><i><b>[0]PETSC ERROR: likely location of problem given
            in stack below</b></i><i><b><br>
          </b></i><i><b>[0]PETSC ERROR: ---------------------  Stack
            Frames ------------------------------------</b></i><i><b><br>
          </b></i><i><b>[0]PETSC ERROR: Note: The EXACT line numbers in
            the stack are not available,</b></i><i><b><br>
          </b></i><i><b>[0]PETSC ERROR:       INSTEAD the line number of
            the start of the function</b></i><i><b><br>
          </b></i><i><b>[0]PETSC ERROR:       is given.</b></i><i><b><br>
          </b></i><i><b>[0]PETSC ERROR: --------------------- Error
            Message ------------------------------------</b></i><i><b><br>
          </b></i><i><b>[0]PETSC ERROR: Signal received!</b></i><i><b><br>
          </b></i><i><b>[0]PETSC ERROR:
            ------------------------------------------------------------------------</b></i><i><b><br>
          </b></i><i><b>[0]PETSC ERROR: Petsc Release Version 3.4.4,
            Mar, 13, 2014 </b></i><i><b><br>
          </b></i><i><b>[0]PETSC ERROR: See docs/changes/index.html for
            recent updates.</b></i><i><b><br>
          </b></i><i><b>[0]PETSC ERROR: See docs/faq.html for hints
            about trouble shooting.</b></i><i><b><br>
          </b></i><i><b>[0]PETSC ERROR: See docs/index.html for manual
            pages.</b></i><i><b><br>
          </b></i><i><b>[0]PETSC ERROR:
            ------------------------------------------------------------------------</b></i><i><b><br>
          </b></i><i><b>[0]PETSC ERROR: ./</b></i><i><b>PgmPrincipal</b></i><i><b>
            on a arch-linux2-c-debug named r10dawesr by ndengues Fri Apr
            25 09:36:59 2014</b></i><i><b><br>
          </b></i><i><b>[0]PETSC ERROR: Libraries linked from
/usr/local/home/ndengues/Downloads/Libraries/petsc-3.4.4/arch-linux2-c-debug/lib</b></i><i><b><br>
          </b></i><i><b>[0]PETSC ERROR: Configure run at Thu Apr 24
            20:35:39 2014</b></i><i><b><br>
          </b></i><i><b>[0]PETSC ERROR: Configure options --with-cc=gcc
            --with-fc=gfortran --download-f-blas-lapack --download-mpich</b></i><i><b><br>
          </b></i><i><b>[0]PETSC ERROR:
            ------------------------------------------------------------------------</b></i><i><b><br>
          </b></i><i><b>[0]PETSC ERROR: User provided function() line 0
            in unknown directory unknown file</b></i><i><b><br>
          </b></i><i><b>application called MPI_Abort(MPI_COMM_WORLD, 59)
            - process 0</b></i><i><b><br>
          </b></i><i><b>[cli_0]: aborting job:</b></i><i><b><br>
          </b></i><i><b>application called MPI_Abort(MPI_COMM_WORLD, 59)
            - process 0</b></i><br>
        ***<br>
        <br>
        <br>
        <br>
        Once more, the program execute without troubles for all the examples
        in the package.<br>
        <br>
        Sincerely,<br>
        <br>
      </font><br>
      On 04/24/2014 10:14 PM, Satish Balay wrote:<br>
    </div>
    <blockquote type="cite">
      <pre>petsc examples work fine.

send us the code that breaks. Also copy/paste the *complete* output from 'make' when
you attempt to compile this code.

Satish

On Thu, 24 Apr 2014, Barry Smith wrote:

</pre>
      <blockquote type="cite">
        <pre>  Try .F files instead of .F90 some Fortran compilers handle preprocessing in different ways for .F and .F90

   Please also send configure.log and make.log so we know what compilers etc you are using.

  Barry

  Note that we are using C pre processing directives, 

On Apr 24, 2014, at 7:57 PM, Steve Ndengue <a href="mailto:steve.ndengue@gmail.com" target="_blank"><steve.ndengue@gmail.com></a> wrote:

</pre>
        <blockquote type="cite">
          <pre>The results is the same with lower case letters...


On 04/24/2014 07:39 PM, Matthew Knepley wrote:
</pre>
          <blockquote type="cite">
            <pre>On Thu, Apr 24, 2014 at 8:36 PM, Steve Ndengue <a href="mailto:steve.ndengue@gmail.com" target="_blank"><steve.ndengue@gmail.com></a> wrote:
Thank you for the quick reply.

It partly solved the problem; the PETSC and SLEPC files are now included in the compilation.

However the Warning are now error messages!
***
pgm_hatom_offaxis_cyl.F90:880:0: error: invalid preprocessing directive #INCLUDE
pgm_hatom_offaxis_cyl.F90:887:0: error: invalid preprocessing directive #IF
pgm_hatom_offaxis_cyl.F90:890:0: error: invalid preprocessing directive #ELSE
pgm_hatom_offaxis_cyl.F90:893:0: error: invalid preprocessing directive #ENDIF
***

These should not be capitalized.

  Matt
 
And the corresponding code lines are:
***
#INCLUDE <finclude/slepcepsdef.h>
        USE slepceps

!
 IMPLICIT NONE
!----------------------
!
#IF DEFINED(PETSC_USE_FORTRAN_DATATYPES)
        TYPE(Mat)                                          A
        TYPE(EPS)                                          solver
#ELSE
        Mat                                                A
        EPS                                                solver
#ENDIF
***

Sincerely.

On 04/24/2014 07:25 PM, Satish Balay wrote:
</pre>
            <blockquote type="cite">
              <pre>On Thu, 24 Apr 2014, Steve Ndengue wrote:


</pre>
              <blockquote type="cite">
                <pre>Dear all,

I am having trouble compiling a code with some dependencies that shall call
SLEPC.
The compilation however goes perfectly for the various tutorials and tests in
the package.

A sample makefile looks like:

***

/default: code//
//routines: Rout1.o Rout2.o Rout3.o Module1.o//
//code: PgmPrincipal//
//sources=Rout1.f Rout2.f Rout3.f Module1.f90//

</pre>
              </blockquote>
              <pre>Its best to rename your sourcefiles .F/.F90 [and not .f/.f90
[this enables using default targets from petsc makefiles - and its
the correct notation for preprocessing - which is required by petsc/slepc]


</pre>
              <blockquote type="cite">
                <pre>//objets=Rout1.o Rout2.o Rout3.o Module1.o Pgm//Principal//.o//
//
//%.o: %.f//
//        -${FLINKER} -c $<//

</pre>
              </blockquote>
              <pre>And you shouldn't need to create the above .o.f target.

Satish



</pre>
              <blockquote type="cite">
                <pre>//
//Module1_mod.mod Module1.o: //Module1//.f90//
//        -${FLINKER} -c //Module1//.f90//
//
//include ${SLEPC_DIR}/conf/slepc_common//
//
//Pgm//Principal//: ${objets} chkopts//
//        -${FLINKER} -o $@ ${objets} ${SLEPC_LIB}//
//
//.PHONY: clean//
//        ${RM} *.o *.mod Pgm//Principal//
/
***

The code exits with Warning and error messages of the type:

*Warning: Pgm**Principal**.f90:880: Illegal preprocessor directive**
**Warning: Pgm**Principal**.f90:889: Illegal preprocessor directive**
**Warning: Pgm**Principal**.f90:892: Illegal preprocessor directive**
**Warning: Pgm**Principal**.f90:895: Illegal preprocessor directive*

and

*USE slepceps**
**                    1**
**Fatal Error: Can't open module file 'slepceps.mod' for reading at (1): No
such file or directory


*I do not get these errors with the tests and errors files.


Sincerely,



</pre>
              </blockquote>
            </blockquote>
            <pre>-- 
Steve 




-- 
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
</pre>
          </blockquote>
          <pre>-- 
Steve 



</pre><span class="HOEnZb"><font color="#888888">
        </font></span></blockquote><span class="HOEnZb"><font color="#888888">
        <pre></pre>
      </font></span></blockquote><span class="HOEnZb"><font color="#888888">
      <pre></pre>
    </font></span></blockquote><span class="HOEnZb"><font color="#888888">
    <br>
    <br>
    <pre cols="72">-- 
Steve</pre>
  </font></span></div>

</blockquote></div><br><br clear="all"><div><br></div>-- <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
</div></div>