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

Type mismatch error #18

Closed habtie-phys closed 7 months ago

habtie-phys commented 7 months ago

Hello, I am getting the following error during compilation

Error: Type mismatch in argument ‘baseptr’ at (1); passed TYPE(c_ptr) to INTEGER(8) piclas/src/mpi/mpi_shared.f90:268:112

Could you please help me resolving this issue?

kopperp commented 7 months ago

Hello,

from your error I assume that you are attempting to compile PICLAS with MPICH? Unfortunately, MPICH is missing the required interfaces demanded by the MPI standard, please see this upstream issue, https://github.com/pmodels/mpich/issues/2659.

We already have a workaround deployed in our internal development version and are currently testing it on different configurations. The fix will be included in the upcoming 3.1 release. In the meantime, please use OpenMPI or add the following code snippet to the INTERFACE section in src/globals.f90.

INTERFACE MPI_WIN_ALLOCATE_SHARED
  SUBROUTINE PMPI_WIN_ALLOCATE_SHARED(SIZE, DISP_UNIT, INFO, COMM, BASEPTR, WIN, IERROR)
      USE, INTRINSIC ::  ISO_C_BINDING, ONLY : C_PTR
      IMPORT         ::  MPI_ADDRESS_KIND
      INTEGER        ::  DISP_UNIT, INFO, COMM, WIN, IERROR
      INTEGER(KIND=MPI_ADDRESS_KIND) ::  SIZE
      TYPE(C_PTR)    ::  BASEPTR
  END SUBROUTINE
END INTERFACE

INTERFACE MPI_WIN_SHARED_QUERY
  SUBROUTINE PMPI_WIN_SHARED_QUERY(WIN, RANK, SIZE, DISP_UNIT, BASEPTR, IERROR)
      USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR
      IMPORT         :: MPI_ADDRESS_KIND
      INTEGER        :: WIN, RANK, DISP_UNIT, IERROR
      INTEGER(KIND=MPI_ADDRESS_KIND) :: SIZE
      TYPE(C_PTR)    :: BASEPTR
  END SUBROUTINE
END INTERFACE
habtie-phys commented 7 months ago

Hi,

Thank you for the detailed explanation. I will follow your recommendation and let you know the result.

habtie-phys commented 7 months ago

Hi,

Yes, using OpenMpi resolves this issue, thanks for the immediate response again. I got another issue related to I think the hdf5 library. The error message is shown below.

[ 92%] Linking Fortran executable unitTests/bin/MortarBasis [ 92%] Linking Fortran executable bin/piclas [ 92%] Linking Fortran executable unitTests/bin/ReadInTools [ 92%] Linking Fortran executable unitTests/bin/MatrixInverse lib/libpiclas.so: error: undefined reference to 'h5pset_fapl_mpio_f_' lib/libpiclas.so: error: undefined reference to 'h5pset_dxpl_mpio_f_' collect2: error: ld returned 1 exit status make[2]: *** [CMakeFiles/MortarBasis.dir/build.make:111: unitTests/bin/MortarBasis] Error 1 make[1]: *** [CMakeFiles/Makefile2:211: CMakeFiles/MortarBasis.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... lib/libpiclas.so: error: undefined reference to 'h5pset_fapl_mpio_f_' lib/libpiclas.so: error: undefined reference to 'h5pset_dxpl_mpio_f_' collect2: error: ld returned 1 exit status make[2]: *** [CMakeFiles/ReadInTools.dir/build.make:111: unitTests/bin/ReadInTools] Error 1 make[1]: *** [CMakeFiles/Makefile2:151: CMakeFiles/ReadInTools.dir/all] Error 2 lib/libpiclas.so: error: undefined reference to 'h5pset_fapl_mpio_f_' lib/libpiclas.so: error: undefined reference to 'h5pset_dxpl_mpio_f_' collect2: error: ld returned 1 exit status make[2]: *** [CMakeFiles/MatrixInverse.dir/build.make:111: unitTests/bin/MatrixInverse] Error 1 make[1]: *** [CMakeFiles/Makefile2:181: CMakeFiles/MatrixInverse.dir/all] Error 2 lib/libpiclas.so: error: undefined reference to 'h5pset_fapl_mpio_f_' lib/libpiclas.so: error: undefined reference to 'h5pset_dxpl_mpio_f_' collect2: error: ld returned 1 exit status make[2]: *** [CMakeFiles/piclas.dir/build.make:111: bin/piclas] Error 1 make[1]: *** [CMakeFiles/Makefile2:429

If I understand it correctly, piclas is trying to call the h5pset_dxpl_mpio_f_ function/subroutine from the hdf5 library. When I check the hdf5 library, h5pset_dxpl_mpio_f_ is not there but h5pset_dxpl_mpio_f is available. I have tried to compile piclas both using the latest and the recommended version of the hdf5 library, and I have got the same error message shown above.

kopperp commented 7 months ago

Hello,

glad to hear that OpenMPI is working. Regarding your HDF5 issue, PICLAS can compile most of required libraries on demand. To rule out any issues with compile flags, please try compiling PICLAS with LIBS_BUILD_HDF5=ON set in CMake and let me know if that resolves the issue.

habtie-phys commented 7 months ago

Hi sorry, LIBS_BUILD_HDF5=ON resolves the issue. sorry I noticed that I have made a stupid typo mistake in ccmake ..

habtie-phys commented 7 months ago

now it is installed without an issue

kopperp commented 7 months ago

Hello, glad to hear PICLAS is working for you now. If you want to use identical compile flags for local installation of HDF5, you can find them here or in the following.

./src/HDF5/configure --with-pic --enable-fortran --enable-parallel --enable-build-mode=production --enable-silent-rules --disable-dependency-tracking

Please close this issue if your problem has been resolved. Do not hesitate to reach out again if any new issue arises in the future.