[petsc-users] compiling code that uses Petsc and Sundials
Satish Balay
balay at mcs.anl.gov
Sun Apr 5 13:32:48 CDT 2015
1. you can always rebuild PETSc on the "local supercomputer"
Just grab the reconfigure_arch.py script from the current install [to
capture the recommended mpi, blas etc..] - modify it as you need - and
rerun it with your copy of PETSc sources.
Wrt your install of sundials [assuming its built with the same compilers, mpi etc..
the following might work..
Satish
----------
$ cat makefile
MYSUNDIALS_INCLUDE = -I/path/to/my-sundials/include
MYSUNDIALS_LIB = -L/path/to/my-sundials -sundials_cvode -lsundials_nvecserial -lsundials_nvecparallel
CPPFLAGS = ${MYSUNDIALS_INCLUDE}
CLEANFILES = *.dat *.vtk *.vts ex15 *.o sk2d *~
include ${PETSC_DIR}/conf/variables
include ${PETSC_DIR}/conf/rules
sk2d: sk2d.o chkopts
-${CLINKER} -o sk2d sk2d.o ${PETSC_TS_LIB} ${MYSUNDIALS_LIB} ${BLASLAPACK_LIB} ${MPI_LIB} -lm -inline-calloc
On Sun, 5 Apr 2015, Sanjay Kharche wrote:
>
> Dear All
>
> I would like to compile my code that uses Petsc and Sundials using a morph of the petsc makefile on my supercomputer. There are a few technical issues that I will appreciate your feedback on.
>
> My code uses Petsc and Sundials. On my local machine, I installed Petsc with Sundials. The makefile examples I got allow me to compile my code which is a single file. I can see that -lsundials_cvode -lsundials_nvecserial -lsundials_nvecparallel are all there, as well as the blas lapack. Pasted below is my simple makefile and what happens when I make sk2d
>
> Now I want to port my code to our local supercomputer, where I am not admin. The admin have installed petsc. I managed to compile and run the examples of that install - so it works on its own. This copy of petsc was not installed by connecting to Sundials. Therefore, I have installed sundials in my home directory. I tried to add the sundials paths in the makefile below at various locations (in fact, I could not work out where exactly to put the includes and libs!), but I could not get my code to compile. Any suggestions?
>
> cheers
> Sanjay
>
> Local computer makefile:
> cat makefile
>
> include ${PETSC_DIR}/conf/variables
> include ${PETSC_DIR}/conf/rules
>
> sk2d: sk2d.o chkopts
> -${CLINKER} -o sk2d sk2d.o ${PETSC_TS_LIB} -lm -inline-calloc
>
> veryclean:
> rm -rf *.dat *.vtk *.vts ex15 *.o sk2d *~
>
> output of make sk2d:
>
> make sk2d
> /media/6c6201d2-4e2e-4b24-8d04-263b5bc06dfa/sanjay/petsc/linux-gnu-c-debug/bin/mpicc -o sk2d.o -c -fPIC -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -g3 -O0 -I/export2/sanjay/petsc/include -I/export2/sanjay/petsc/linux-gnu-c-debug/include -I/media/6c6201d2-4e2e-4b24-8d04-263b5bc06dfa/sanjay/petsc/linux-gnu-c-debug/include `pwd`/sk2d.c
> /export2/sanjay/mypetscProgs/Work/twod/sk2d.c: In function ‘main’:
> /export2/sanjay/mypetscProgs/Work/twod/sk2d.c:112:24: warning: variable ‘usr_time’ set but not used [-Wunused-but-set-variable]
> /export2/sanjay/mypetscProgs/Work/twod/sk2d.c:111:7: warning: unused variable ‘output’ [-Wunused-variable]
> /export2/sanjay/mypetscProgs/Work/twod/sk2d.c:101:72: warning: unused variable ‘usr_nbs’ [-Wunused-variable]
> /media/6c6201d2-4e2e-4b24-8d04-263b5bc06dfa/sanjay/petsc/linux-gnu-c-debug/bin/mpicc -fPIC -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -g3 -O0 -o sk2d sk2d.o -Wl,-rpath,/export2/sanjay/petsc/linux-gnu-c-debug/lib -L/export2/sanjay/petsc/linux-gnu-c-debug/lib -lpetsc -Wl,-rpath,/media/6c6201d2-4e2e-4b24-8d04-263b5bc06dfa/sanjay/petsc/linux-gnu-c-debug/lib -L/media/6c6201d2-4e2e-4b24-8d04-263b5bc06dfa/sanjay/petsc/linux-gnu-c-debug/lib -lscalapack -lsundials_cvode -lsundials_nvecserial -lsundials_nvecparallel -lflapack -lfblas -lX11 -lssl -lcrypto -lpthread -lm -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/4.6.3 -L/usr/lib/gcc/x86_64-redhat-linux/4.6.3 -lmpichf90 -lgfortran -lm -lgfortran -lm -lquadmath -lm -lmpichcxx -lstdc++ -Wl,-rpath,/media/6c6201d2-4e2e-4b24-8d04-263b5bc06dfa/sanjay/petsc/linux-gnu-c-debug/lib -L/media/6c6201d2-4e2e-4b24-8d04-263b5bc06dfa/sanjay/petsc/linux-gnu-c-debug/lib -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/4.6.3 -L/usr/lib/gcc/x86_64-redhat-linux/4.6.3 -ldl -Wl,-rpath,/media/6c6201d2-4e2e-4b24-8d04-263b5bc06dfa/sanjay/petsc/linux-gnu-c-debug/lib -lmpich -lopa -lmpl -lrt -lpthread -lgcc_s -ldl -lm -inline-calloc
>
More information about the petsc-users
mailing list