piclas-framework / piclas

PICLas is a parallel, three-dimensional PIC-DSMC solver developed cooperatively by the Institute of Space Systems, Institute of Aerodynamics and Gas Dynamics at the University of Stuttgart and the spin-off boltzplatz. PICLas is a flexible particle-based plasma simulation suite.
https://piclas.readthedocs.io
GNU General Public License v3.0
71 stars 17 forks source link

Compilation fails with PICLAS_PETSC=ON #7

Closed inflowencer closed 1 year ago

inflowencer commented 1 year ago

PICLas fails to compile when using PICLAS_PETSC=ON with the following error message:

[ 58%] Building Fortran object CMakeFiles/libpiclasstaticF90.dir/src/particles/mcc/mcc_init.f90.o
/home/albert/piclas/src/hdg/elem_mat.f90:465:47:

  465 | CALL KSPGetPC(ksp,pc,ierr);PetscCall(ierr)
      |                                               1
Error: Unexpected use of subroutine name ‘ierr’ at (1)
/home/albert/piclas/src/hdg/elem_mat.f90:465:140:

  465 | CALL KSPGetPC(ksp,pc,ierr);PetscCall(ierr)
      |                                                                                                                                            1
Error: Expecting END SUBROUTINE statement at (1)
/home/albert/piclas/src/hdg/elem_mat.f90:468:53:

  468 |   CALL PCSetType(pc,PCNONE,ierr);PetscCall(ierr)
      |                                                     1
Error: Unexpected use of subroutine name ‘ierr’ at (1)
/home/albert/piclas/src/hdg/elem_mat.f90:468:146:

  468 |   CALL PCSetType(pc,PCNONE,ierr);PetscCall(ierr)
      |                                                                                                                                                  1
Error: Expecting END SELECT statement at (1)
/home/albert/piclas/src/hdg/elem_mat.f90:470:55:

  470 |   CALL PCSetType(pc,PCJACOBI,ierr);PetscCall(ierr)
      |                                                       1
Error: Unexpected use of subroutine name ‘ierr’ at (1)
/home/albert/piclas/src/hdg/elem_mat.f90:470:148:

  470 |   CALL PCSetType(pc,PCJACOBI,ierr);PetscCall(ierr)
      |                                                                                                                                                    1
Error: Expecting END SELECT statement at (1)
/home/albert/piclas/src/hdg/elem_mat.f90:472:57:

  472 |   CALL PCHYPRESetType(pc,PCILU,ierr);PetscCall(ierr)
      |                                                         1
Error: Unexpected use of subroutine name ‘ierr’ at (1)
/home/albert/piclas/src/hdg/elem_mat.f90:472:150:

  472 |   CALL PCHYPRESetType(pc,PCILU,ierr);PetscCall(ierr)
      |                                                                                                                                                      1
Error: Expecting END SELECT statement at (1)
/home/albert/piclas/src/hdg/elem_mat.f90:474:58:

  474 |   CALL PCHYPRESetType(pc,PCSPAI,ierr);PetscCall(ierr)
      |                                                          1
Error: Unexpected use of subroutine name ‘ierr’ at (1)
/home/albert/piclas/src/hdg/elem_mat.f90:474:151:

  474 |   CALL PCHYPRESetType(pc,PCSPAI,ierr);PetscCall(ierr)
      |                                                                                                                                                       1
Error: Expecting END SELECT statement at (1)
/home/albert/piclas/src/hdg/elem_mat.f90:477:56:

  477 |   CALL PCSetType(pc,PCBJACOBI,ierr);PetscCall(ierr)
      |                                                        1
Error: Unexpected use of subroutine name ‘ierr’ at (1)
/home/albert/piclas/src/hdg/elem_mat.f90:477:149:

  477 |   CALL PCSetType(pc,PCBJACOBI,ierr);PetscCall(ierr)
      |                                                                                                                                                     1
Error: Expecting END SELECT statement at (1)
/home/albert/piclas/src/hdg/elem_mat.f90:478:83:

  478 |   CALL PCBJacobiSetLocalBlocks(pc,nPETScUniqueSides,lens,ierr);PetscCall(ierr)
      |                                                                                   1
Error: Unexpected use of subroutine name ‘ierr’ at (1)
/home/albert/piclas/src/hdg/elem_mat.f90:478:176:

  478 |   CALL PCBJacobiSetLocalBlocks(pc,nPETScUniqueSides,lens,ierr);PetscCall(ierr)
      |                                                                                                                                                                                1
Error: Expecting END SELECT statement at (1)
/home/albert/piclas/src/hdg/elem_mat.f90:481:57:

  481 |   CALL PCSetType(pc,PCCHOLESKY,ierr);PetscCall(ierr)
      |                                                         1
Error: Unexpected use of subroutine name ‘ierr’ at (1)
/home/albert/piclas/src/hdg/elem_mat.f90:481:150:

  481 |   CALL PCSetType(pc,PCCHOLESKY,ierr);PetscCall(ierr)
      |                                                                                                                                                      1
Error: Expecting END SELECT statement at (1)
/home/albert/piclas/src/hdg/elem_mat.f90:483:51:

  483 |   CALL PCSetType(pc,PCLU,ierr);PetscCall(ierr)
      |                                                   1
Error: Unexpected use of subroutine name ‘ierr’ at (1)
/home/albert/piclas/src/hdg/elem_mat.f90:483:144:

  483 |   CALL PCSetType(pc,PCLU,ierr);PetscCall(ierr)
      |                                                                                                                                                1
Error: Expecting END SELECT statement at (1)

Steps to reproduce:

  1. enabling PICLAS_PETSC=ON or make -DPICLAS_PETSC=ON

The code compiles fine when turning it off. The PETSC library is installed (and checked that it works) and the path exported.

OS: Ubuntu 22.04, tested on gcc-11 and -12.

scopplestone commented 1 year ago

Which version of PETSc are us using. Currently, only 3.17 is supported. We might support multiple versions in the future if this is required.

Edit: Also, the correct PETSC_DIR variable must be set, e.g., via export PETSC_DIR=/opt/petsc/3.17.0/gcc-12.2.0/openmpi-4.1.4 (where include, lib and share directories are located).

inflowencer commented 1 year ago

can confirm that downgrading to PETSC 3.17 has solved the issue. It might be a good idea to update the userguide prerequisites from
git clone -b main https://gitlab.com/petsc/petsc.git petsc
to
git clone -b release-3.17 https://gitlab.com/petsc/petsc.git petsc

scopplestone commented 1 year ago

thanks for the input. We'll update the user guide and make PETSc 3.18 available as well soon.