ralna / spral

Sparse Parallel Robust Algorithms Library
https://ralna.github.io/spral/
Other
104 stars 27 forks source link

"Error: Type mismatch in argument ..." when compiling with GPU support #164

Closed Lars-DHondt-KUL closed 10 months ago

Lars-DHondt-KUL commented 10 months ago

I am trying to compile spral with GPU support, but get the following error after running the make command:

gfortran -fopenmp -fPIC -c -o src/ssids/gpu/factor.o src/ssids/gpu/factor.f90
src/ssids/gpu/factor.f90:2627:45:

 2627 |             gwork, st, cuda_error, ptr_scale)
      |                                             1
Error: Type mismatch in argument 'level_size' at (1); passed INTEGER(4) to INTEGER(8)
src/ssids/gpu/factor.f90:2631:34:

 2631 |             gwork, st, cuda_error)
      |                                  1
Error: Type mismatch in argument 'level_size' at (1); passed INTEGER(4) to INTEGER(8)
src/ssids/gpu/factor.f90:2525:24:

 2525 |          st, cuda_error)
      |                        1
Error: Type mismatch in argument 'off_ldlt' at (1); passed INTEGER(4) to INTEGER(8)
src/ssids/gpu/factor.f90:2259:26:

 2259 |          stats%cuda_error)
      |                          1
Error: Type mismatch in argument 'off_ldlt' at (1); passed INTEGER(4) to INTEGER(8)
src/ssids/gpu/factor.f90:2156:46:

 2156 |             gwork, stats%st, stats%cuda_error)
      |                                              1
Error: Type mismatch in argument 'pc_size' at (1); passed INTEGER(4) to INTEGER(8)
src/ssids/gpu/factor.f90:2156:46:

 2156 |             gwork, stats%st, stats%cuda_error)
      |                                              1
Error: Type mismatch in argument 'off_ldlt' at (1); passed INTEGER(4) to INTEGER(8)
make[1]: *** [Makefile:2513: src/ssids/gpu/factor.o] Error 1
make[1]: Leaving directory '/c/GBW_MyPrograms/coin-or/spral/source/spral'
make: *** [Makefile:1661: all] Error 2

I am using mingw-w64 on windows 10 The same error occurs when using blas and lapack from mkl

CFLAGS=-fPIC CPPFLAGS=-fPIC CXXFLAGS=-fPIC FFLAGS="-fPIC -fallow-argument-mismatch" \
   FCFLAGS="-fPIC -fallow-argument-mismatch" NVCCFLAGS="-shared -Xcompiler -fPIC" \
   ./configure --prefix="c:/GBW_MyPrograms/coin-or/spral/build/with-cuda-v1" \
   --with-blas="-lmkl_intel_lp64 -lmkl_sequential -lmkl_core" --with-lapack="-lmkl_intel_lp64 -lmkl_sequential -lmkl_core" \
   --with-metis="-lmetis"

or when getting them through mingw

pacman -S mingw-w64-x86_64-lapack mingw-w64-x86_64-metis  mingw-w64-x86_64-openblas
CFLAGS=-fPIC CPPFLAGS=-fPIC CXXFLAGS=-fPIC FFLAGS=-fPIC \
   FCFLAGS=-fPIC NVCCFLAGS="-shared -Xcompiler -fPIC" \
   ./configure --prefix="c:/GBW_MyPrograms/coin-or/spral/build/with-cuda-v1" \
   --with-blas="-lopenblas" --with-lapack="-llapack" \
   --with-metis="-lmetis"

Adding -fallow-argument-mismatch to the FFLAGS and FCFLAGS resulted in the same error.

Do you have any suggestions on what is going wrong?

jfowkes commented 10 months ago

Hi @Lars-DHondt-KUL, apologies it looks like we forgot to fix some long integers in the GPU code (long integers are 32bit on Windows by default unlike on Linux or Mac where they are 64bit). I will create a pull request to fix this issue.