mirror of
https://github.com/ceph/ceph
synced 2025-03-11 02:39:05 +00:00
erasure-code: SSE optimized jerasure plugins
The jerasure plugin is compiled with three sets of flags: * jerasure_generic with no SSE optimization * jerasure_sse3 with SSE2, SSE3 and SSSE3 optimizations * jerasure_sse4 with SSE2, SSE3, SSSE3, SSE41, SSE42 and PCLMUL optimizations The jerasure plugin loads the appropriate plugin depending on the CPU features detected at runtime. http://tracker.ceph.com/issues/7826 fixes #7826 Signed-off-by: Loic Dachary <loic@dachary.org>
This commit is contained in:
parent
e9878db230
commit
10fd6b3153
66
src/erasure-code/jerasure/ErasureCodePluginSelectJerasure.cc
Normal file
66
src/erasure-code/jerasure/ErasureCodePluginSelectJerasure.cc
Normal file
@ -0,0 +1,66 @@
|
||||
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
|
||||
// vim: ts=8 sw=2 smarttab
|
||||
/*
|
||||
* Ceph - scalable distributed file system
|
||||
*
|
||||
* Copyright (C) 2014 Cloudwatt <libre.licensing@cloudwatt.com>
|
||||
*
|
||||
* Author: Loic Dachary <loic@dachary.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "arch/probe.h"
|
||||
#include "arch/intel.h"
|
||||
#include "erasure-code/ErasureCodePlugin.h"
|
||||
|
||||
#define dout_subsys ceph_subsys_osd
|
||||
#undef dout_prefix
|
||||
#define dout_prefix _prefix(_dout)
|
||||
|
||||
static ostream& _prefix(std::ostream* _dout)
|
||||
{
|
||||
return *_dout << "ErasureCodePluginSelectJerasure: ";
|
||||
}
|
||||
|
||||
class ErasureCodePluginSelectJerasure : public ErasureCodePlugin {
|
||||
public:
|
||||
virtual int factory(const map<std::string,std::string> ¶meters,
|
||||
ErasureCodeInterfaceRef *erasure_code) {
|
||||
ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
|
||||
stringstream ss;
|
||||
int ret;
|
||||
ceph_arch_probe();
|
||||
if (ceph_arch_intel_pclmul &&
|
||||
ceph_arch_intel_sse42 &&
|
||||
ceph_arch_intel_sse41 &&
|
||||
ceph_arch_intel_ssse3 &&
|
||||
ceph_arch_intel_sse3 &&
|
||||
ceph_arch_intel_sse2) {
|
||||
dout(10) << "SSE4 plugin" << dendl;
|
||||
ret = instance.factory("jerasure_sse4", parameters, erasure_code, ss);
|
||||
} else if (ceph_arch_intel_ssse3 &&
|
||||
ceph_arch_intel_sse3 &&
|
||||
ceph_arch_intel_sse2) {
|
||||
dout(10) << "SSE3 plugin" << dendl;
|
||||
ret = instance.factory("jerasure_sse3", parameters, erasure_code, ss);
|
||||
} else {
|
||||
dout(10) << "generic plugin" << dendl;
|
||||
ret = instance.factory("jerasure_generic", parameters, erasure_code, ss);
|
||||
}
|
||||
if (ret)
|
||||
derr << ss.str() << dendl;
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
int __erasure_code_init(char *plugin_name)
|
||||
{
|
||||
ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
|
||||
return instance.add(plugin_name, new ErasureCodePluginSelectJerasure());
|
||||
}
|
@ -1,5 +1,18 @@
|
||||
# jerasure plugin
|
||||
libec_jerasure_la_SOURCES = \
|
||||
noinst_HEADERS += \
|
||||
erasure-code/jerasure/jerasure/include/cauchy.h \
|
||||
erasure-code/jerasure/jerasure/include/galois.h \
|
||||
erasure-code/jerasure/jerasure/include/jerasure.h \
|
||||
erasure-code/jerasure/jerasure/include/liberation.h \
|
||||
erasure-code/jerasure/jerasure/include/reed_sol.h \
|
||||
erasure-code/jerasure/gf-complete/include/gf_int.h \
|
||||
erasure-code/jerasure/gf-complete/include/gf_complete.h \
|
||||
erasure-code/jerasure/gf-complete/include/gf_rand.h \
|
||||
erasure-code/jerasure/gf-complete/include/gf_method.h \
|
||||
erasure-code/jerasure/gf-complete/include/gf_general.h \
|
||||
erasure-code/jerasure/ErasureCodeJerasure.h
|
||||
|
||||
jerasure_sources = \
|
||||
erasure-code/jerasure/jerasure/src/cauchy.c \
|
||||
erasure-code/jerasure/jerasure/src/galois.c \
|
||||
erasure-code/jerasure/jerasure/src/jerasure.c \
|
||||
@ -19,27 +32,75 @@ libec_jerasure_la_SOURCES = \
|
||||
erasure-code/jerasure/ErasureCodePluginJerasure.cc \
|
||||
erasure-code/jerasure/ErasureCodeJerasure.cc
|
||||
|
||||
noinst_HEADERS += \
|
||||
erasure-code/jerasure/jerasure/include/cauchy.h \
|
||||
erasure-code/jerasure/jerasure/include/galois.h \
|
||||
erasure-code/jerasure/jerasure/include/jerasure.h \
|
||||
erasure-code/jerasure/jerasure/include/liberation.h \
|
||||
erasure-code/jerasure/jerasure/include/reed_sol.h \
|
||||
erasure-code/jerasure/gf-complete/include/gf_int.h \
|
||||
erasure-code/jerasure/gf-complete/include/gf_complete.h \
|
||||
erasure-code/jerasure/gf-complete/include/gf_rand.h \
|
||||
erasure-code/jerasure/gf-complete/include/gf_method.h \
|
||||
erasure-code/jerasure/gf-complete/include/gf_general.h \
|
||||
erasure-code/jerasure/ErasureCodeJerasure.h
|
||||
libec_jerasure_generic_la_SOURCES = ${jerasure_sources}
|
||||
libec_jerasure_generic_la_CFLAGS = ${AM_CFLAGS} \
|
||||
-Ierasure-code/jerasure/gf-complete/include \
|
||||
-Ierasure-code/jerasure/jerasure/include
|
||||
libec_jerasure_generic_la_CXXFLAGS= ${AM_CXXFLAGS} \
|
||||
-Ierasure-code/jerasure/gf-complete/include \
|
||||
-Ierasure-code/jerasure/jerasure/include
|
||||
libec_jerasure_generic_la_LIBADD = $(LIBCRUSH) $(PTHREAD_LIBS) $(EXTRALIBS)
|
||||
libec_jerasure_generic_la_LDFLAGS = ${AM_LDFLAGS} -version-info 2:0:0
|
||||
if LINUX
|
||||
libec_jerasure_generic_la_LDFLAGS += -export-symbols-regex '.*__erasure_code_.*'
|
||||
endif
|
||||
|
||||
libec_jerasure_la_CFLAGS = ${AM_CFLAGS} \
|
||||
${SIMD_FLAGS} \
|
||||
erasure_codelib_LTLIBRARIES += libec_jerasure_generic.la
|
||||
|
||||
libec_jerasure_sse3_la_SOURCES = ${jerasure_sources}
|
||||
libec_jerasure_sse3_la_CFLAGS = ${AM_CFLAGS} \
|
||||
${INTEL_SSE_FLAGS} \
|
||||
${INTEL_SSE2_FLAGS} \
|
||||
${INTEL_SSE3_FLAGS} \
|
||||
${INTEL_SSSE3_FLAGS} \
|
||||
-Ierasure-code/jerasure/gf-complete/include \
|
||||
-Ierasure-code/jerasure/jerasure/include
|
||||
libec_jerasure_la_CXXFLAGS= ${AM_CXXFLAGS} \
|
||||
${SIMD_FLAGS} \
|
||||
libec_jerasure_sse3_la_CXXFLAGS= ${AM_CXXFLAGS} \
|
||||
${INTEL_SSE_FLAGS} \
|
||||
${INTEL_SSE2_FLAGS} \
|
||||
${INTEL_SSE3_FLAGS} \
|
||||
${INTEL_SSSE3_FLAGS} \
|
||||
-Ierasure-code/jerasure/gf-complete/include \
|
||||
-Ierasure-code/jerasure/jerasure/include
|
||||
libec_jerasure_sse3_la_LIBADD = $(LIBCRUSH) $(PTHREAD_LIBS) $(EXTRALIBS)
|
||||
libec_jerasure_sse3_la_LDFLAGS = ${AM_LDFLAGS} -version-info 2:0:0
|
||||
if LINUX
|
||||
libec_jerasure_sse3_la_LDFLAGS += -export-symbols-regex '.*__erasure_code_.*'
|
||||
endif
|
||||
|
||||
erasure_codelib_LTLIBRARIES += libec_jerasure_sse3.la
|
||||
|
||||
libec_jerasure_sse4_la_SOURCES = ${jerasure_sources}
|
||||
libec_jerasure_sse4_la_CFLAGS = ${AM_CFLAGS} \
|
||||
${INTEL_SSE_FLAGS} \
|
||||
${INTEL_SSE2_FLAGS} \
|
||||
${INTEL_SSE3_FLAGS} \
|
||||
${INTEL_SSSE3_FLAGS} \
|
||||
${INTEL_SSE4_1_FLAGS} \
|
||||
${INTEL_SSE4_2_FLAGS} \
|
||||
-Ierasure-code/jerasure/gf-complete/include \
|
||||
-Ierasure-code/jerasure/jerasure/include
|
||||
libec_jerasure_sse4_la_CXXFLAGS= ${AM_CXXFLAGS} \
|
||||
${INTEL_SSE_FLAGS} \
|
||||
${INTEL_SSE2_FLAGS} \
|
||||
${INTEL_SSE3_FLAGS} \
|
||||
${INTEL_SSSE3_FLAGS} \
|
||||
${INTEL_SSE4_1_FLAGS} \
|
||||
${INTEL_SSE4_2_FLAGS} \
|
||||
-Ierasure-code/jerasure/gf-complete/include \
|
||||
-Ierasure-code/jerasure/jerasure/include
|
||||
libec_jerasure_sse4_la_LIBADD = $(LIBCRUSH) $(PTHREAD_LIBS) $(EXTRALIBS)
|
||||
libec_jerasure_sse4_la_LDFLAGS = ${AM_LDFLAGS} -version-info 2:0:0
|
||||
if LINUX
|
||||
libec_jerasure_sse4_la_LDFLAGS += -export-symbols-regex '.*__erasure_code_.*'
|
||||
endif
|
||||
|
||||
erasure_codelib_LTLIBRARIES += libec_jerasure_sse4.la
|
||||
|
||||
libec_jerasure_la_SOURCES = \
|
||||
erasure-code/jerasure/ErasureCodePluginSelectJerasure.cc
|
||||
libec_jerasure_la_CFLAGS = ${AM_CFLAGS}
|
||||
libec_jerasure_la_CXXFLAGS= ${AM_CXXFLAGS}
|
||||
libec_jerasure_la_LIBADD = $(LIBCRUSH) $(PTHREAD_LIBS) $(EXTRALIBS)
|
||||
libec_jerasure_la_LDFLAGS = ${AM_LDFLAGS} -version-info 2:0:0
|
||||
if LINUX
|
||||
|
@ -62,13 +62,11 @@ check_PROGRAMS += unittest_erasure_code_plugin
|
||||
|
||||
unittest_erasure_code_jerasure_SOURCES = \
|
||||
test/erasure-code/TestErasureCodeJerasure.cc \
|
||||
$(libec_jerasure_la_SOURCES)
|
||||
${jerasure_sources}
|
||||
unittest_erasure_code_jerasure_CFLAGS = $(AM_CFLAGS) \
|
||||
${SIMD_FLAGS} \
|
||||
-Ierasure-code/jerasure/gf-complete/include \
|
||||
-Ierasure-code/jerasure/jerasure/include
|
||||
unittest_erasure_code_jerasure_CXXFLAGS = $(UNITTEST_CXXFLAGS) \
|
||||
${SIMD_FLAGS} \
|
||||
-Ierasure-code/jerasure/gf-complete/include \
|
||||
-Ierasure-code/jerasure/jerasure/include
|
||||
unittest_erasure_code_jerasure_LDADD = $(LIBOSD) $(LIBCOMMON) $(UNITTEST_LDADD) $(CEPH_GLOBAL)
|
||||
|
Loading…
Reference in New Issue
Block a user