Skip to content

Missing OpenMP target dependency on testsweeper #194

@devreal

Description

@devreal

Description

Trying to build SLATE on Frontier with the Cray compiler leads to this linking error:

[100%] Linking CXX executable testsweeper_tester
cd /ccs/home/jschuchart/src/slate/slate/build/testsweeper/test && /autofs/nccs-svm1_sw/frontier/spack-envs/base/opt/linux-sles15-x86_64/gcc-7.5.0/cmake-3.23.2-4r4mpiba7cwdw2hlakh5i7tchi64s3qd/bin/cmake -E cmake_link_script CMakeFiles/testsweeper_tester.dir/link.txt --verbose=1
/opt/cray/pe/craype/2.7.23/bin/CC -O3 -DNDEBUG CMakeFiles/testsweeper_tester.dir/test.cc.o CMakeFiles/testsweeper_tester.dir/test_sort.cc.o -o testsweeper_tester  -Wl,-rpath,/ccs/home/jschuchart/src/slate/slate/build/testsweeper ../libtestsweeper.so 
ld.lld: error: undefined reference due to --no-allow-shlib-undefined: _cray$mt_kmpc_fork_call_with_flags
>>> referenced by ../libtestsweeper.so

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: omp_get_wtime
>>> referenced by ../libtestsweeper.so

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: __kmpc_master
>>> referenced by ../libtestsweeper.so

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: omp_get_num_threads
>>> referenced by ../libtestsweeper.so

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: __kmpc_end_master
>>> referenced by ../libtestsweeper.so

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: omp_get_thread_num
>>> referenced by ../libtestsweeper.so

Steps To Reproduce

  1. Checkout current master
  2. Run cmake:
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=CC -DCMAKE_Fortran_COMPILER=ftn -DENABLE_HIP=ON -DCMAKE_HIP_FLAGS="-L${MPICH_DIR}/lib -lmpi ${CRAY_XPMEM_POST_LINK_OPTS} -lxpmem ${PE_MPICH_GTL_DIR_amd_gfx90a} ${PE_MPICH_GTL_LIBS_amd_gfx90a} -I${MPICH_DIR}/include" -DHIP_ROOT_DIR=${OLCF_ROCM_ROOT} -DBLAS_LIBRARIES=/ccs/home/bouteilla/parsec/dplasma/spock.debug/OpenBLAS/lib/libopenblas.so -DBLAS_INCLUDE_DIRS=/ccs/home/bouteilla/parsec/dplasma/spock.debug/OpenBLAS/include

It appears that the testsweeper should depend on the OpenMP target. If I manually run the compiler command with -fopenmp the link succeeds:

$ /opt/cray/pe/craype/2.7.23/bin/CC -O3 -DNDEBUG CMakeFiles/testsweeper_tester.dir/test.cc.o CMakeFiles/testsweeper_tester.dir/test_sort.cc.o -o testsweeper_tester  -Wl,-rpath,/ccs/home/jschuchart/src/slate/slate/build/testsweeper ../libtestsweeper.so -fopenmp

Environment

$ module list

Currently Loaded Modules:
  1) craype-x86-trento    4) perftools-base/22.12.0                  7) cray-dsmml/0.2.2   10) cmake/3.23.2             13) cce/17.0.0             16) lfs-wrapper/0.0.1    19) cray-mpich/8.1.28
  2) libfabric/1.15.2.0   5) xpmem/2.6.2-2.5_2.22__gd067c3f.shasta   8) PrgEnv-cray/8.3.3  11) rocm/5.7.1               14) darshan-runtime/3.4.0  17) DefApps/default      20) craype/2.7.23
  3) craype-network-ofi   6) cray-pmi/6.1.8                          9) boost/1.79.0       12) craype-accel-amd-gfx90a  15) hsi/default            18) cray-libsci/23.12.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions