--- /dev/null
+// -*- 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());
+}
# 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 \
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