Kernels icon indicating copy to clipboard operation
Kernels copied to clipboard

Cannot find -lkokkos

Open JosefRuzicka opened this issue 2 years ago • 6 comments

Hello, I'm trying to run the Cxx11 kokkos programs, but when I write "make kokkos" I get the following error: "/usr/bin/ld: cannot find -lkokkos", any chance you have experience compiling these programs with the current version of Kokkos so that you could help me?

JosefRuzicka avatar Mar 07 '23 15:03 JosefRuzicka

Unfortunately, the PRK build system lacks any automation, so you'll have to build Kokkos yourself and set the flags in make.defs appropriately, for example, like the GCC template shows (https://github.com/ParRes/Kernels/blob/default/common/make.defs.gcc#LL141C25-L141C25).

If this doesn't resolve your problem, can you provide more details, so I can give you more precise suggestions.

jeffhammond avatar Mar 07 '23 15:03 jeffhammond

Thank you for answering! I installed Kokkos with the script provided: cmake .. -DKokkos_ENABLE_CUDA=True \ -DCMAKE_CXX_COMPILER=$HOME/KOKKOS/git/bin/nvcc_wrapper \ -DCMAKE_INSTALL_PREFIX=$HOME/KOKKOS/install-cuda \ -DKokkos_ARCH_POWER9=ON \ -DKokkos_ARCH_VOLTA70=ON \ -DKokkos_ENABLE_CUDA_LAMBDA=ON \ && make -j install which creates in my bin directory a kokkos folder with the include folder and the lib64 folder (which has a libkokkoscore and a libkokkoscontainers).

I created a make.defs.kokkos in the common folder by copying the make.defs.cuda and updating the KOKKOSDIR to my kokkos installation path.

I'm not sure if there is a flag I could add to my make.defs.kokkos file so that it helps me find -lkokkos during make kokkos. I'm just trying to compile the already existing kokkos programs: stencil-kokkos.cc, transpose-kokkos...

If I just remove the -lkokkos flag from the compilation line, I get an error indicating that there are undefined references to every kokkos related function like Kokkos::initialize() and Kokkos::Finalize()

JosefRuzicka avatar Mar 07 '23 16:03 JosefRuzicka

Are you using a Power9 machine?

jeffhammond avatar Mar 07 '23 17:03 jeffhammond

Add -L$path_to_kokkos to KOKKOSFLAG

jeffhammond avatar Mar 07 '23 17:03 jeffhammond

The build system needs common/make.defs so copy whatever template you use to that filename, and no other.

jeffhammond avatar Mar 08 '23 11:03 jeffhammond

Im using an amd x86_64 machine, but I have tried different installations. with the one for power 9, it cant find -lkokkos, using: cmake /home/jruzicka/Kokkos/kokkos \ -DCMAKE_CXX_COMPILER=/opt/compilers/gcc-11.1.0/bin/gcc \ -DCMAKE_INSTALL_PREFIX=/home/jruzicka/bin/kokkos\ -DKokkos_ENABLE_OPENMP=On \ -DKokkos_ARCH_HSW=On I get this error: In file included from prk_kokkos.h:36, from pic-kokkos.cc:67: /home/jruzicka/bin/kokkos_x86_64/include/Kokkos_Concepts.hpp:19:15: error: static assertion failed: Including non-public Kokkos header files is not allowed. 19 | static_assert(false, | ^~~~~ In file included from prk_kokkos.h:37, from pic-kokkos.cc:67: /home/jruzicka/bin/kokkos_x86_64/include/Kokkos_MemoryTraits.hpp:19:15: error: static assertion failed: Including non-public Kokkos header files is not allowed. 19 | static_assert(false,

and with the other installation: cmake /home/jruzicka/Kokkos/kokkos \ -DCMAKE_CXX_COMPILER=/opt/compilers/gcc-11.1.0/bin/gcc \ -DCMAKE_INSTALL_PREFIX=/home/jruzicka/bin/kokkos_x86_64 \ -DKokkos_ENABLE_OPENMP=On \ -DKokkos_ARCH_NATIVE=On I get that same second error again about static assertions.

I have had no trouble compiling and running the kokkos tutorials and some programs of my own but compiling kokkos everytime with a Makefile, yeah I moved the common/make.defs.kokkos I made into a common/make.defs

My make.defs kokkos part looks like this: KOKKOSDIR=/home/jruzicka/bin/kokkos_x86_64 120 KOKKOSFLAG=-I${KOKKOSDIR}/include -L${KOKKOSDIR}/lib64 -lkokkos ${OPENMPFLAG}

JosefRuzicka avatar Mar 08 '23 13:03 JosefRuzicka