mirror of
https://github.com/ceph/ceph
synced 2026-08-01 22:45:39 +00:00
Merge pull request #68258 from tchaikov/wip-with-system-jerasure
cmake: support building with system jerasure and gf-complete Reviewed-by: Casey Bodley <cbodley@redhat.com>
This commit is contained in:
commit
bb3f03d0f8
@ -733,6 +733,12 @@ if(sanitizers)
|
||||
string(APPEND CMAKE_SHARED_LINKER_FLAGS " ${sanitiers_compile_flags}")
|
||||
endif()
|
||||
|
||||
# Jerasure & GF-Complete
|
||||
option(WITH_SYSTEM_JERASURE "require and build with system jerasure and gf-complete" OFF)
|
||||
if(WITH_SYSTEM_JERASURE)
|
||||
find_package(Jerasure REQUIRED)
|
||||
endif()
|
||||
|
||||
# Rocksdb
|
||||
option(WITH_SYSTEM_ROCKSDB "require and build with system rocksdb" OFF)
|
||||
if (WITH_SYSTEM_ROCKSDB)
|
||||
|
||||
66
cmake/modules/FindJerasure.cmake
Normal file
66
cmake/modules/FindJerasure.cmake
Normal file
@ -0,0 +1,66 @@
|
||||
# - Find Jerasure and GF-Complete
|
||||
# Find the jerasure and gf-complete libraries and includes
|
||||
#
|
||||
# Jerasure_INCLUDE_DIR - where to find jerasure.h
|
||||
# Jerasure_SUBHEADER_DIR - where to find galois.h, cauchy.h, etc.
|
||||
# Jerasure_LIBRARY - the jerasure library
|
||||
# GFComplete_INCLUDE_DIR - where to find gf_complete.h
|
||||
# GFComplete_LIBRARY - the gf-complete library
|
||||
# Jerasure_FOUND - True if both jerasure and gf-complete found.
|
||||
|
||||
find_path(Jerasure_INCLUDE_DIR jerasure.h)
|
||||
|
||||
# jerasure sub-headers (galois.h, cauchy.h, etc.) may be installed in a
|
||||
# jerasure/ subdirectory. The main jerasure.h includes them with bare
|
||||
# #include "galois.h", so this directory must be on the include path.
|
||||
find_path(Jerasure_SUBHEADER_DIR galois.h
|
||||
PATH_SUFFIXES jerasure)
|
||||
|
||||
find_library(Jerasure_LIBRARY NAMES Jerasure)
|
||||
|
||||
find_path(GFComplete_INCLUDE_DIR gf_complete.h)
|
||||
|
||||
find_library(GFComplete_LIBRARY NAMES gf_complete)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Jerasure
|
||||
REQUIRED_VARS
|
||||
Jerasure_INCLUDE_DIR
|
||||
Jerasure_SUBHEADER_DIR
|
||||
Jerasure_LIBRARY
|
||||
GFComplete_INCLUDE_DIR
|
||||
GFComplete_LIBRARY)
|
||||
|
||||
if(Jerasure_FOUND)
|
||||
set(Jerasure_INCLUDE_DIRS
|
||||
${Jerasure_INCLUDE_DIR}
|
||||
${Jerasure_SUBHEADER_DIR}
|
||||
${GFComplete_INCLUDE_DIR})
|
||||
set(Jerasure_LIBRARIES
|
||||
${Jerasure_LIBRARY}
|
||||
${GFComplete_LIBRARY})
|
||||
|
||||
if(NOT TARGET Jerasure::jerasure)
|
||||
add_library(Jerasure::jerasure UNKNOWN IMPORTED GLOBAL)
|
||||
set_target_properties(Jerasure::jerasure PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Jerasure_INCLUDE_DIR};${Jerasure_SUBHEADER_DIR}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${Jerasure_LIBRARY}"
|
||||
INTERFACE_LINK_LIBRARIES "${GFComplete_LIBRARY}")
|
||||
endif()
|
||||
|
||||
if(NOT TARGET Jerasure::GFComplete)
|
||||
add_library(Jerasure::GFComplete UNKNOWN IMPORTED GLOBAL)
|
||||
set_target_properties(Jerasure::GFComplete PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${GFComplete_INCLUDE_DIR}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${GFComplete_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
Jerasure_INCLUDE_DIR
|
||||
Jerasure_SUBHEADER_DIR
|
||||
Jerasure_LIBRARY
|
||||
GFComplete_INCLUDE_DIR
|
||||
GFComplete_LIBRARY)
|
||||
2
debian/control
vendored
2
debian/control
vendored
@ -49,6 +49,7 @@ Build-Depends: automake,
|
||||
libhwloc-dev <pkg.ceph.crimson>,
|
||||
libibverbs-dev,
|
||||
libicu-dev,
|
||||
libjerasure-dev,
|
||||
librdmacm-dev,
|
||||
libkeyutils-dev,
|
||||
libldap2-dev,
|
||||
@ -140,6 +141,7 @@ Package: ceph-base
|
||||
Architecture: linux-any
|
||||
Depends: binutils,
|
||||
ceph-common (= ${binary:Version}),
|
||||
libjerasure2,
|
||||
logrotate,
|
||||
parted,
|
||||
psmisc,
|
||||
|
||||
1
debian/rules
vendored
1
debian/rules
vendored
@ -20,6 +20,7 @@ ifneq ($(filter pkg.ceph.crimson,$(DEB_BUILD_PROFILES)),)
|
||||
endif
|
||||
|
||||
extraopts += -DWITH_JAEGER=ON
|
||||
extraopts += -DWITH_SYSTEM_JERASURE=ON
|
||||
extraopts += -DWITH_SYSTEM_UTF8PROC=ON
|
||||
extraopts += -DWITH_OCF=ON -DWITH_LTTNG=ON
|
||||
extraopts += -DWITH_MGR_DASHBOARD_FRONTEND=OFF
|
||||
|
||||
@ -3,8 +3,12 @@
|
||||
set(erasure_plugin_dir ${CEPH_INSTALL_PKGLIBDIR}/erasure-code)
|
||||
|
||||
#jerasure subdir must be before shec so jerasure & neon obj libs are declared
|
||||
include_directories(SYSTEM jerasure/jerasure/include)
|
||||
include_directories(SYSTEM jerasure/gf-complete/include)
|
||||
if(WITH_SYSTEM_JERASURE)
|
||||
include_directories(SYSTEM ${Jerasure_INCLUDE_DIRS})
|
||||
else()
|
||||
include_directories(SYSTEM jerasure/jerasure/include)
|
||||
include_directories(SYSTEM jerasure/gf-complete/include)
|
||||
endif()
|
||||
include_directories(jerasure)
|
||||
|
||||
# legacy jerasure flavors. these are left here for backward compatibility
|
||||
|
||||
@ -7,6 +7,11 @@ set(jerasure_utils_src
|
||||
add_library(jerasure_utils OBJECT ${jerasure_utils_src})
|
||||
target_link_libraries(jerasure_utils legacy-option-headers)
|
||||
|
||||
# jerasure_init is ceph's own glue code for galois field initialization,
|
||||
# not part of the jerasure library itself.
|
||||
add_library(jerasure_init_objs OBJECT jerasure_init.cc)
|
||||
|
||||
if(NOT WITH_SYSTEM_JERASURE)
|
||||
# Set the CFLAGS correctly for gf-complete based on SIMD compiler support
|
||||
set(GF_COMPILE_FLAGS)
|
||||
if(HAVE_ARMV8_SIMD)
|
||||
@ -67,9 +72,9 @@ if(HAVE_ARM_NEON OR HAVE_ARMV8_SIMD)
|
||||
endif()
|
||||
|
||||
add_library(gf-complete_objs OBJECT ${gf-complete_srcs})
|
||||
set_target_properties(gf-complete_objs PROPERTIES
|
||||
set_target_properties(gf-complete_objs PROPERTIES
|
||||
COMPILE_FLAGS "${SIMD_COMPILE_FLAGS}")
|
||||
set_target_properties(gf-complete_objs PROPERTIES
|
||||
set_target_properties(gf-complete_objs PROPERTIES
|
||||
COMPILE_DEFINITIONS "${GF_COMPILE_FLAGS}")
|
||||
|
||||
set(jerasure_srcs
|
||||
@ -77,21 +82,29 @@ set(jerasure_srcs
|
||||
jerasure/src/galois.c
|
||||
jerasure/src/jerasure.c
|
||||
jerasure/src/liberation.c
|
||||
jerasure/src/reed_sol.c
|
||||
jerasure_init.cc)
|
||||
add_library(jerasure_objs OBJECT ${jerasure_srcs})
|
||||
target_compile_options(jerasure_objs PRIVATE "-Wno-unused-but-set-variable")
|
||||
jerasure/src/reed_sol.c)
|
||||
add_library(jerasure_lib_objs OBJECT ${jerasure_srcs})
|
||||
target_compile_options(jerasure_lib_objs PRIVATE "-Wno-unused-but-set-variable")
|
||||
|
||||
set(ec_jerasure_objs
|
||||
# Provide the vendored jerasure + gf-complete as a single static library
|
||||
# target, using the same Jerasure::jerasure name that FindJerasure.cmake
|
||||
# provides for the system library case.
|
||||
add_library(jerasure_vendored STATIC
|
||||
$<TARGET_OBJECTS:gf-complete_objs>
|
||||
$<TARGET_OBJECTS:jerasure_objs>
|
||||
$<TARGET_OBJECTS:jerasure_lib_objs>)
|
||||
add_library(Jerasure::jerasure ALIAS jerasure_vendored)
|
||||
endif()
|
||||
|
||||
# ec_jerasure plugin
|
||||
set(ec_jerasure_objs
|
||||
$<TARGET_OBJECTS:jerasure_init_objs>
|
||||
$<TARGET_OBJECTS:jerasure_utils>
|
||||
$<TARGET_OBJECTS:erasure_code_objs>)
|
||||
|
||||
add_library(ec_jerasure SHARED ${ec_jerasure_objs})
|
||||
set_target_properties(ec_jerasure PROPERTIES
|
||||
INSTALL_RPATH "")
|
||||
target_link_libraries(ec_jerasure ${EXTRALIBS})
|
||||
target_link_libraries(ec_jerasure Jerasure::jerasure ${EXTRALIBS})
|
||||
install(TARGETS ec_jerasure DESTINATION ${erasure_plugin_dir})
|
||||
|
||||
# legacy libraries
|
||||
@ -100,6 +113,7 @@ foreach(flavor ${jerasure_legacy_flavors})
|
||||
add_library(${plugin_name} SHARED ${ec_jerasure_objs})
|
||||
set_target_properties(${plugin_name} PROPERTIES
|
||||
INSTALL_RPATH "")
|
||||
target_link_libraries(${plugin_name} Jerasure::jerasure)
|
||||
install(TARGETS ${plugin_name} DESTINATION ${erasure_plugin_dir})
|
||||
add_dependencies(ec_jerasure ${plugin_name})
|
||||
endforeach()
|
||||
|
||||
@ -3,10 +3,10 @@
|
||||
include_directories(.)
|
||||
|
||||
set(shec_utils_srcs
|
||||
${CMAKE_SOURCE_DIR}/src/erasure-code/ErasureCode.cc
|
||||
ErasureCodePluginShec.cc
|
||||
ErasureCodeShec.cc
|
||||
ErasureCodeShecTableCache.cc
|
||||
${CMAKE_SOURCE_DIR}/src/erasure-code/ErasureCode.cc
|
||||
ErasureCodePluginShec.cc
|
||||
ErasureCodeShec.cc
|
||||
ErasureCodeShecTableCache.cc
|
||||
determinant.c)
|
||||
|
||||
add_library(shec_utils OBJECT ${shec_utils_srcs})
|
||||
@ -14,14 +14,13 @@ target_link_libraries(shec_utils
|
||||
PRIVATE legacy-option-headers)
|
||||
|
||||
set(ec_shec_objs
|
||||
$<TARGET_OBJECTS:gf-complete_objs>
|
||||
$<TARGET_OBJECTS:jerasure_objs>
|
||||
$<TARGET_OBJECTS:jerasure_init_objs>
|
||||
$<TARGET_OBJECTS:shec_utils>)
|
||||
|
||||
add_library(ec_shec SHARED ${ec_shec_objs})
|
||||
set_target_properties(ec_shec PROPERTIES
|
||||
INSTALL_RPATH "")
|
||||
target_link_libraries(ec_shec ${EXTRALIBS})
|
||||
target_link_libraries(ec_shec Jerasure::jerasure ${EXTRALIBS})
|
||||
install(TARGETS ec_shec DESTINATION ${erasure_plugin_dir})
|
||||
|
||||
# legacy libraries
|
||||
@ -30,6 +29,7 @@ foreach(flavor ${jerasure_legacy_flavors})
|
||||
add_library(${plugin_name} SHARED ${ec_shec_objs})
|
||||
set_target_properties(${plugin_name} PROPERTIES
|
||||
INSTALL_RPATH "")
|
||||
target_link_libraries(${plugin_name} Jerasure::jerasure)
|
||||
install(TARGETS ${plugin_name} DESTINATION ${erasure_plugin_dir})
|
||||
add_dependencies(ec_shec ${plugin_name})
|
||||
endforeach()
|
||||
|
||||
@ -28,8 +28,8 @@
|
||||
#include "common/strtol.h"
|
||||
#include "ErasureCodeShec.h"
|
||||
extern "C" {
|
||||
#include "jerasure/include/jerasure.h"
|
||||
#include "jerasure/include/galois.h"
|
||||
#include "jerasure.h"
|
||||
#include "galois.h"
|
||||
|
||||
extern int calc_determinant(int *matrix, int dim);
|
||||
extern int* reed_sol_vandermonde_coding_matrix(int k, int m, int w);
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "jerasure/include/galois.h"
|
||||
#include "galois.h"
|
||||
|
||||
void print_matrix(int *mat, int dim)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user