petrbf
petrbf copied to clipboard
does not compile for petsc 3.6.3-1
.../petrbf/3d/rbf_interpolation.cxx: In function ‘PetscErrorCode rbf_interpolation(Vec, Vec, Vec, Vec, Vec, double, int, int, int, int*)’: .../petrbf/3d/rbf_interpolation.cxx:246:59: error: too many arguments to function ‘PetscErrorCode KSPSetOperators(KSP, Mat, Mat)’ ierr = KSPSetOperators(ksp,M,P,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr);
When correcting it to:
ierr = KSPSetOperators(ksp,M,P);CHKERRQ(ierr);
it fails with
||---------------------------------------
|| number of particles : 9261
|| std of Gaussian (sigma) : 0.100000
|| overlap ratio (h/sigma) : 1.000000
|| non-overlapping subdomain : 3 sigma
|| overlapping subdomain : 4 sigma
|| entire domain : 20 sigma
||---------------------------------------
Mat Object: 1 MPI processes
type: shell
0 KSP Residual norm 1.832048169775e-01
[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
[0]PETSC ERROR: Object is in wrong state
[0]PETSC ERROR: Vec is locked read only, argument # 1
[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.6.3, Dec, 03, 2015
[0]PETSC ERROR: ./main on a arch-linux-c-opt named ... Tue Dec 15 11:27:30 2015
[0]PETSC ERROR: Configure options --prefix=/opt/petsc/linux-c-opt --PETSC_ARCH=arch-linux-c-opt --with-shared-libraries=1 --COPTFLAGS=-O3 --CXXOPTFLAGS=-O3 --with-ptscotch=1 --with-ptscotch-lib="[libesmumps.so,libptscotch.so,libptscotcherr.so,libscotch.so,libscotcherr.so,libbz2.so]" --with-ptscotch-include=/usr/include/scotch
[0]PETSC ERROR: #1 VecGetArray() line 1646 in .../petsc/src/petsc-3.6.3/src/vec/vec/interface/rvector.c
[0]PETSC ERROR: #2 mymatmult() line 18 in .../petrbf/3d/matmult.cxx
[0]PETSC ERROR: #3 MatMult() line 2225 in .../src/petsc-3.6.3/src/mat/interface/matrix.c
[0]PETSC ERROR: #4 PCApplyBAorAB() line 727 in .../petsc/src/petsc-3.6.3/src/ksp/pc/interface/precon.c
[0]PETSC ERROR: #5 KSP_PCApplyBAorAB() line 272 in .../petsc/src/petsc-3.6.3/include/petsc/private/kspimpl.h
[0]PETSC ERROR: #6 KSPGMRESCycle() line 155 in .../petsc/src/petsc-3.6.3/src/ksp/ksp/impls/gmres/gmres.c
[0]PETSC ERROR: #7 KSPSolve_GMRES() line 236 in .../petsc/src/petsc-3.6.3/src/ksp/ksp/impls/gmres/gmres.c
[0]PETSC ERROR: #8 KSPSolve() line 604 in .../petsc/src/petsc-3.6.3/src/ksp/ksp/interface/itfunc.c
[0]PETSC ERROR: #9 rbf_interpolation() line 248 in .../petrbf/3d/rbf_interpolation.cxx
error : -0.118701
time : 1.24376
the 2d code compiles after the same change (ierr = KSPSetOperators(ksp,M,P);CHKERRQ(ierr);)
actually, the 2d code also produces:
||---------------------------------------
|| number of particles : 49729
|| std of Gaussian (sigma) : 0.005000
|| overlap ratio (h/sigma) : 0.900000
|| non-overlapping subdomain : 5 sigma
|| overlapping subdomain : 9 sigma
|| entire domain : 400 sigma
||---------------------------------------
Mat Object: 1 MPI processes
type: shell
0 KSP Residual norm 3.388070622363e-03
[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
[0]PETSC ERROR: Object is in wrong state
[0]PETSC ERROR: Vec is locked read only, argument # 1
[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.6.3, Dec, 03, 2015
[0]PETSC ERROR: ./main on a arch-linux-c-opt
[0]PETSC ERROR: Configure options --prefix=/opt/petsc/linux-c-opt --PETSC_ARCH=arch-linux-c-opt --with-shared-libraries=1 --COPTFLAGS=-O3 --CXXOPTFLAGS=-O3 --with-ptscotch=1 --with-ptscotch-lib="[libesmumps.so,libptscotch.so,libptscotcherr.so,libscotch.so,libscotcherr.so,libbz2.so]" --with-ptscotch-include=/usr/include/scotch
As you can see in the history of commits, this code was last changed in 2012. At that time PETSc was on version 3.3 or 3.4 (around there). In recent versions of PETSc, they changed interfaces to many KSP functions. We are not maintaining this code, I'm afraid, and I don't have anyone in the group working with RBFs at this time.
FIX
I've found two older versions of PETSc that seem to work with PetBRF
PETSc v3.5
Compile PETSc v3.5, and modify the following line from both 2d/rbf_interpolation.cxx
and 3d/rbf_interpolation.cxx
:
ierr = KSPSetOperators(ksp,M,P,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr);
to
ierr = KSPSetOperators(ksp,M,P);CHKERRQ(ierr);
PETSc v3.4.5
No modifications to PetRBF are required.
I haven't done extensive testing, but make cpu
compiles and tests with no problem.
ps: I tried compiling PetRBF with both PETSc v3.4 and v3.3 and none of them worked. Only v3.5 with that fix does it, and v3.4.5.
ps2: To build an older version of PETSc, clone the PETSc repo (git clone https://bitbucket.org/petsc/petsc.git
), checkout the version (e.g., git checkout v3.5
), run the configure script (./configure
) and follow its instructions. When compiling PetRBF you'll have to define PETSC_DIR pointing to the build of PETSc.