On Thu, Nov 25, 2021 at 2:29 PM Fabio Rossi via petsc-users < petsc-users@mcs.anl.gov> wrote:
> Thanks for the reply. > > I am using the system fftw which is provided by the distribution so I am > not going to install it by using PETSC's install scripts. > > I am sorry but I am not confident with the PETSC building system. What > happens if mpi is installed but the user prefers to compile PETSC with > --with-mpi=0 configure option? In that case self.mpi.found would be true? > > Regarding fftw.c, basically the functions to modify are: > > extern PetscErrorCode MatMult_SeqFFTW(Mat,Vec,Vec); > extern PetscErrorCode MatMultTranspose_SeqFFTW(Mat,Vec,Vec); > extern PetscErrorCode MatMult_MPIFFTW(Mat,Vec,Vec); > extern PetscErrorCode MatMultTranspose_MPIFFTW(Mat,Vec,Vec); > extern PetscErrorCode MatDestroy_FFTW(Mat); > extern PetscErrorCode VecDestroy_MPIFFTW(Vec); > extern PetscErrorCode MatCreateVecsFFTW_FFTW(Mat,Vec*,Vec*,Vec*); > PETSC_EXTERN PetscErrorCode MatCreate_FFTW(Mat A) > > The *MPI* function should exist only with PETSC_HAVE_MPI true while inside > the other functions the number of processors (detected inside the variable > "size") should be initialized to 1 and support the parallel case only when > PETSC_HAVE_MPI is true. > > As a user of the PETSC library and not programmer (I need to build another > library which requires it), I want to put your attention to the > documentation at > > https://petsc.org/release/install/install/#doc-config-externalpack > > where it's written "PETSc may be built and run without MPI support if > processing only in serial." > This is true, but we cannot control our dependencies. Thanks, Matt > which then seems to be true for PETSc itself but not for its dependencies > because the interface to fftw, right now, depends on MPI. That's the reason > of this new thread in the mailing list :-) > > Fabio > > > Il 25/11/2021 17:27 Barry Smith <bsm...@petsc.dev> ha scritto: > > > > > > PETSc's install and use of fftw always requires MPI. > > > > The code in config/BuildSystem/config/packages/fftw.py and > src/mat/impls/fft/fftw/fftw.c could relatively easily be "fixed" to also > support building and using FFTW without MPI. > > > > Just change the fftw.py to conditionally pass in > args.append('--enable-mpi') if self.mpi.found and change > > > > self.deps = [self.mpi,self.blasLapack] > > > > to > > > > self.deps = [self.blasLapack] > > self.odeps = [self.mpi] > > > > and in fftw.c add #if defined(PETSC_HAVE_MPI) around the parts of the > code that depend on MPI. > > > > We'd welcome a merge request with these enhancements. > > > > Barry > > > > > > > On Nov 25, 2021, at 5:15 AM, Fabio Rossi via petsc-users < > petsc-users@mcs.anl.gov> wrote: > > > > > > I am trying to compile petsc with the following options (Gentoo build > system): > > > > > > ./configure --prefix=/usr --build=x86_64-pc-linux-gnu > --host=x86_64-pc-linux-gnu --mandir=/usr/share/man > --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc > --localstatedir=/var/lib --libdir=/usr/lib64/petsc/lib64 scrollOutput=1 > FFLAGS=-O2 -pipe -fPIC CFLAGS=-march=core2 -O2 -pipe -fPIC > CXXFLAGS=-march=core2 -O2 -pipe -fPIC LDFLAGS=-Wl,-O1 -Wl,--as-needed > --prefix=/usr/lib64/petsc --with-shared-libraries --with-single-library > --with-clanguage=c --with-petsc-arch=linux-gnu-c-opt > --with-precision=double --with-gnu-compilers --with-blas-lapack-lib=-lblas > -llapack --with-debugging=0 --with-mpi=0 --with-cc=x86_64-pc-linux-gnu-gcc > --with-cxx=x86_64-pc-linux-gnu-g++ --with-fortran=1 > --with-fc=x86_64-pc-linux-gnu-gfortran --with-mpi-compilers=0 > --with-scalar-type=real --with-windows-graphics=0 --with-matlab=0 > --with-cmake:BOOL=1 --with-pthread=1 --with-afterimage=0 --without-hdf5 > --with-hypre=0 --without-suitesparse --with-superlu=0 --with-x --with-x11 > --with-ptscot > ch=0 > > > --with- > > > scalapack=0 --without-mumps --with-imagemagick=0 --with-python=0 > --with-boost --with-fftw > > > > > > so MPI support is disabled, and I get the following configure error: > > > > > > TESTING: consistencyChecks from > config.packages.fftw(/var/tmp/portage/sci-mathematics/petsc-3.15.0/work/petsc-3.15.0/config/BuildSystem/config/package.py:963) > > > TESTING: checkDependencies from > config.packages.fftw(/var/tmp/portage/sci-mathematics/petsc-3.15.0/work/petsc-3.15.0/config/BuildSystem/config/package.py:872) > > > > ******************************************************************************* > > > UNABLE to CONFIGURE with GIVEN OPTIONS (see configure.log > for details): > > > > ------------------------------------------------------------------------------- > > > Did not find package MPI needed by fftw. > > > Enable the package using --with-mpi > > > > > > Isn't MPI optional? Where is the error coming from? > > > > > > If I disable fftw then it compiles successfully. > > > > > > Fabio > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>