icl-utk-edu / slate

SLATE is a distributed, GPU-accelerated, dense linear algebra library targetting current and upcoming high-performance computing (HPC) systems. It is developed as part of the U.S. Department of Energy Exascale Computing Project (ECP).
https://icl.utk.edu/slate/
BSD 3-Clause "New" or "Revised" License
84 stars 20 forks source link

Build errors with GCC 13.2.0: no <cstdint> in test/matrix_params.cc, and -fopenmp not passed to linker #168

Closed chillenb closed 6 months ago

chillenb commented 6 months ago

Description A clear and concise description of the bug and expected behavior.

Slate's tests failed to build in my environment. Specifically,

/home/chillenb/src/slate/test/matrix_params.cc: In constructor ‘MatrixParams::MatrixParams()’:
/home/chillenb/src/slate/test/matrix_params.cc:42:60: error: ‘INT64_MAX’ was not declared in this scope
   42 |     seed(       "seed",   0,    List,   -1,            -1, INT64_MAX,
      |                                                            ^~~~~~~~~
/home/chillenb/src/slate/test/matrix_params.cc:10:1: note: ‘INT64_MAX’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
    9 | #include <cmath>
  +++ |+#include <cstdint>
   10 |

The build progressed further when I added that line in, until the very end, when tester failed to link:

/easybuild/software/binutils/2.40-GCCcore-13.2.0/bin/ld: ../libslate.so: undefined reference to `__offload_func_table'
/easybuild/software/binutils/2.40-GCCcore-13.2.0/bin/ld: ../libslate.so: undefined reference to `__offload_vars_end'
/easybuild/software/binutils/2.40-GCCcore-13.2.0/bin/ld: ../libslate.so: undefined reference to `__offload_funcs_end'
/easybuild/software/binutils/2.40-GCCcore-13.2.0/bin/ld: ../libslate.so: undefined reference to `__offload_var_table'
collect2: error: ld returned 1 exit status
make[2]: *** [test/CMakeFiles/tester.dir/build.make:1212: test/tester] Error 1
make[1]: *** [CMakeFiles/Makefile2:428: test/CMakeFiles/tester.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

This went away when I set export CXXFLAGS=-fopenmp and started from the beginning, and then everything worked.

Steps To Reproduce

  1. Occurred while following the installation instructions with CMake.

If it can be reproduced with SLATE's testers, that is best. Otherwise, including a minimal reproducer is super helpful.

Environment The more information that you can provide about your environment, the simpler it is for us to understand and reproduce the issue.

ImBlackMagic commented 6 months ago

int64 is not supported in SLATE

From the installations instructions:

blas_int
    BLAS integer size to search for. One or more of:
    auto            search for both sizes (default)
    int             32-bit int (LP64 model)
    * int64         64-bit int (ILP64 model)
    * int64 is not currently supported in SLATE

I had to specify -Dblas_int=32 to compile against intel mkl correctly

chillenb commented 6 months ago

Thanks for pointing that out!

Unfortunately, I still get the same compile error when I pass -Dblas_int=int. It happens with openblas too. The problem seems unrelated to ILP64 and is probably just because INT64_MAX didn't get defined.

ImBlackMagic commented 6 months ago

mkl has 2 versions, ilp64 and lp64, you probably have to adjust your environment variables to point to the lp64 version

this can be done with the setvars.sh (or vars.sh) script in the intel mkl installation, if you followed their installation instructions it's not hard.

at the time I posted my first response I was able to compile slate using intel mkl (followed their webpage installation instructions, and how to set up the environment variables, it's not trivial without the documentation)

although I had issues compiling, they were not related to the project (ubuntu kernel is not compiled with gcc version 12.3, and the packet manager installs gcc 11.4 by default, this has caused a lot of headache for me)

mgates3 commented 6 months ago

Possibly related to #173.

mgates3 commented 6 months ago

@chillenb Is your OpenMP issue solved now in the master branch with #173 merged?

chillenb commented 6 months ago

Hopefully yes. I will try it in an hour and let you know

chillenb commented 6 months ago

Yes, it seems solved!

chillenb commented 6 months ago

Thanks for your help