dmalhotra / pvfmm

A parallel kernel-independent FMM library for particle and volume potentials
http://pvfmm.org
GNU Lesser General Public License v3.0
52 stars 29 forks source link

Kernel evaluation - non-symmetric #8

Closed thomasgillis closed 6 years ago

thomasgillis commented 6 years ago

Dear All,

I am new to pvFMM and trying to use a non-symmetric kernel. As a first test, I changed the laplace_potent_kernel to be non-symmetric (as given in the diff below)

Running the classical exemple1 with the potential kernel const pvfmm::Kernel<double>& kernel_fn=pvfmm::LaplaceKernel<double>::potential(); indicates me that the kernel is non-symmetric and then segfaults in the U2U part:

InitFMM_Pts {
no-symmetry for: laplace
    LoadMatrices {
        ReadFile {
        }
        Broadcast {
        }
    }
//some other output...
RunFMM {
    UpwardPass {
        S2U {
        }
        U2U {
 *** Process received signal ***
 Signal: Segmentation fault: 11 (11)
Signal code:  (0)
Failing at address: 0x0
*** End of error message ***
Segmentation fault: 11

Do you have any tip/idea of what is going on? Do you support non-symmetric kernels?

diff --git a/include/kernel.txx b/include/kernel.txx
index 7867086..f919a8b 100755
--- a/include/kernel.txx
+++ b/include/kernel.txx
@@ -1108,7 +1108,7 @@ void laplace_poten_uKernel(Matrix<Real_t>& src_coord, Matrix<Real_t>& src_value,

         Vec_t r2=        mul_intrin(dx,dx) ;
         r2=add_intrin(r2,mul_intrin(dy,dy));
-        r2=add_intrin(r2,mul_intrin(dz,dz));
+        //r2=add_intrin(r2,mul_intrin(dz,dz));

         Vec_t rinv=RSQRT_INTRIN(r2);
         tv=add_intrin(tv,mul_intrin(rinv,sv));
@@ -1405,8 +1405,8 @@ void laplace_grad(T* r_src, int src_cnt, T* v_src, int dof, T* r_trg, int trg_cn

 template<class T> const Kernel<T>& LaplaceKernel<T>::potential(){
-  static Kernel<T> potn_ker=BuildKernel<T, laplace_poten<T,1>, laplace_dbl_poten<T,1> >("laplace"     , 3, std::pair<int,int>(1,1),
-      NULL,NULL,NULL, NULL,NULL,NULL, NULL,NULL, &laplace_vol_poten<T>);
+  static Kernel<T> potn_ker=BuildKernel<T, laplace_poten<T,1> >("laplace"     , 3, std::pair<int,int>(1,1),
+      NULL,NULL,NULL, NULL,NULL,NULL, NULL,NULL,NULL,false);
   return potn_ker;
 }
 template<class T> const Kernel<T>& LaplaceKernel<T>::gradient(){
@@ -1418,8 +1418,8 @@ template<class T> const Kernel<T>& LaplaceKernel<T>::gradient(){

 template<> inline const Kernel<double>& LaplaceKernel<double>::potential(){
   typedef double T;
-  static Kernel<T> potn_ker=BuildKernel<T, laplace_poten<T,2>, laplace_dbl_poten<T,2> >("laplace"     , 3, std::pair<int,int>(1,1),
-      NULL,NULL,NULL, NULL,NULL,NULL, NULL,NULL, &laplace_vol_poten<double>);
+  static Kernel<T> potn_ker=BuildKernel<T, laplace_poten<T,2> >("laplace"     , 3, std::pair<int,int>(1,1),
+      NULL,NULL,NULL, NULL,NULL,NULL, NULL,NULL,NULL,false);
   return potn_ker;
 }
 template<> inline const Kernel<double>& LaplaceKernel<double>::gradient(){

PS: I am runing on MacOS and compiled with

./configure MPICXX=mpic++ CXX=icpc CC=icc F77=ifort CXXFLAGS="-mavx -g -std=c++11" CFLAGS="-mavx -g" FFLAGS="-mavx -g" --prefix=/opt/intel/intel_lib/pvfmm-1.0.0 --with-openmp-flag="qopenmp" --with-fftw-include="${FFTW_INC}" --with-fftw-lib="-mkl" --with-blas="-mkl" --with-lapack="-mkl" --disable-doxygen-doc --disable-doxygen-dot --disable-doxygen-html
dmalhotra commented 6 years ago

PVFMM doesn't support non-symmetric kernels. In addition, the kernel independent scheme that PVFMM uses can only handle kernels which are solutions of elliptic PDEs; however, your kernel function does not solve an elliptic PDE.

So, this cannot be done with PVFMM.