ParRes / Kernels

This is a set of simple programs that can be used to explore the features of a parallel platform.
https://groups.google.com/forum/#!forum/parallel-research-kernels
Other
404 stars 106 forks source link

Cannot find -lkokkos #620

Open JosefRuzicka opened 1 year ago

JosefRuzicka commented 1 year ago

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?

jeffhammond commented 1 year ago

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.

JosefRuzicka commented 1 year ago

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()

jeffhammond commented 1 year ago

Are you using a Power9 machine?

jeffhammond commented 1 year ago

Add -L$path_to_kokkos to KOKKOSFLAG

jeffhammond commented 1 year ago

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

JosefRuzicka commented 1 year ago

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}