[petsc-users] Beginner : question about fortran modules and makefile

Satish Balay balay at mcs.anl.gov
Wed Jun 14 10:48:16 CDT 2017


BTW: you might consider using 'master' branch from petsc git repo. The
fortran module support is revamped in it.

Satish

On Wed, 14 Jun 2017, Satish Balay wrote:

> attaching fixed files.
> 
> $ make test
> mpif90 -c -fPIC -Wall -ffree-line-length-0 -Wno-unused-dummy-argument -g    -I/home/balay/tmp/petsc/include -I/home/balay/tmp/petsc/arch-linux2-c-debug/include    -o my_module.o my_module.F90
> mpif90 -c -fPIC -Wall -ffree-line-length-0 -Wno-unused-dummy-argument -g    -I/home/balay/tmp/petsc/include -I/home/balay/tmp/petsc/arch-linux2-c-debug/include    -o test.o test.F90
> mpif90 -fPIC -Wall -ffree-line-length-0 -Wno-unused-dummy-argument -g   -o test test.o my_module.o -Wl,-rpath,/home/balay/tmp/petsc/arch-linux2-c-debug/lib -L/home/balay/tmp/petsc/arch-linux2-c-debug/lib -Wl,-rpath,/home/balay/soft/mpich-3.3a2/lib -L/home/balay/soft/mpich-3.3a2/lib -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/7 -L/usr/lib/gcc/x86_64-redhat-linux/7 -lpetsc -llapack -lblas -lX11 -lpthread -lm -lmpifort -lgfortran -lm -lgfortran -lm -lquadmath -lmpicxx -lstdc++ -lm -Wl,-rpath,/home/balay/soft/mpich-3.3a2/lib -L/home/balay/soft/mpich-3.3a2/lib -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/7 -L/usr/lib/gcc/x86_64-redhat-linux/7 -ldl -Wl,-rpath,/home/balay/soft/mpich-3.3a2/lib -lmpi -lgcc_s -ldl 
> $
> 
> Satish
> 
> On Wed, 14 Jun 2017, Fabien Tholin wrote:
> 
> > Hello,
> > 
> > I am a beginner with Petsc and i'm trying
> > 
> > to compile a very simple fortran program "test" with
> > 
> > a calling program in "test.F90" and a module "my_module.F90".
> > 
> > Unfortunately, i do not know how to write properly the makefile
> > 
> > to be able to compile the module with "#include petsc" statements inside:
> > 
> > I can not find any example on how to do it.
> > 
> > here is my non-working makefile:
> > 
> > 
> > CFLAGS         =
> > FFLAGS         =
> > PETSC_DIR=/home/fab/Program/PETSC/petsc-3.7.6
> > PETSC_ARCH=arch-linux2-c-debug
> > FLINKER=mpif90
> > CLINKER=mpicc
> > 
> > include ${PETSC_DIR}/lib/petsc/conf/variables
> > include ${PETSC_DIR}/lib/petsc/conf/rules
> > 
> > list=my_module.o
> > 
> > test: test.o $(list) chkopts
> >     -${FLINKER} -o test test.o  $(list)
> > 
> > my_module.o my_module.mod: my_module.F90
> >     -${FLINKER} -c my_module.F90
> > 
> > 
> > Thank you very much for helping me.
> > 
> > Regards,
> > 
> > Fabien THOLIN
> > 
> 



More information about the petsc-users mailing list