[petsc-dev] openmp

Svetlana Tkachenko svetlana.tkachenko at fastmail.fm
Wed Nov 6 21:55:54 CST 2013



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.tkachenko at fastmail.fm> writes:
> > > 
> > > > On Thu, 7 Nov 2013, at 13:59, Jed Brown wrote:
> > > >> Svetlana Tkachenko <svetlana.tkachenko at 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_
> > > 0000000000000000 T main
> > > 0000000000000000 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
> > 0000000000000000 T MAIN__
> >                  U _GLOBAL_OFFSET_TABLE_
> >                  U _gfortran_set_options
> > 0000000000000000 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...



More information about the petsc-dev mailing list