Re: [petsc-dev] OpenMP

2021-11-07 Thread Mark Adams
Ah, great.
I guessed right (that was the page I was looking at but I still don't see
this)
#if defined(_OPENMP) && _OPENMP >= 201811

On Sat, Nov 6, 2021 at 8:47 PM Junchao Zhang 
wrote:

>
>
> On Sat, Nov 6, 2021 at 3:51 PM Mark Adams  wrote:
>
>> Yea, that is a bit inscrutable, but I see mumps is the main/only user of
>> this:
>>
>> /* if using PETSc OpenMP support, we only call MUMPS on master ranks.
>> Before/after the call, we change/restore CPUs the master ranks can run on */
>>
>> And I see _OPENMP is a macro for the release date (mm) of the OMP
>> version. It's not clear what the v5.0 is (
>> https://www.openmp.org/specifications/)
>>
> {200505,"2.5"},{200805,"3.0"},{201107,"3.1"},{201307,"4.0"},{201511,"4.5"},{201811,"5.0"},{202011,"5.1"}
>
> On Sat, Nov 6, 2021 at 4:27 PM Junchao Zhang 
>> wrote:
>>
>>>
>>>
>>> On Sat, Nov 6, 2021 at 5:51 AM Mark Adams  wrote:
>>>
 Two questions on OMP:

 * Can I test for the version of OMP? I want >= 5 and I see this, which
 looks promising:
 include/petscsys.h:#elif defined(_OPENMP) && *_OPENMP >= 201307* &&
 !defined(_WIN32)

 * What is the difference between HAVE_OPENMP and
 HAVE_OPENMP_SUPPORT.

 # this is different from HAVE_OPENMP. HAVE_OPENMP_SUPPORT checks if we
>>> have facilities to support
>>> # running PETSc in flat-MPI mode and third party libraries in MPI+OpenMP
>>> hybrid mode
>>> if self.mpi.found and self.mpi.support_mpi3_shm and self.pthread.found
>>> and self.hwloc.found:
>>> # Apple pthread does not provide this functionality
>>> if self.function.check('pthread_barrier_init', libraries = 'pthread'):
>>> self.addDefine('HAVE_OPENMP_SUPPORT', 1)
>>>
>>>
 Thanks,
 Mark

>>>


Re: [petsc-dev] OpenMP

2021-11-06 Thread Junchao Zhang
On Sat, Nov 6, 2021 at 3:51 PM Mark Adams  wrote:

> Yea, that is a bit inscrutable, but I see mumps is the main/only user of
> this:
>
> /* if using PETSc OpenMP support, we only call MUMPS on master ranks.
> Before/after the call, we change/restore CPUs the master ranks can run on */
>
> And I see _OPENMP is a macro for the release date (mm) of the OMP
> version. It's not clear what the v5.0 is (
> https://www.openmp.org/specifications/)
>
{200505,"2.5"},{200805,"3.0"},{201107,"3.1"},{201307,"4.0"},{201511,"4.5"},{201811,"5.0"},{202011,"5.1"}

On Sat, Nov 6, 2021 at 4:27 PM Junchao Zhang 
> wrote:
>
>>
>>
>> On Sat, Nov 6, 2021 at 5:51 AM Mark Adams  wrote:
>>
>>> Two questions on OMP:
>>>
>>> * Can I test for the version of OMP? I want >= 5 and I see this, which
>>> looks promising:
>>> include/petscsys.h:#elif defined(_OPENMP) && *_OPENMP >= 201307* &&
>>> !defined(_WIN32)
>>>
>>> * What is the difference between HAVE_OPENMP and
>>> HAVE_OPENMP_SUPPORT.
>>>
>>> # this is different from HAVE_OPENMP. HAVE_OPENMP_SUPPORT checks if we
>> have facilities to support
>> # running PETSc in flat-MPI mode and third party libraries in MPI+OpenMP
>> hybrid mode
>> if self.mpi.found and self.mpi.support_mpi3_shm and self.pthread.found
>> and self.hwloc.found:
>> # Apple pthread does not provide this functionality
>> if self.function.check('pthread_barrier_init', libraries = 'pthread'):
>> self.addDefine('HAVE_OPENMP_SUPPORT', 1)
>>
>>
>>> Thanks,
>>> Mark
>>>
>>


Re: [petsc-dev] OpenMP

2021-11-06 Thread Mark Adams
Yea, that is a bit inscrutable, but I see mumps is the main/only user of
this:

/* if using PETSc OpenMP support, we only call MUMPS on master ranks.
Before/after the call, we change/restore CPUs the master ranks can run on */

And I see _OPENMP is a macro for the release date (mm) of the OMP
version. It's not clear what the v5.0 is (
https://www.openmp.org/specifications/)

On Sat, Nov 6, 2021 at 4:27 PM Junchao Zhang 
wrote:

>
>
> On Sat, Nov 6, 2021 at 5:51 AM Mark Adams  wrote:
>
>> Two questions on OMP:
>>
>> * Can I test for the version of OMP? I want >= 5 and I see this, which
>> looks promising:
>> include/petscsys.h:#elif defined(_OPENMP) && *_OPENMP >= 201307* &&
>> !defined(_WIN32)
>>
>> * What is the difference between HAVE_OPENMP and
>> HAVE_OPENMP_SUPPORT.
>>
>> # this is different from HAVE_OPENMP. HAVE_OPENMP_SUPPORT checks if we
> have facilities to support
> # running PETSc in flat-MPI mode and third party libraries in MPI+OpenMP
> hybrid mode
> if self.mpi.found and self.mpi.support_mpi3_shm and self.pthread.found and
> self.hwloc.found:
> # Apple pthread does not provide this functionality
> if self.function.check('pthread_barrier_init', libraries = 'pthread'):
> self.addDefine('HAVE_OPENMP_SUPPORT', 1)
>
>
>> Thanks,
>> Mark
>>
>


Re: [petsc-dev] OpenMP

2021-11-06 Thread Junchao Zhang
On Sat, Nov 6, 2021 at 5:51 AM Mark Adams  wrote:

> Two questions on OMP:
>
> * Can I test for the version of OMP? I want >= 5 and I see this, which
> looks promising:
> include/petscsys.h:#elif defined(_OPENMP) && *_OPENMP >= 201307* &&
> !defined(_WIN32)
>
> * What is the difference between HAVE_OPENMP and
> HAVE_OPENMP_SUPPORT.
>
> # this is different from HAVE_OPENMP. HAVE_OPENMP_SUPPORT checks if we
have facilities to support
# running PETSc in flat-MPI mode and third party libraries in MPI+OpenMP
hybrid mode
if self.mpi.found and self.mpi.support_mpi3_shm and self.pthread.found and
self.hwloc.found:
# Apple pthread does not provide this functionality
if self.function.check('pthread_barrier_init', libraries = 'pthread'):
self.addDefine('HAVE_OPENMP_SUPPORT', 1)


> Thanks,
> Mark
>


Re: [petsc-dev] OpenMP and web page

2021-01-15 Thread Barry Smith

  I agree.  We should just make sure it "disappears" with the transition to the 
Spinx docs.

  Barry


> On Jan 15, 2021, at 10:32 AM, jacob@gmail.com wrote:
> 
> Alternatively, I simply don’t include it in the MR to port the website to 
> sphinx.
>  
> Best regards,
>  
> Jacob Faibussowitsch
> (Jacob Fai - booss - oh - vitch)
> Cell: (312) 694-3391
>  
> From: petsc-dev  On Behalf Of Mark Adams
> Sent: Friday, January 15, 2021 10:20
> To: For users of the development version of PETSc 
> Subject: [petsc-dev] OpenMP and web page
>  
> I am experimenting with launching asynchronous GPU solves in 
> PCFieldsplit/additive using OpenMP and I found this web page, which I think 
> is obsolete and should be removed: 
> https://www.mcs.anl.gov/petsc/miscellaneous/petscthreads.html 
> 
>  
> Mark



Re: [petsc-dev] OpenMP and web page

2021-01-15 Thread jacob.fai
Alternatively, I simply don’t include it in the MR to port the website to 
sphinx.

 

Best regards,

 

Jacob Faibussowitsch

(Jacob Fai - booss - oh - vitch)

Cell: (312) 694-3391

 

From: petsc-dev  On Behalf Of Mark Adams
Sent: Friday, January 15, 2021 10:20
To: For users of the development version of PETSc 
Subject: [petsc-dev] OpenMP and web page

 

I am experimenting with launching asynchronous GPU solves in 
PCFieldsplit/additive using OpenMP and I found this web page, which I think is 
obsolete and should be removed: 
https://www.mcs.anl.gov/petsc/miscellaneous/petscthreads.html

 

Mark



Re: [petsc-dev] OpenMP for GPU course

2019-03-19 Thread Smith, Barry F. via petsc-dev


  


> On Mar 19, 2019, at 12:22 PM, Matthew Knepley  wrote:
> 
> On Tue, Mar 19, 2019 at 1:17 PM Jed Brown  wrote:
> Matthew Knepley  writes:
> 
> > Are you saying that using OpenMP 4.5 "offload" is something you would do?
> 
> For applications that make sense for GPUs, yes.
> 
> Would you say this workshop is oriented toward application that make sense 
> for GPUs, or
> are they trying to sell this to everyone regardless of the suitability?

bnl website is currently off-line; at least from my location

> 
>   Matt
> 
> -- 
> 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
> 
> https://www.cse.buffalo.edu/~knepley/



Re: [petsc-dev] OpenMP for GPU course

2019-03-19 Thread Jed Brown via petsc-dev
"Smith, Barry F."  writes:

>> On Mar 19, 2019, at 12:17 PM, Jed Brown  wrote:
>> 
>> Matthew Knepley  writes:
>> 
>>> Are you saying that using OpenMP 4.5 "offload" is something you would do?
>> 
>> For applications that make sense for GPUs, yes.
>
>   Oh, so you mean for AI ;)

We really missed the boat by not rebranding as PETAi ("intelligence is
the easy part") and registering pet.ai.


Re: [petsc-dev] OpenMP for GPU course

2019-03-19 Thread Smith, Barry F. via petsc-dev



> On Mar 19, 2019, at 12:17 PM, Jed Brown  wrote:
> 
> Matthew Knepley  writes:
> 
>> Are you saying that using OpenMP 4.5 "offload" is something you would do?
> 
> For applications that make sense for GPUs, yes.

  Oh, so you mean for AI ;)





Re: [petsc-dev] OpenMP for GPU course

2019-03-19 Thread Smith, Barry F. via petsc-dev


> On Mar 19, 2019, at 12:12 PM, Matthew Knepley  wrote:
> 
> On Tue, Mar 19, 2019 at 12:31 PM Jed Brown via petsc-dev 
>  wrote:
> These are well-organized events that puts application teams together
> with compiler developers and the like.  I served as a mentor for the
> Boulder hackathon last year (joining a NASA team that included PETSc
> user Gaetan Kenway) and learned a lot.  It's highly recommended to
> prepare for the event by focusing the code you want to work on to
> something concrete and easily modifiable, and to have a test suite that
> can be easily run to evaluate correctness and performance.  In our case,
> Michael Barad had done an exemplary job in that preparation.
> 
> Are you saying that using OpenMP 4.5 "offload" is something you would do?

   It may be the only choice ;(.  In addition, if it does perform poorly it 
would be good to have concrete evidence that it performs poorly.

> 
>   Matt
>  
> "Smith, Barry F. via petsc-dev"  writes:
> 
> >I got this off an ECP mailing list.
> >
> >
> > OpenMP Brookathon 2019
> > April 29 – May 2, 2019
> > URL:  https://www.bnl.gov/ompbrookathon2019/
> > The Computational Science Initiative at Brookhaven National Laboratory 
> > (BNL) is organizing in conjunction with Oak Ridge National Laboratory 
> > (ORNL) and IBM, the "OpenMP Brookathon 2019". This event is sponsored by 
> > ECP and driven by the ECP SOLLVE Project. The goal of this hackathon is to 
> > port, optimize and evolve applications towards the latest OpenMP versions 
> > (4.5+). In practical terms, this event will enable application teams and 
> > developers to accelerate their code with the use of GPUs, as well as 
> > exploiting the latest OpenMP functionality to program (IBM Power9) 
> > multi-core platforms. Prospective user groups of large hybrid CPU-GPU 
> > systems will send teams of at least 3 developers along with either (1) a 
> > scalable application that could benefit from GPU accelerators, or (2) an 
> > application running on accelerators that has already written OpenMP and 
> > needs optimization or (3) applications that have OpenACC in their codes and 
> > need assistance to convert them to OpenMP 4.5 offload. There will be 
> > intensive mentoring during this 4-day hands-on event. Programming 
> > experience with OpenMP 4.5 offload or CUDA is not a requirement. We will 
> > hold training events / tutorials covering the set of background topics 
> > required. In the weeks preceding the hackathon, you will have a chance to 
> > attend training to prepare you for the event. Prior GPU experience is not 
> > required!
> 
> 
> -- 
> 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
> 
> https://www.cse.buffalo.edu/~knepley/



Re: [petsc-dev] OpenMP for GPU course

2019-03-19 Thread Jed Brown via petsc-dev
Matthew Knepley  writes:

> Are you saying that using OpenMP 4.5 "offload" is something you would do?

For applications that make sense for GPUs, yes.


Re: [petsc-dev] OpenMP for GPU course

2019-03-19 Thread Jed Brown via petsc-dev
These are well-organized events that puts application teams together
with compiler developers and the like.  I served as a mentor for the
Boulder hackathon last year (joining a NASA team that included PETSc
user Gaetan Kenway) and learned a lot.  It's highly recommended to
prepare for the event by focusing the code you want to work on to
something concrete and easily modifiable, and to have a test suite that
can be easily run to evaluate correctness and performance.  In our case,
Michael Barad had done an exemplary job in that preparation.

"Smith, Barry F. via petsc-dev"  writes:

>I got this off an ECP mailing list.
>
>
> OpenMP Brookathon 2019
> April 29 – May 2, 2019
> URL:  https://www.bnl.gov/ompbrookathon2019/
> The Computational Science Initiative at Brookhaven National Laboratory (BNL) 
> is organizing in conjunction with Oak Ridge National Laboratory (ORNL) and 
> IBM, the "OpenMP Brookathon 2019". This event is sponsored by ECP and driven 
> by the ECP SOLLVE Project. The goal of this hackathon is to port, optimize 
> and evolve applications towards the latest OpenMP versions (4.5+). In 
> practical terms, this event will enable application teams and developers to 
> accelerate their code with the use of GPUs, as well as exploiting the latest 
> OpenMP functionality to program (IBM Power9) multi-core platforms. 
> Prospective user groups of large hybrid CPU-GPU systems will send teams of at 
> least 3 developers along with either (1) a scalable application that could 
> benefit from GPU accelerators, or (2) an application running on accelerators 
> that has already written OpenMP and needs optimization or (3) applications 
> that have OpenACC in their codes and need assistance to convert them to 
> OpenMP 4.5 offload. There will be intensive mentoring during this 4-day 
> hands-on event. Programming experience with OpenMP 4.5 offload or CUDA is not 
> a requirement. We will hold training events / tutorials covering the set of 
> background topics required. In the weeks preceding the hackathon, you will 
> have a chance to attend training to prepare you for the event. Prior GPU 
> experience is not required!


Re: [petsc-dev] openmp

2013-11-06 Thread Svetlana Tkachenko
Thanks. Could you please send an example makefile for this small example as 
src/ts/examples/tutorials/makefile is huge and I don't know which part of it 
manages the -I -L stuff.

  Svetlana

On Thu, 7 Nov 2013, at 1:19, Barry Smith wrote:
 
Your makefile does not indicate the location of mpif.h to your FORTRAN 
 compiler which in the case of —with-mpi=0 is in ${PETSC}/include/mpiuni
 
Note that if you simply copy a makefile from PETSc, say 
 src/ts/examples/tutorials/makefile and modify that slightly for you code you 
 don’t need to manage all the -I -L stuff yourself, our makefiles take care of 
 it and are portable for different MPIs etc.
 
 Barry
 
 
 
 On Nov 6, 2013, at 12:25 AM, Svetlana Tkachenko 
 svetlana.tkache...@fastmail.fm wrote:
 
  I have configured petsc-dev (downloaded it today) with these options, and a 
  small example. It appears to fail to compile without MPI with the error 
  message:
  
  ./configure --with-cc=gcc --with-fc=gfortran  --download-f-blas-lapack 
  --with-openmp --with-mpi=0
  
  ~/dev/test/petsc $ echo $LD_LIBRARY_PATH
  /home/username/petsc/linux-amd64/lib:/opt/openmpi/lib
  ~/dev/test/petsc $ cat solver.f
 subroutine solver()
  #include finclude/petscsys.h
  
   PetscErrorCode ierr
   print *, Entered petsc.
  
   ! Init PETSc
   call PetscInitialize(PETSC_NULL_CHARACTER,ierr)
   CHKERRQ(ierr)
   print *, Init done.
  
   ! Finalise PETSc
   call PetscFinalize(ierr)
   CHKERRQ(ierr)
   print *, Finalized.
  end
  ~/dev/test/petsc $ cat myexample.f
program myexample
  
call solver
end
  ~/dev/test/petsc $ cat makefile
  include ${PETSC_DIR}/conf/variables
  
  myexample: myexample.o solver.o ; gfortran -o myexample myexample.o 
  solver.o -lpetsc -L${PETSC_DIR}/${PETSC_ARCH}/lib -fopenmp
  solver.o: ; gfortran -c -cpp -I${PETSC_DIR}/include -O0 solver.f -lpetsc 
  -I${PETSC_DIR}/${PETSC_ARCH}/include -L${PETSC_DIR}/${PETSC_ARCH}/lib 
  -lpetsc -fopenmp
  myexample.o: ; gfortran -c -cpp -I${PETSC_DIR}/include -O0 myexample.f 
  -lpetsc -I${PETSC_DIR}/${PETSC_ARCH}/include 
  -L${PETSC_DIR}/${PETSC_ARCH}/lib -lpetsc -fopenmp
  ~/dev/test/petsc $ make
  gfortran -c -cpp -I/home/username/petsc/include -O0 myexample.f -lpetsc 
  -I/home/username/petsc/linux-amd64/include 
  -L/home/username/petsc/linux-amd64/lib -lpetsc -fopenmp
  gfortran -c -cpp -I/home/username/petsc/include -O0 solver.f -lpetsc 
  -I/home/username/petsc/linux-amd64/include 
  -L/home/username/petsc/linux-amd64/lib -lpetsc -fopenmp
  In file included from solver.f:3:
  /home/username/petsc/include/finclude/petscsys.h:10: error: mpif.h: No 
  such file or directory
  /home/username/petsc/include/finclude/petscsys.h:163.29:
 Included at solver.f:3:
  
   parameter(MPIU_SCALAR = MPI_DOUBLE_PRECISION)
  1
  Error: Parameter 'mpi_double_precision' at (1) has not been declared or is 
  a variable, which does not reduce to a constant expression
  /home/username/petsc/include/finclude/petscsys.h:171.30:
 Included at solver.f:3:
  
   parameter(MPIU_INTEGER = MPI_INTEGER)
   1
  Error: Parameter 'mpi_integer' at (1) has not been declared or is a 
  variable, which does not reduce to a constant expression
  make: *** [solver.o] Error 1
  ~/dev/test/petsc $ 
 


Re: [petsc-dev] openmp

2013-11-06 Thread Matthew Knepley
On Wed, Nov 6, 2013 at 4:47 PM, Svetlana Tkachenko 
svetlana.tkache...@fastmail.fm wrote:

 Thanks. Could you please send an example makefile for this small example
 as src/ts/examples/tutorials/makefile is huge and I don't know which part
 of it manages the -I -L stuff.


prog: prog.o
  ${CLINKER} -o prog prog.o ${PETSC_LIB}

include ${PETSC_DIR}/conf/variables
include ${PETSC_DIR}/conf/rules

Matt


   Svetlana

 On Thu, 7 Nov 2013, at 1:19, Barry Smith wrote:
 
 Your makefile does not indicate the location of mpif.h to your
 FORTRAN compiler which in the case of —with-mpi=0 is in
 ${PETSC}/include/mpiuni
 
 Note that if you simply copy a makefile from PETSc, say
 src/ts/examples/tutorials/makefile and modify that slightly for you code
 you don’t need to manage all the -I -L stuff yourself, our makefiles take
 care of it and are portable for different MPIs etc.
 
  Barry
 
 
 
  On Nov 6, 2013, at 12:25 AM, Svetlana Tkachenko 
 svetlana.tkache...@fastmail.fm wrote:
 
   I have configured petsc-dev (downloaded it today) with these options,
 and a small example. It appears to fail to compile without MPI with the
 error message:
  
   ./configure --with-cc=gcc --with-fc=gfortran  --download-f-blas-lapack
 --with-openmp --with-mpi=0
  
   ~/dev/test/petsc $ echo $LD_LIBRARY_PATH
   /home/username/petsc/linux-amd64/lib:/opt/openmpi/lib
   ~/dev/test/petsc $ cat solver.f
  subroutine solver()
   #include finclude/petscsys.h
  
PetscErrorCode ierr
print *, Entered petsc.
  
! Init PETSc
call PetscInitialize(PETSC_NULL_CHARACTER,ierr)
CHKERRQ(ierr)
print *, Init done.
  
! Finalise PETSc
call PetscFinalize(ierr)
CHKERRQ(ierr)
print *, Finalized.
   end
   ~/dev/test/petsc $ cat myexample.f
 program myexample
  
 call solver
 end
   ~/dev/test/petsc $ cat makefile
   include ${PETSC_DIR}/conf/variables
  
   myexample: myexample.o solver.o ; gfortran -o myexample myexample.o
 solver.o -lpetsc -L${PETSC_DIR}/${PETSC_ARCH}/lib -fopenmp
   solver.o: ; gfortran -c -cpp -I${PETSC_DIR}/include -O0 solver.f
 -lpetsc -I${PETSC_DIR}/${PETSC_ARCH}/include
 -L${PETSC_DIR}/${PETSC_ARCH}/lib -lpetsc -fopenmp
   myexample.o: ; gfortran -c -cpp -I${PETSC_DIR}/include -O0 myexample.f
 -lpetsc -I${PETSC_DIR}/${PETSC_ARCH}/include
 -L${PETSC_DIR}/${PETSC_ARCH}/lib -lpetsc -fopenmp
   ~/dev/test/petsc $ make
   gfortran -c -cpp -I/home/username/petsc/include -O0 myexample.f
 -lpetsc -I/home/username/petsc/linux-amd64/include
 -L/home/username/petsc/linux-amd64/lib -lpetsc -fopenmp
   gfortran -c -cpp -I/home/username/petsc/include -O0 solver.f -lpetsc
 -I/home/username/petsc/linux-amd64/include
 -L/home/username/petsc/linux-amd64/lib -lpetsc -fopenmp
   In file included from solver.f:3:
   /home/username/petsc/include/finclude/petscsys.h:10: error: mpif.h:
 No such file or directory
   /home/username/petsc/include/finclude/petscsys.h:163.29:
  Included at solver.f:3:
  
parameter(MPIU_SCALAR = MPI_DOUBLE_PRECISION)
   1
   Error: Parameter 'mpi_double_precision' at (1) has not been declared
 or is a variable, which does not reduce to a constant expression
   /home/username/petsc/include/finclude/petscsys.h:171.30:
  Included at solver.f:3:
  
parameter(MPIU_INTEGER = MPI_INTEGER)
1
   Error: Parameter 'mpi_integer' at (1) has not been declared or is a
 variable, which does not reduce to a constant expression
   make: *** [solver.o] Error 1
   ~/dev/test/petsc $
 




-- 
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


Re: [petsc-dev] openmp

2013-11-06 Thread Jed Brown
Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:

 Thanks. Could you please send an example makefile for this small
 example as src/ts/examples/tutorials/makefile is huge and I don't know
 which part of it manages the -I -L stuff.

There are examples in the user's manual.  I would start with this:

ALL: ex2

include ${PETSC_DIR}/conf/variables
include ${PETSC_DIR}/conf/rules
ex2: ex2.o chkopts
${CLINKER} -o $@ $ ${PETSC_LIB}


pgpzozD5V73lB.pgp
Description: PGP signature


Re: [petsc-dev] openmp

2013-11-06 Thread Svetlana Tkachenko
On Thu, 7 Nov 2013, at 9:22, Jed Brown wrote:
 Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:
 
  Thanks. Could you please send an example makefile for this small
  example as src/ts/examples/tutorials/makefile is huge and I don't know
  which part of it manages the -I -L stuff.
 
 There are examples in the user's manual.  I would start with this:
 
 ALL: ex2
 
 include ${PETSC_DIR}/conf/variables
 include ${PETSC_DIR}/conf/rules
 ex2: ex2.o chkopts
   ${CLINKER} -o $@ $ ${PETSC_LIB}
 Email had 1 attachment:
 + Attachment2
   1k (application/pgp-signature)

On Thu, 7 Nov 2013, at 9:21, Matthew Knepley wrote:
 prog: prog.o
   ${CLINKER} -o prog prog.o ${PETSC_LIB}
 
 include ${PETSC_DIR}/conf/variables
 include ${PETSC_DIR}/conf/rules
 
 Matt

Right. I have spent half of an hour now trying to imagine what to do to link 
trying everything like a headless chicken and it did not work. I would 
appreciate if you could come up with something that links, not just runs a 
single program.


Re: [petsc-dev] openmp

2013-11-06 Thread Jed Brown
Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:
 Right. I have spent half of an hour now trying to imagine what to do
 to link trying everything like a headless chicken and it did not
 work. 

You always have to send the error message.

 I would appreciate if you could come up with something that links, not
 just runs a single program.

The makefiles we suggested link a program of the same name as the source
file.  Do you have multiple source files?  You only have to edit the one
line and run make.

program: several.o object.o files.o
${CLINKER} -o $@ $^ ${PETSC_LIB}

include ${PETSC_DIR}/conf/variables
include ${PETSC_DIR}/conf/rules


pgpnp8FMfHJGP.pgp
Description: PGP signature


Re: [petsc-dev] openmp

2013-11-06 Thread Svetlana Tkachenko


On Thu, 7 Nov 2013, at 10:22, Jed Brown wrote:
 Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:
  Right. I have spent half of an hour now trying to imagine what to do
  to link trying everything like a headless chicken and it did not
  work. 
 
 You always have to send the error message.
 
  I would appreciate if you could come up with something that links, not
  just runs a single program.
 
 The makefiles we suggested link a program of the same name as the source
 file.  Do you have multiple source files?  You only have to edit the one
 line and run make.
 
 program: several.o object.o files.o
   ${CLINKER} -o $@ $^ ${PETSC_LIB}
 
 include ${PETSC_DIR}/conf/variables
 include ${PETSC_DIR}/conf/rules
 Email had 1 attachment:
 + Attachment2
   1k (application/pgp-signature)

~/dev/test/petsc $ cat makefile
myexample: myexample.o solver.o
${CLINKER} -o $@ $^ ${PETSC_LIB}

include ${PETSC_DIR}/conf/variables
include ${PETSC_DIR}/conf/rules
~/dev/test/petsc $ cat solver.f
  subroutine solver()
#include finclude/petscsys.h
PetscErrorCode ierr
print *, Entered petsc.

  ! Init PETSc
  call PetscInitialize(PETSC_NULL_CHARACTER,ierr)
  CHKERRQ(ierr)
  print *, Init done.

  ! Finalise PETSc
  call PetscFinalize(ierr)
  CHKERRQ(ierr)
  print *, Finalized.
  end
~/dev/test/petsc $ make
gfortran -c  -fPIC -Wall -Wno-unused-variable -g  -fopenmp  -o solver.o solver.f
Warning: solver.f:2: Illegal preprocessor directive
solver.f:3.12:

PetscErrorCode ierr
1
Error: Unclassifiable statement at (1)
solver.f:8.14:

  CHKERRQ(ierr)
  1
Error: Unclassifiable statement at (1)
solver.f:13.14:

  CHKERRQ(ierr)
  1
Error: Unclassifiable statement at (1)
make: [solver.o] Error 1 (ignored)
gcc -fopenmp -fopenmp   -fPIC -Wall -Wwrite-strings -Wno-strict-aliasing 
-Wno-unknown-pragmas -g3 -fno-inline -O0 -fopenmp  -o myexample myexample.o 
solver.o -Wl,-rpath,/home/username/petsc/linux-amd64/lib 
-L/home/username/petsc/linux-amd64/lib  -lpetsc 
-Wl,-rpath,/home/username/petsc/linux-amd64/lib -lflapack -lfblas -lX11 
-lpthread -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/4.4.7 
-L/usr/lib/gcc/x86_64-redhat-linux/4.4.7 -lgfortran -lm -lm -lstdc++ -lstdc++ 
-ldl -lgcc_s -ldl
gcc: solver.o: No such file or directory
make: *** [myexample] Error 1

~/dev/test/petsc $ 


Re: [petsc-dev] openmp

2013-11-06 Thread Jed Brown
Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:

 On Thu, 7 Nov 2013, at 10:22, Jed Brown wrote:
 Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:
  Right. I have spent half of an hour now trying to imagine what to do
  to link trying everything like a headless chicken and it did not
  work. 
 
 You always have to send the error message.
 
  I would appreciate if you could come up with something that links, not
  just runs a single program.
 
 The makefiles we suggested link a program of the same name as the source
 file.  Do you have multiple source files?  You only have to edit the one
 line and run make.
 
 program: several.o object.o files.o
  ${CLINKER} -o $@ $^ ${PETSC_LIB}
 
 include ${PETSC_DIR}/conf/variables
 include ${PETSC_DIR}/conf/rules
 Email had 1 attachment:
 + Attachment2
   1k (application/pgp-signature)

 ~/dev/test/petsc $ cat makefile
 myexample: myexample.o solver.o
 ${CLINKER} -o $@ $^ ${PETSC_LIB}

 include ${PETSC_DIR}/conf/variables
 include ${PETSC_DIR}/conf/rules
 ~/dev/test/petsc $ cat solver.f
   subroutine solver()
 #include finclude/petscsys.h

Name your source file solver.F so that the Fortran compiler preprocesses
it.  (Or add the option -cpp, but that is more confusing and less
portable, so rename the source file.)


pgpXoN197wB7v.pgp
Description: PGP signature


Re: [petsc-dev] openmp

2013-11-06 Thread Svetlana Tkachenko
On Thu, 7 Nov 2013, at 12:34, Jed Brown wrote:
 Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:
 
  On Thu, 7 Nov 2013, at 10:22, Jed Brown wrote:
  Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:
   Right. I have spent half of an hour now trying to imagine what to do
   to link trying everything like a headless chicken and it did not
   work. 
  
  You always have to send the error message.
  
   I would appreciate if you could come up with something that links, not
   just runs a single program.
  
  The makefiles we suggested link a program of the same name as the source
  file.  Do you have multiple source files?  You only have to edit the one
  line and run make.
  
  program: several.o object.o files.o
 ${CLINKER} -o $@ $^ ${PETSC_LIB}
  
  include ${PETSC_DIR}/conf/variables
  include ${PETSC_DIR}/conf/rules
  Email had 1 attachment:
  + Attachment2
1k (application/pgp-signature)
 
  ~/dev/test/petsc $ cat makefile
  myexample: myexample.o solver.o
  ${CLINKER} -o $@ $^ ${PETSC_LIB}
 
  include ${PETSC_DIR}/conf/variables
  include ${PETSC_DIR}/conf/rules
  ~/dev/test/petsc $ cat solver.f
subroutine solver()
  #include finclude/petscsys.h
 
 Name your source file solver.F so that the Fortran compiler preprocesses
 it.  (Or add the option -cpp, but that is more confusing and less
 portable, so rename the source file.)
 Email had 1 attachment:
 + Attachment2
   1k (application/pgp-signature)

~/dev/test/petsc $ mv solver.f solver.F
~/dev/test/petsc $ make
gfortran -c  -fPIC -Wall -Wno-unused-variable -g  -fopenmp  
-I/home/username/petsc/include -I/home/username/petsc/linux-amd64/include 
-I/home/username/petsc/include/mpiuni-o solver.o solver.F
solver.F:8.46:

  if (ierr .ne. 0) call MPI_Abort(PETSC_COMM_WORLD,ierr,ierr
  1
Error: Missing ')' in statement at or before (1)
solver.F:8.72:

  if (ierr .ne. 0) call MPI_Abort(PETSC_COMM_WORLD,ierr,ierr
1
Warning: Line truncated at (1)
solver.F:13.46:

  if (ierr .ne. 0) call MPI_Abort(PETSC_COMM_WORLD,ierr,ierr
  1
Error: Missing ')' in statement at or before (1)
solver.F:13.72:

  if (ierr .ne. 0) call MPI_Abort(PETSC_COMM_WORLD,ierr,ierr
1
Warning: Line truncated at (1)
make: [solver.o] Error 1 (ignored)
gcc -fopenmp -fopenmp   -fPIC -Wall -Wwrite-strings -Wno-strict-aliasing 
-Wno-unknown-pragmas -g3 -fno-inline -O0 -fopenmp  -o myexample myexample.o 
solver.o -Wl,-rpath,/home/username/petsc/linux-amd64/lib 
-L/home/username/petsc/linux-amd64/lib  -lpetsc 
-Wl,-rpath,/home/username/petsc/linux-amd64/lib -lflapack -lfblas -lX11 
-lpthread -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/4.4.7 
-L/usr/lib/gcc/x86_64-redhat-linux/4.4.7 -lgfortran -lm -lm -lstdc++ -lstdc++ 
-ldl -lgcc_s -ldl
gcc: solver.o: No such file or directory
make: *** [myexample] Error 1
~/dev/test/petsc $ 


Re: [petsc-dev] openmp

2013-11-06 Thread Jed Brown
Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:

 ~/dev/test/petsc $ mv solver.f solver.F
 ~/dev/test/petsc $ make
 gfortran -c  -fPIC -Wall -Wno-unused-variable -g  -fopenmp  
 -I/home/username/petsc/include -I/home/username/petsc/linux-amd64/include 
 -I/home/username/petsc/include/mpiuni-o solver.o solver.F
 solver.F:8.46:

   if (ierr .ne. 0) call MPI_Abort(PETSC_COMM_WORLD,ierr,ierr
   1
 Error: Missing ')' in statement at or before (1)

You indented so far that the expanded macro spilled over the
72-character line length needed to fit on a punch card in the 1950s.  If
you would like to modernize your Fortran dialect beyond the constraints
of punch cards, you could consider naming your file .F90 or adding the
option -ffree-form, perhaps also with -ffree-line-length-none.


pgpSZ9zDQY7VU.pgp
Description: PGP signature


Re: [petsc-dev] openmp

2013-11-06 Thread Svetlana Tkachenko


On Thu, 7 Nov 2013, at 12:56, Jed Brown wrote:
 Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:
 
  ~/dev/test/petsc $ mv solver.f solver.F
  ~/dev/test/petsc $ make
  gfortran -c  -fPIC -Wall -Wno-unused-variable -g  -fopenmp  
  -I/home/username/petsc/include 
  -I/home/username/petsc/linux-amd64/include 
  -I/home/username/petsc/include/mpiuni-o solver.o solver.F
  solver.F:8.46:
 
if (ierr .ne. 0) call MPI_Abort(PETSC_COMM_WORLD,ierr,ierr
1
  Error: Missing ')' in statement at or before (1)
 
 You indented so far that the expanded macro spilled over the
 72-character line length needed to fit on a punch card in the 1950s.  If
 you would like to modernize your Fortran dialect beyond the constraints
 of punch cards, you could consider naming your file .F90 or adding the
 option -ffree-form, perhaps also with -ffree-line-length-none.
 Email had 1 attachment:
 + Attachment2
   1k (application/pgp-signature)

Thanks! I need to apologize as I didn't mention it in the previous message:  in 
my solver.F no I did not exceed the line length and I don't know what it is 
referring to even. That line is not mine.

  Svetlana


Re: [petsc-dev] openmp

2013-11-06 Thread Jed Brown
Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:
 Thanks! I need to apologize as I didn't mention it in the previous
 message: in my solver.F no I did not exceed the line length and I
 don't know what it is referring to even. That line is not mine.

It is the expanded error checking macro.  Fortran does not provide a
concise way to do error checking except to use the C preprocessor, but
the line length requirements apply to the _expanded_ macro.  Fortran is
a perpetual nuisance, but once you learn about all the potholes, barbed
wire, broken glass, and polonium in the food, it's possible to get by.


pgpsPLnLrMrN4.pgp
Description: PGP signature


Re: [petsc-dev] openmp

2013-11-06 Thread Svetlana Tkachenko
On Thu, 7 Nov 2013, at 13:51, Jed Brown wrote:
 Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:
 
  On Thu, 7 Nov 2013, at 12:56, Jed Brown wrote:
  Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:
  
   ~/dev/test/petsc $ mv solver.f solver.F
   ~/dev/test/petsc $ make
   gfortran -c  -fPIC -Wall -Wno-unused-variable -g  -fopenmp  
   -I/home/username/petsc/include 
   -I/home/username/petsc/linux-amd64/include 
   -I/home/username/petsc/include/mpiuni-o solver.o solver.F
   solver.F:8.46:
  
 if (ierr .ne. 0) call MPI_Abort(PETSC_COMM_WORLD,ierr,ierr
 1
   Error: Missing ')' in statement at or before (1)
  
  You indented so far that the expanded macro spilled over the
  72-character line length needed to fit on a punch card in the 1950s.  If
  you would like to modernize your Fortran dialect beyond the constraints
  of punch cards, you could consider naming your file .F90 or adding the
  option -ffree-form, perhaps also with -ffree-line-length-none.
  Email had 1 attachment:
  + Attachment2
1k (application/pgp-signature)
 
  Thank you for the advice.
  I've named both files .F90 and now that's what it's got.
 
  ~/dev/test/petsc $ ls
  makefile  myexample.F90  solver.F90
  ~/dev/test/petsc $ make
  gfortran -c  -fPIC -Wall -Wno-unused-variable -g  -fopenmp  
  -I/home/username/petsc/include 
  -I/home/username/petsc/linux-amd64/include 
  -I/home/username/petsc/include/mpiuni-o myexample.o myexample.F90
  gfortran -c  -fPIC -Wall -Wno-unused-variable -g  -fopenmp  
  -I/home/username/petsc/include 
  -I/home/username/petsc/linux-amd64/include 
  -I/home/username/petsc/include/mpiuni-o solver.o solver.F90
  gcc -fopenmp -fopenmp   -fPIC -Wall -Wwrite-strings -Wno-strict-aliasing 
  -Wno-unknown-pragmas -g3 -fno-inline -O0 -fopenmp  -o myexample myexample.o 
  solver.o -Wl,-rpath,/home/username/petsc/linux-amd64/lib 
  -L/home/username/petsc/linux-amd64/lib  -lpetsc 
  -Wl,-rpath,/home/username/petsc/linux-amd64/lib -lflapack -lfblas -lX11 
  -lpthread -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/4.4.7 
  -L/usr/lib/gcc/x86_64-redhat-linux/4.4.7 -lgfortran -lm -lm -lstdc++ 
  -lstdc++ -ldl -lgcc_s -ldl
  /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/crt1.o: In 
  function `_start':
  (.text+0x20): undefined reference to `main'
 
 What do you expect?  Your file only contains a subroutine, no program.

What do you mean? (I don't think the program name has to be 'main'.).

~/dev/test/petsc $ cat myexample.F90
   program myexample

   call solver
   end
~/dev/test/petsc $


Re: [petsc-dev] openmp

2013-11-06 Thread Jed Brown
Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:
 What do you mean? (I don't think the program name has to be 'main'.).

No, it doesn't.  The name is meaningless in Fortran, but you need to use
the keyword program.

 ~/dev/test/petsc $ cat myexample.F90
program myexample

call solver
end
 ~/dev/test/petsc $

Add myexample.o to the makefile so it gets compiled.


pgpwF5jw09bs9.pgp
Description: PGP signature


Re: [petsc-dev] openmp

2013-11-06 Thread Svetlana Tkachenko


On Thu, 7 Nov 2013, at 13:59, Jed Brown wrote:
 Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:
  What do you mean? (I don't think the program name has to be 'main'.).
 
 No, it doesn't.  The name is meaningless in Fortran, but you need to use
 the keyword program.
 
  ~/dev/test/petsc $ cat myexample.F90
 program myexample
 
 call solver
 end
  ~/dev/test/petsc $
 
 Add myexample.o to the makefile so it gets compiled.

Already did, please, see:

~/dev/test/petsc $ cat makefile
myexample: myexample.o solver.o
${CLINKER} -o $@ $^ ${PETSC_LIB}

include ${PETSC_DIR}/conf/variables
include ${PETSC_DIR}/conf/rules
~/dev/test/petsc $


Re: [petsc-dev] openmp

2013-11-06 Thread Jed Brown
Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:

 On Thu, 7 Nov 2013, at 13:59, Jed Brown wrote:
 Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:
  What do you mean? (I don't think the program name has to be 'main'.).
 
 No, it doesn't.  The name is meaningless in Fortran, but you need to use
 the keyword program.
 
  ~/dev/test/petsc $ cat myexample.F90
 program myexample
 
 call solver
 end
  ~/dev/test/petsc $
 
 Add myexample.o to the makefile so it gets compiled.

 Already did, please, see:

 ~/dev/test/petsc $ cat makefile
 myexample: myexample.o solver.o
 ${CLINKER} -o $@ $^ ${PETSC_LIB}

 include ${PETSC_DIR}/conf/variables
 include ${PETSC_DIR}/conf/rules
 ~/dev/test/petsc $

Run make clean; make.  If you get the same error, check

$ nm myexample.o
 U _gfortran_set_args
 U _gfortran_set_options
 U _GLOBAL_OFFSET_TABLE_
 T main
 r options.0.1881
 U solver_



pgpwhLIKSRraS.pgp
Description: PGP signature


Re: [petsc-dev] openmp

2013-11-06 Thread Svetlana Tkachenko


On Thu, 7 Nov 2013, at 14:15, Jed Brown wrote:
 Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:
 
  On Thu, 7 Nov 2013, at 13:59, Jed Brown wrote:
  Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:
   What do you mean? (I don't think the program name has to be 'main'.).
  
  No, it doesn't.  The name is meaningless in Fortran, but you need to use
  the keyword program.
  
   ~/dev/test/petsc $ cat myexample.F90
  program myexample
  
  call solver
  end
   ~/dev/test/petsc $
  
  Add myexample.o to the makefile so it gets compiled.
 
  Already did, please, see:
 
  ~/dev/test/petsc $ cat makefile
  myexample: myexample.o solver.o
  ${CLINKER} -o $@ $^ ${PETSC_LIB}
 
  include ${PETSC_DIR}/conf/variables
  include ${PETSC_DIR}/conf/rules
  ~/dev/test/petsc $
 
 Run make clean; make.  If you get the same error, check
 
 $ nm myexample.o
  U _gfortran_set_args
  U _gfortran_set_options
  U _GLOBAL_OFFSET_TABLE_
  T main
  r options.0.1881
  U solver_
 

~/dev/test/petsc $ make clean
~/dev/test/petsc $ make
gfortran -c  -fPIC -Wall -Wno-unused-variable -g  -fopenmp  
-I/home/username/petsc/include -I/home/username/petsc/linux-amd64/include 
-I/home/username/petsc/include/mpiuni-o myexample.o myexample.F90
gfortran -c  -fPIC -Wall -Wno-unused-variable -g  -fopenmp  
-I/home/username/petsc/include -I/home/username/petsc/linux-amd64/include 
-I/home/username/petsc/include/mpiuni-o solver.o solver.F90
gcc -fopenmp -fopenmp   -fPIC -Wall -Wwrite-strings -Wno-strict-aliasing 
-Wno-unknown-pragmas -g3 -fno-inline -O0 -fopenmp  -o myexample myexample.o 
solver.o -Wl,-rpath,/home/username/petsc/linux-amd64/lib 
-L/home/username/petsc/linux-amd64/lib  -lpetsc 
-Wl,-rpath,/home/username/petsc/linux-amd64/lib -lflapack -lfblas -lX11 
-lpthread -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/4.4.7 
-L/usr/lib/gcc/x86_64-redhat-linux/4.4.7 -lgfortran -lm -lm -lstdc++ -lstdc++ 
-ldl -lgcc_s -ldl
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/crt1.o: In function 
`_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [myexample] Error 1
~/dev/test/petsc $ nm myexample.o
 T MAIN__
 U _GLOBAL_OFFSET_TABLE_
 U _gfortran_set_options
 r options.0.1516
 U solver_
~/dev/test/petsc $



Re: [petsc-dev] openmp

2013-11-06 Thread Svetlana Tkachenko


On Thu, 7 Nov 2013, at 14:22, Svetlana Tkachenko wrote:
 
 
 On Thu, 7 Nov 2013, at 14:15, Jed Brown wrote:
  Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:
  
   On Thu, 7 Nov 2013, at 13:59, Jed Brown wrote:
   Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:
What do you mean? (I don't think the program name has to be 'main'.).
   
   No, it doesn't.  The name is meaningless in Fortran, but you need to use
   the keyword program.
   
~/dev/test/petsc $ cat myexample.F90
   program myexample
   
   call solver
   end
~/dev/test/petsc $
   
   Add myexample.o to the makefile so it gets compiled.
  
   Already did, please, see:
  
   ~/dev/test/petsc $ cat makefile
   myexample: myexample.o solver.o
   ${CLINKER} -o $@ $^ ${PETSC_LIB}
  
   include ${PETSC_DIR}/conf/variables
   include ${PETSC_DIR}/conf/rules
   ~/dev/test/petsc $
  
  Run make clean; make.  If you get the same error, check
  
  $ nm myexample.o
   U _gfortran_set_args
   U _gfortran_set_options
   U _GLOBAL_OFFSET_TABLE_
   T main
   r options.0.1881
   U solver_
  
 
 ~/dev/test/petsc $ make clean
 ~/dev/test/petsc $ make
 gfortran -c  -fPIC -Wall -Wno-unused-variable -g  -fopenmp  
 -I/home/username/petsc/include -I/home/username/petsc/linux-amd64/include 
 -I/home/username/petsc/include/mpiuni-o myexample.o myexample.F90
 gfortran -c  -fPIC -Wall -Wno-unused-variable -g  -fopenmp  
 -I/home/username/petsc/include -I/home/username/petsc/linux-amd64/include 
 -I/home/username/petsc/include/mpiuni-o solver.o solver.F90
 gcc -fopenmp -fopenmp   -fPIC -Wall -Wwrite-strings -Wno-strict-aliasing 
 -Wno-unknown-pragmas -g3 -fno-inline -O0 -fopenmp  -o myexample myexample.o 
 solver.o -Wl,-rpath,/home/username/petsc/linux-amd64/lib 
 -L/home/username/petsc/linux-amd64/lib  -lpetsc 
 -Wl,-rpath,/home/username/petsc/linux-amd64/lib -lflapack -lfblas -lX11 
 -lpthread -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/4.4.7 
 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.7 -lgfortran -lm -lm -lstdc++ -lstdc++ 
 -ldl -lgcc_s -ldl
 /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/crt1.o: In function 
 `_start':
 (.text+0x20): undefined reference to `main'
 collect2: ld returned 1 exit status
 make: *** [myexample] Error 1
 ~/dev/test/petsc $ nm myexample.o
  T MAIN__
  U _GLOBAL_OFFSET_TABLE_
  U _gfortran_set_options
  r options.0.1516
  U solver_
 ~/dev/test/petsc $
 

Using FLINKER instead of CLINKER in the makefile gets it to compile without 
errors. However, the previous behaviour persists (?).

~/dev/test/petsc $ make
gfortran -c  -fPIC -Wall -Wno-unused-variable -g  -fopenmp  
-I/home/username/petsc/include -I/home/username/petsc/linux-amd64/include 
-I/home/username/petsc/include/mpiuni-o myexample.o myexample.F90
gfortran -c  -fPIC -Wall -Wno-unused-variable -g  -fopenmp  
-I/home/username/petsc/include -I/home/username/petsc/linux-amd64/include 
-I/home/username/petsc/include/mpiuni-o solver.o solver.F90
gfortran -fopenmp -fopenmp   -fPIC -Wall -Wno-unused-variable -g  -fopenmp  -o 
myexample myexample.o solver.o 
-Wl,-rpath,/home/username/petsc/linux-amd64/lib 
-L/home/username/petsc/linux-amd64/lib  -lpetsc 
-Wl,-rpath,/home/username/petsc/linux-amd64/lib -lflapack -lfblas -lX11 
-lpthread -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/4.4.7 
-L/usr/lib/gcc/x86_64-redhat-linux/4.4.7 -lgfortran -lm -lm -lstdc++ -lstdc++ 
-ldl -lgcc_s -ldl
~/dev/test/petsc $ ./myexample
 Entered petsc.
 Init done.
WARNING! There are options you set that were not used!
WARNING! could be spelling mistake, etc!
Option left: name:-threadcomm_nthreads value: 8
Option left: name:-threadcomm_type value: openmp
 Finalized.
~/dev/test/petsc $


Re: [petsc-dev] openmp

2013-11-06 Thread Svetlana Tkachenko


On Thu, 7 Nov 2013, at 14:24, Svetlana Tkachenko wrote:
 
 
 On Thu, 7 Nov 2013, at 14:22, Svetlana Tkachenko wrote:
  
  
  On Thu, 7 Nov 2013, at 14:15, Jed Brown wrote:
   Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:
   
On Thu, 7 Nov 2013, at 13:59, Jed Brown wrote:
Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:
 What do you mean? (I don't think the program name has to be 'main'.).

No, it doesn't.  The name is meaningless in Fortran, but you need to 
use
the keyword program.

 ~/dev/test/petsc $ cat myexample.F90
program myexample

call solver
end
 ~/dev/test/petsc $

Add myexample.o to the makefile so it gets compiled.
   
Already did, please, see:
   
~/dev/test/petsc $ cat makefile
myexample: myexample.o solver.o
${CLINKER} -o $@ $^ ${PETSC_LIB}
   
include ${PETSC_DIR}/conf/variables
include ${PETSC_DIR}/conf/rules
~/dev/test/petsc $
   
   Run make clean; make.  If you get the same error, check
   
   $ nm myexample.o
U _gfortran_set_args
U _gfortran_set_options
U _GLOBAL_OFFSET_TABLE_
    T main
    r options.0.1881
U solver_
   
  
  ~/dev/test/petsc $ make clean
  ~/dev/test/petsc $ make
  gfortran -c  -fPIC -Wall -Wno-unused-variable -g  -fopenmp  
  -I/home/username/petsc/include 
  -I/home/username/petsc/linux-amd64/include 
  -I/home/username/petsc/include/mpiuni-o myexample.o myexample.F90
  gfortran -c  -fPIC -Wall -Wno-unused-variable -g  -fopenmp  
  -I/home/username/petsc/include 
  -I/home/username/petsc/linux-amd64/include 
  -I/home/username/petsc/include/mpiuni-o solver.o solver.F90
  gcc -fopenmp -fopenmp   -fPIC -Wall -Wwrite-strings -Wno-strict-aliasing 
  -Wno-unknown-pragmas -g3 -fno-inline -O0 -fopenmp  -o myexample myexample.o 
  solver.o -Wl,-rpath,/home/username/petsc/linux-amd64/lib 
  -L/home/username/petsc/linux-amd64/lib  -lpetsc 
  -Wl,-rpath,/home/username/petsc/linux-amd64/lib -lflapack -lfblas -lX11 
  -lpthread -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/4.4.7 
  -L/usr/lib/gcc/x86_64-redhat-linux/4.4.7 -lgfortran -lm -lm -lstdc++ 
  -lstdc++ -ldl -lgcc_s -ldl
  /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/crt1.o: In 
  function `_start':
  (.text+0x20): undefined reference to `main'
  collect2: ld returned 1 exit status
  make: *** [myexample] Error 1
  ~/dev/test/petsc $ nm myexample.o
   T MAIN__
   U _GLOBAL_OFFSET_TABLE_
   U _gfortran_set_options
   r options.0.1516
   U solver_
  ~/dev/test/petsc $
  
 
 Using FLINKER instead of CLINKER in the makefile gets it to compile without 
 errors. However, the previous behaviour persists (?).
 
 ~/dev/test/petsc $ make
 gfortran -c  -fPIC -Wall -Wno-unused-variable -g  -fopenmp  
 -I/home/username/petsc/include -I/home/username/petsc/linux-amd64/include 
 -I/home/username/petsc/include/mpiuni-o myexample.o myexample.F90
 gfortran -c  -fPIC -Wall -Wno-unused-variable -g  -fopenmp  
 -I/home/username/petsc/include -I/home/username/petsc/linux-amd64/include 
 -I/home/username/petsc/include/mpiuni-o solver.o solver.F90
 gfortran -fopenmp -fopenmp   -fPIC -Wall -Wno-unused-variable -g  -fopenmp  
 -o myexample myexample.o solver.o 
 -Wl,-rpath,/home/username/petsc/linux-amd64/lib 
 -L/home/username/petsc/linux-amd64/lib  -lpetsc 
 -Wl,-rpath,/home/username/petsc/linux-amd64/lib -lflapack -lfblas -lX11 
 -lpthread -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/4.4.7 
 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.7 -lgfortran -lm -lm -lstdc++ -lstdc++ 
 -ldl -lgcc_s -ldl
 ~/dev/test/petsc $ ./myexample
  Entered petsc.
  Init done.
 WARNING! There are options you set that were not used!
 WARNING! could be spelling mistake, etc!
 Option left: name:-threadcomm_nthreads value: 8
 Option left: name:-threadcomm_type value: openmp
  Finalized.
 ~/dev/test/petsc $

Correction:
Not previous behaviour, rather, new behaviour...


Re: [petsc-dev] openmp

2013-11-06 Thread Jed Brown
Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:
 Using FLINKER instead of CLINKER in the makefile gets it to compile without 
 errors. However, the previous behaviour persists (?).

 ~/dev/test/petsc $ make
 gfortran -c  -fPIC -Wall -Wno-unused-variable -g  -fopenmp  
 -I/home/username/petsc/include -I/home/username/petsc/linux-amd64/include 
 -I/home/username/petsc/include/mpiuni-o myexample.o myexample.F90
 gfortran -c  -fPIC -Wall -Wno-unused-variable -g  -fopenmp  
 -I/home/username/petsc/include -I/home/username/petsc/linux-amd64/include 
 -I/home/username/petsc/include/mpiuni-o solver.o solver.F90
 gfortran -fopenmp -fopenmp   -fPIC -Wall -Wno-unused-variable -g  -fopenmp  
 -o myexample myexample.o solver.o 
 -Wl,-rpath,/home/username/petsc/linux-amd64/lib 
 -L/home/username/petsc/linux-amd64/lib  -lpetsc 
 -Wl,-rpath,/home/username/petsc/linux-amd64/lib -lflapack -lfblas -lX11 
 -lpthread -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/4.4.7 
 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.7 -lgfortran -lm -lm -lstdc++ -lstdc++ 
 -ldl -lgcc_s -ldl
 ~/dev/test/petsc $ ./myexample
  Entered petsc.
  Init done.
 WARNING! There are options you set that were not used!
 WARNING! could be spelling mistake, etc!
 Option left: name:-threadcomm_nthreads value: 8
 Option left: name:-threadcomm_type value: openmp
  Finalized.
 ~/dev/test/petsc $

Did you add these options to .petscrc?  Run with -log_summary and send
the output so we can see what configuration you are using.  At the top
of this thread, it looks like you did not configure --with-threadcomm.
I recommend using --with-threadcomm --with-pthreadclasses --with-openmp.


pgpZSqrY9qtwK.pgp
Description: PGP signature


Re: [petsc-dev] openmp

2013-11-06 Thread Svetlana Tkachenko
On Thu, 7 Nov 2013, at 12:56, Jed Brown wrote:
 Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:
 
  ~/dev/test/petsc $ mv solver.f solver.F
  ~/dev/test/petsc $ make
  gfortran -c  -fPIC -Wall -Wno-unused-variable -g  -fopenmp  
  -I/home/username/petsc/include 
  -I/home/username/petsc/linux-amd64/include 
  -I/home/username/petsc/include/mpiuni-o solver.o solver.F
  solver.F:8.46:
 
if (ierr .ne. 0) call MPI_Abort(PETSC_COMM_WORLD,ierr,ierr
1
  Error: Missing ')' in statement at or before (1)
 
 You indented so far that the expanded macro spilled over the
 72-character line length needed to fit on a punch card in the 1950s.  If
 you would like to modernize your Fortran dialect beyond the constraints
 of punch cards, you could consider naming your file .F90 or adding the
 option -ffree-form, perhaps also with -ffree-line-length-none.


For the bigger (non-test) project, I would really make use of --free-whatever 
options you gave. But simply writing prog: prog.o foo.o ${FLINKER} -ffree-form 
-o $@ $^ ${PETSC_LIB}, and looking at 'make' output, shows that it ignored my 
lines entirely and keeps trying to compile without -ffree-form.


Re: [petsc-dev] openmp

2013-11-06 Thread Jed Brown
Svetlana Tkachenko svetlana.tkache...@fastmail.fm writes:
 For the bigger (non-test) project, I would really make use of
 --free-whatever options you gave. But simply writing prog: prog.o
 foo.o ${FLINKER} -ffree-form -o $@ $^ ${PETSC_LIB}, and looking at
 'make' output, shows that it ignored my lines entirely and keeps
 trying to compile without -ffree-form.

These are *compiler* options, not *linker* options.  Put it in FFLAGS instead.

make FFLAGS=-ffree-form



pgp8WTt6ay3OO.pgp
Description: PGP signature