FreeFem / FreeFem-sources

FreeFEM source code
https://freefem.org/
Other
746 stars 187 forks source link

Conflicts with SuperLU-6.0.0 #272

Closed sagitter closed 1 year ago

sagitter commented 1 year ago

Hi all.

I'm rebuilding freefem-4.12 against SuperLU-6.0.0 but i get these errors:

In file included from SuperLu.cpp:32:
/usr/include/SuperLU/slu_zdefs.h: At global scope:
/usr/include/SuperLU/slu_zdefs.h:239:17: error: conflicting declaration of C function 'double* doubleMalloc(int)'
  239 | extern double  *doubleMalloc(int);
      |                 ^~~~~~~~~~~~
In file included from SuperLu.cpp:29:
/usr/include/SuperLU/slu_ddefs.h:236:17: note: previous declaration 'double* doubleMalloc(size_t)'
  236 | extern double  *doubleMalloc(size_t);
      |                 ^~~~~~~~~~~~
/usr/include/SuperLU/slu_zdefs.h:240:17: error: conflicting declaration of C function 'double* doubleCalloc(int)'
  240 | extern double  *doubleCalloc(int);
      |                 ^~~~~~~~~~~~
/usr/include/SuperLU/slu_ddefs.h:237:17: note: previous declaration 'double* doubleCalloc(size_t)'
  237 | extern double  *doubleCalloc(size_t);
      |                 ^~~~~~~~~~~~
tetgen.cpp: In function 'Fem2D::Mesh3* Convexhull_3Dpoints(char*, const int&, const double*, const double*, const double*, const int&, const int&)':
tetgen.cpp:872:13: warning: variable 'jtet' set but not used [-Wunused-but-set-variable]
  872 |   int itet, jtet;
      |             ^~~~
tetgen.cpp: In function 'Fem2D::Mesh3* RemplissageSurf3D_tetgen(char*, const Fem2D::Mesh3&, const int&)':
tetgen.cpp:939:13: warning: variable 'jtet' set but not used [-Wunused-but-set-variable]
  939 |   int itet, jtet;
      |             ^~~~
tetgen.cpp: In function 'Fem2D::Mesh3* RemplissageSurf3D_tetgen_new(char*, const Fem2D::MeshS&, const int&, const int&, const double*, const int&, const double*, const int&, const double*)':
tetgen.cpp:1037:13: warning: variable 'jtet' set but not used [-Wunused-but-set-variable]
 1037 |   int itet, jtet;
      |             ^~~~
tetgen.cpp: In function 'Fem2D::Mesh3* RemplissageSurf3D_tetgen_new(char*, const Fem2D::Mesh3&, const int&, const int&, const double*, const int&, const double*, const int&, const double*, const int&, const double*, const int&, const double*)':
tetgen.cpp:1163:13: warning: variable 'jtet' set but not used [-Wunused-but-set-variable]
 1163 |   int itet, jtet;
      |             ^~~~
tetgen.cpp: In function 'Fem2D::Mesh3* ReconstructionRefine_tetgen(char*, const Fem2D::Mesh3&, const int&, const double*, const int&, const double*, const int&, const double*, const double*)':
tetgen.cpp:1309:9: warning: unused variable 'lenswitch' [-Wunused-variable]
 1309 |     int lenswitch;
      |         ^~~~~~~~~
tetgen.cpp:1346:13: warning: variable 'jtet' set but not used [-Wunused-but-set-variable]
 1346 |   int itet, jtet;
      |             ^~~~
tetgen.cpp: In function 'Fem2D::Mesh3* ReconstructionRefine_tetgen(char*, const Fem2D::Mesh3&, const int&, const double*, const int&, const double*, const int&, const double*, const double*, const int&, const double*)':
tetgen.cpp:1475:9: warning: unused variable 'lenswitch' [-Wunused-variable]
 1475 |     int lenswitch;
      |         ^~~~~~~~~
tetgen.cpp:1512:13: warning: variable 'jtet' set but not used [-Wunused-but-set-variable]
 1512 |   int itet, jtet;
      |             ^~~~
tetgen.cpp: In member function 'virtual AnyType Remplissage_Op::operator()(Stack) const':
tetgen.cpp:1792:7: warning: unused variable 'sizeofmetric' [-Wunused-variable]
 1792 |   int sizeofmetric = metric.N( ) / Th.nv;
      |       ^~~~~~~~~~~~
tetgen.cpp:1899:7: warning: unused variable 'nbinside' [-Wunused-variable]
 1899 |   int nbinside = InsidePoint.N( ) / 3;

The full build log: here

prj- commented 1 year ago

You should reconfigure with --disable-superlu.

sagitter commented 1 year ago

I skip the problem in this way, cant it be resolved yet?

prj- commented 1 year ago

You'll have to ask SuperLU developers why we can't include both headers while we previously could.

gruenich commented 1 year ago

Looks like an oversight to me. Can you give https://github.com/xiaoyeli/superlu/pull/100 a try and confirm, whether this fixes your issue?

aszaboa commented 1 year ago

I just tried to compile FreeFem, and ran into the same issue. For me, the configure option --disable-superlu fixed the issue

gruenich commented 1 year ago

@aszaboa Can you please double-check that you are using SuperLU Git master and not the 6.0 release? Further, can you share the compiler output?

aszaboa commented 1 year ago

@gruenich I tried to configure PETSc with the option --download-superlu --download-superlu-commit=4e88a0b, but it did not work. I am sharing the config.log file. configure.log

prj- commented 1 year ago

Do not waste your time, just disable SuperLU. For some weeks now, it looks like every merged PR on either SuperLU or SuperLU_DIST repository is breaking something, so frustrating.

gruenich commented 1 year ago

Sorry @aszaboa , for systems with broken or missing Doxygen, I introduced a regression. Your run was plagued by my mistaken. Can you please retry with commit d812a001a6d8e16906fe7376c1688d605391c368 which includes a fix?

gruenich commented 1 year ago

@prj- Sorry for the inconvenience my contributions might cause. I see some room for improving SuperLU, this includes a better system to detect regressions. I hope I will find to address this.

aszaboa commented 1 year ago

@gruenich I tried it and it does not work for me. I think you can sort this issue out on your own. To compile PETSc/FreeFem, I use the following tutorial: https://joliv.et/FreeFem-tutorial/main.html#[197,%22XYZ%22,28.35,272.13,null] (the compilation is in the appendix)

gruenich commented 1 year ago

I need your assistance. I cloned PETSc, configured it (./configure --dowload=superlu --download-superlu-commit=d812a001a6d8e16906fe7376c1688d605391c368 --with-mpi=0), make all, make check. It just worked. I need your configure.log file.

aszaboa commented 1 year ago

These are the exact commands that I use to compile FreeFem+PETSc. These should reproduce the issue. ---------------------------- export FF_DIR=${PWD}/FreeFem-sources export PETSC_DIR=${PWD}/petsc export PETSC_ARCH=arch-FreeFem export PETSC_VAR=${PETSC_DIR}/${PETSC_ARCH} git clone https://github.com/FreeFem/FreeFem-sources.git git clone https://gitlab.com/petsc/petsc cd ${PETSC_DIR} && ./configure --download-mumps --download-parmetis --download-metis --download-hypre --download-superlu --download-slepc --download-hpddm --download-ptscotch --download-suitesparse --download-scalapack --download-tetgen --with-fortran-bindings=no --with-scalar-type=real --with-debugging=no make -j5 export PETSC_ARCH=arch-FreeFem-complex ./configure --with-mumps-dir=arch-FreeFem --with-parmetis-dir=arch-FreeFem --with-metis-dir=arch-FreeFem --with-superlu-dir=arch-FreeFem --download-slepc --download-hpddm --with-ptscotch-dir=arch-FreeFem --with-suitesparse-dir=arch-FreeFem --with-scalapack-dir=arch-FreeFem --with-tetgen-dir=arch-FreeFem --with-fortran-bindings=no --with-scalar-type=complex --with-debugging=no make -j5 cd ${FF_DIR} git checkout develop autoreconf -i ./configure --without-hdf5 --disable-superlu --enable-download_metis --enable-download_parmetis --enable-download_mmg --enable-download_mmg3d --enable-download_parmmg --enable-download_mshmet --enable-download_nlopt --enable-optim --with-petsc=${PETSC_VAR}/lib --with-petsc_complex=${PETSC_VAR}-complex/lib make -j5 ----------------------------

I have a very shallow understanding but I think the difference may be related to --with-mpi=0. My guess is that the overwhelming majority of PETSc users uses it with mpi.

gruenich commented 1 year ago

You are not downloading the right version of SuperLU. You need to have -download-superlu-commit=d812a001a6d8e16906fe7376c1688d605391c368 in you PETSc configure call. Not sure how to achieve this for FreeFem.

I configured PETSc with my locally installed OpenMPI. It passes make all (I had to remove two configure checks), so I cannt reproduce the problem.

aszaboa commented 1 year ago

I think I was not precise enough. The error occurs in the FreeFem configuration - there, the --disable-superlu ˛ flag circumvents the issue. So actually the commands above may reproduce the issue if you skip the --disable-superlu ˛ flag. Anyway, as I do not use superlu, I will just continue excluding it from the compilation.

gruenich commented 1 year ago

Probably I did not make clear what I expected from you. I understand that it did not work with SuperLU and disabling SuperLU made it working for you. I think I fixed the issue. I was hoping that you can try your setup with the latest SuperLU master and confirm that this fixes your SuperLU issue, too.

sagitter commented 1 year ago

https://github.com/xiaoyeli/superlu/pull/100 fixes this issue for me

prj- commented 1 year ago

I will close this issue, it's not related to FreeFEM, hopefully PETSc 3.20.0 (scheduled this September) will ship a functioning SuperLU version...