Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix LIBXSMM installation #254

Merged
merged 4 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
include: # Pairwise testing
include: # Pairwise testing (from allpairspy)
- compiler: gcc
mpi: mpich
math-libs: aocl
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build-and-test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
include: # Pairwise testing
include: # Pairwise testing (from allpairspy)
- compiler: clang
mpi: openmpi
math-libs: openblas
Expand Down Expand Up @@ -77,11 +77,11 @@ jobs:
if [[ "${{ matrix.compiler }}" == 'clang' ]]; then
export CC=$(brew --prefix llvm@15)/bin/clang
export CXX=$(brew --prefix llvm@15)/bin/clang++
export FC=gfortran-13
export FC=gfortran-12
elif [[ "${{ matrix.compiler }}" == 'gcc' ]]; then
export CC=gcc-13
export CXX=g++-13
export FC=gfortran-13
export CC=gcc-12
export CXX=g++-12
export FC=gfortran-12
fi
if [[ "${{ matrix.math-libs }}" == 'openblas' ]]; then
export OPENBLAS_DIR=/usr/local/opt/openblas
Expand Down
54 changes: 41 additions & 13 deletions cmake/ExternalLIBXSMM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
set(LIBXSMM_DEPENDENCIES)

set(LIBXSMM_OPTIONS
"PREFIX=${CMAKE_INSTALL_PREFIX}"
# "PREFIX=${CMAKE_INSTALL_PREFIX}" # Don't use install step, see comment below
"OUTDIR=${CMAKE_INSTALL_PREFIX}/lib"
"DIRSTATE=."
"PPKGDIR=lib/pkgconfig"
"PMODDIR=lib/pkgconfig"
"CC=${CMAKE_C_COMPILER}"
"CXX=${CMAKE_CXX_COMPILER}"
"FC="
Expand Down Expand Up @@ -46,6 +44,36 @@ endif()
string(REPLACE ";" "; " LIBXSMM_OPTIONS_PRINT "${LIBXSMM_OPTIONS}")
message(STATUS "LIBXSMM_OPTIONS: ${LIBXSMM_OPTIONS_PRINT}")

# Don't use LIBXSMM install step, since it just copies shared libraries and doesn't modify
# the dependency locations directly (doesn't use RPATH). Just build directly into the
# installation directory instead. See https://github.com/libxsmm/libxsmm/issues/883.
set(LIBXSMM_INSTALL_HEADERS
libxsmm.h
libxsmm_config.h
libxsmm_version.h
libxsmm_cpuid.h
libxsmm_fsspmdm.h
libxsmm_generator.h
libxsmm_intrinsics_x86.h
libxsmm_macros.h
libxsmm_math.h
libxsmm_malloc.h
libxsmm_memory.h
libxsmm_sync.h
libxsmm_typedefs.h
)
list(TRANSFORM LIBXSMM_INSTALL_HEADERS PREPEND <SOURCE_DIR>/include/)
set(LIBXSMM_INSTALL_PKGCONFIG
libxsmm.pc
libxsmmext.pc
libxsmmnoblas.pc
libxsmm-shared.pc
libxsmmext-shared.pc
libxsmmnoblas-shared.pc
libxsmm.env
)
list(TRANSFORM LIBXSMM_INSTALL_PKGCONFIG PREPEND ${CMAKE_INSTALL_PREFIX}/lib/)

include(ExternalProject)
ExternalProject_Add(libxsmm
DEPENDS ${LIBXSMM_DEPENDENCIES}
Expand All @@ -57,16 +85,16 @@ ExternalProject_Add(libxsmm
BUILD_IN_SOURCE TRUE
UPDATE_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} ${LIBXSMM_OPTIONS}
INSTALL_COMMAND
${CMAKE_MAKE_PROGRAM} ${LIBXSMM_OPTIONS} install-minimal &&
${CMAKE_COMMAND} -E remove -f "${CMAKE_INSTALL_PREFIX}/lib/.make" &&
${CMAKE_COMMAND} -E remove -f "${CMAKE_INSTALL_PREFIX}/lib/libxsmm.pc" &&
${CMAKE_COMMAND} -E remove -f "${CMAKE_INSTALL_PREFIX}/lib/libxsmmext.pc" &&
${CMAKE_COMMAND} -E remove -f "${CMAKE_INSTALL_PREFIX}/lib/libxsmmnoblas.pc" &&
${CMAKE_COMMAND} -E remove -f "${CMAKE_INSTALL_PREFIX}/lib/libxsmm-shared.pc" &&
${CMAKE_COMMAND} -E remove -f "${CMAKE_INSTALL_PREFIX}/lib/libxsmmext-shared.pc" &&
${CMAKE_COMMAND} -E remove -f "${CMAKE_INSTALL_PREFIX}/lib/libxsmmnoblas-shared.pc" &&
${CMAKE_COMMAND} -E remove -f "${CMAKE_INSTALL_PREFIX}/lib/libxsmm.env"
${CMAKE_COMMAND} -E echo "LIBXSMM installing interface..." &&
${CMAKE_COMMAND} -E make_directory ${CMAKE_INSTALL_PREFIX}/include &&
${CMAKE_COMMAND} -E copy ${LIBXSMM_INSTALL_HEADERS} ${CMAKE_INSTALL_PREFIX}/include &&
${CMAKE_COMMAND} -E echo "LIBXSMM installing pkg-config and module files..." &&
${CMAKE_COMMAND} -E make_directory ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig &&
${CMAKE_COMMAND} -E copy ${LIBXSMM_INSTALL_PKGCONFIG} ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig ||
${CMAKE_COMMAND} -E true && # No error if files don't exist
${CMAKE_COMMAND} -E rm -f ${LIBXSMM_INSTALL_PKGCONFIG} &&
${CMAKE_COMMAND} -E rm -f ${CMAKE_INSTALL_PREFIX}/lib/.make
TEST_COMMAND ""
)
Loading