]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
erasure-code: Remove SIMD flavors for jerasure and shec
authorBassam Tabbara <bassam.tabbara@quantum.com>
Thu, 22 Sep 2016 19:40:52 +0000 (12:40 -0700)
committerBassam Tabbara <bassam.tabbara@quantum.com>
Thu, 29 Sep 2016 17:34:33 +0000 (10:34 -0700)
By switching to a new gf-complete with SIMD runtime detection, we can now remove all the different flavors of jerasure and shec. This simplifies deployment and configuration of erasure coding, enables hetergenous OSDs, and enables us to take advantage of new performance improvements in jerasure without config/build changes.

This commit removes flavors from cmake, removes ErasureCodePluginSelect___, and fixes unit tests. There is now a single plugin for jerasure and a single plugin for shec.

SIMDExt.cmake was changed so that its a little more generic, and is not polluted with gf-complete specific CFLAG defines. The #define for SIMD instruction were based on gf-complete.

I also added a small init helper for jerasure that has code that was common between jerasure and shec.

Signed-off-by: Bassam Tabbara <bassam.tabbara@quantum.com>
23 files changed:
cmake/modules/SIMDExt.cmake
qa/workunits/erasure-code/bench.sh
qa/workunits/erasure-code/plot.js
src/erasure-code/CMakeLists.txt
src/erasure-code/jerasure/CMakeLists.txt
src/erasure-code/jerasure/ErasureCodePluginJerasure.cc
src/erasure-code/jerasure/ErasureCodePluginSelectJerasure.cc [deleted file]
src/erasure-code/jerasure/jerasure_init.cc [new file with mode: 0644]
src/erasure-code/jerasure/jerasure_init.h [new file with mode: 0644]
src/erasure-code/shec/CMakeLists.txt
src/erasure-code/shec/ErasureCodePluginSelectShec.cc [deleted file]
src/erasure-code/shec/ErasureCodePluginShec.cc
src/test/erasure-code/CMakeLists.txt
src/test/erasure-code/TestErasureCodePluginJerasure.cc
src/test/erasure-code/TestErasureCodePluginShec.cc
src/test/erasure-code/TestJerasurePluginGeneric.cc [deleted file]
src/test/erasure-code/TestJerasurePluginNEON.cc [deleted file]
src/test/erasure-code/TestJerasurePluginSSE3.cc [deleted file]
src/test/erasure-code/TestJerasurePluginSSE4.cc [deleted file]
src/test/erasure-code/TestShecPluginGeneric.cc [deleted file]
src/test/erasure-code/TestShecPluginNEON.cc [deleted file]
src/test/erasure-code/TestShecPluginSSE3.cc [deleted file]
src/test/erasure-code/TestShecPluginSSE4.cc [deleted file]

index f556a71c9cc13a8c4e0d0d0d79ddc514a6418674..df3ad3b9ab36d41d2ce3e87068d99df445c02f4e 100644 (file)
@@ -1,66 +1,63 @@
 # detect SIMD extentions
 #
-# ARM_NEON_FLAGS
-#
 # HAVE_ARMV8_CRC
-# HAVE_NEON
-# HAVE_SSE
-# HAVE_SSE2
+# HAVE_ARMV8_SIMD
+# HAVE_ARM_NEON
+# HAVE_INTEL_SSE
+# HAVE_INTEL_SSE2
+# HAVE_INTEL_SSE3
+# HAVE_INTEL_SSSE3
+# HAVE_INTEL_PCLMUL
+# HAVE_INTEL_SSE4_1
+# HAVE_INTEL_SSE4_2
 #
 # INTEL_SSE4_1
-# INTEL_SSE4_2
-#
-# SSE3_FLAGS
-# SSE4_FLAGS
+# 
+# SIMD_COMPILE_FLAGS
 #
 
 if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64")
   CHECK_C_COMPILER_FLAG(-march=armv8-a+crc HAVE_ARMV8_CRC)
   if(HAVE_ARMV8_CRC)
-    set(ARM_CRC_FLAGS "-march=armv8-a+crc -DARCH_AARCH64")
+    set(ARM_CRC_FLAGS "-march=armv8-a+crc")
   endif()
-  CHECK_C_COMPILER_FLAG(-march=armv8-a+simd HAVE_NEON)
-  if(HAVE_NEON)
-    set(ARM_NEON_FLAGS "-march=armv8-a+simd -DARCH_AARCH64 -DARM_NEON")
+  CHECK_C_COMPILER_FLAG(-march=armv8-a+simd HAVE_ARMV8_SIMD)
+  if(HAVE_ARMV8_SIMD)
+    set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -march=armv8-a+simd")
   endif()
 elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm|ARM")
-  CHECK_C_COMPILER_FLAG(-mfpu=neon HAVE_NEON)
-  if(HAVE_NEON)
-    set(ARM_NEON_FLAGS "-mfpu=neon -DARM_NEON")
+  CHECK_C_COMPILER_FLAG(-mfpu=neon HAVE_ARM_NEON)
+  if(HAVE_ARM_NEON)
+    set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -mfpu=neon")
   endif()
 elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i386|i686|amd64|x86_64|AMD64")
-  set(SSE3_FLAGS)
-  CHECK_C_COMPILER_FLAG(-msse HAVE_SSE)
-  if(HAVE_SSE)
-    set(SSE3_FLAGS "${SSE3_FLAGS} -msse -DINTEL_SSE")
+  CHECK_C_COMPILER_FLAG(-msse HAVE_INTEL_SSE)
+  if(HAVE_INTEL_SSE)
+    set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse")
   endif()
-
-  CHECK_C_COMPILER_FLAG(-msse2 HAVE_SSE2)
-  if(HAVE_SSE2)
-    set(SSE3_FLAGS "${SSE3_FLAGS} -msse2 -DINTEL_SSE2")
+  CHECK_C_COMPILER_FLAG(-msse2 HAVE_INTEL_SSE2)
+  if(HAVE_INTEL_SSE2)
+    set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse2")
   endif()
-
-  CHECK_C_COMPILER_FLAG(-msse3 HAVE_SSE3)
-  if(HAVE_SSE3)
-    set(SSE3_FLAGS "${SSE3_FLAGS} -msse3 -DINTEL_SSE3")
+  CHECK_C_COMPILER_FLAG(-msse3 HAVE_INTEL_SSE3)
+  if(HAVE_INTEL_SSE3)
+    set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse3")
   endif()
-
-  CHECK_C_COMPILER_FLAG(-mssse3 SUPPORTS_SSSE3)
-  if(SUPPORTS_SSSE3)
-    set(SSE3_FLAGS "${SSE3_FLAGS} -mssse3 -DINTEL_SSSE3")
+  CHECK_C_COMPILER_FLAG(-mssse3 HAVE_INTEL_SSSE3)
+  if(HAVE_INTEL_SSSE3)
+    set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -mssse3")
+  endif()
+  CHECK_C_COMPILER_FLAG(-mpclmul HAVE_INTEL_PCLMUL)
+  if(HAVE_INTEL_PCLMUL)
+    set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -mpclmul")
   endif()
-
-  # pclmul is not enabled in SSE3, otherwise we need another
-  # flavor or an cmake option for enabling it
-
-  set(SSE4_FLAGS ${SSE3_FLAGS})
   CHECK_C_COMPILER_FLAG(-msse4.1 INTEL_SSE4_1)
-  if(SUPPORTS_SSE41)
-    set(SSE4_FLAGS "${SSE4_FLAGS} -msse41 -DINTEL_SSE4")
+  CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_INTEL_SSE4_1)
+  if(HAVE_INTEL_SSE4_1)
+    set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse4.1")
   endif()
-
-  CHECK_C_COMPILER_FLAG(-msse4.2 INTEL_SSE4_2)
-  if(SUPPORTS_SSE42)
-    set(SSE4_FLAGS "${SSE4_FLAGS} -msse42 -DINTEL_SSE4")
+  CHECK_C_COMPILER_FLAG(-msse4.2 HAVE_INTEL_SSE4_2)
+  if(HAVE_INTEL_SSE4_2)
+    set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse4.2")
   endif()
 endif()
index 8e8671c49ccf830c5734e1c57bee0b3f696f7a7c..e2bec8edd272ed69f46c8455cb3123e275eca44c 100755 (executable)
@@ -49,7 +49,7 @@ export PATH=/sbin:$PATH
 : ${VERBOSE:=false}
 : ${CEPH_ERASURE_CODE_BENCHMARK:=ceph_erasure_code_benchmark}
 : ${PLUGIN_DIRECTORY:=/usr/lib/ceph/erasure-code}
-: ${PLUGINS:=isa jerasure_generic jerasure_sse4}
+: ${PLUGINS:=isa jerasure}
 : ${TECHNIQUES:=vandermonde cauchy}
 : ${TOTAL_SIZE:=$((1024 * 1024))}
 : ${SIZE:=4096}
@@ -111,12 +111,6 @@ function bench_run() {
     k2ms[4]="2 3"
     k2ms[6]="2 3 4"
     k2ms[10]="3 4"
-    local isa2technique_vandermonde='reed_sol_van'
-    local isa2technique_cauchy='cauchy'
-    local jerasure_generic2technique_vandermonde='reed_sol_van'
-    local jerasure_generic2technique_cauchy='cauchy_good'
-    local jerasure_sse42technique_vandermonde='reed_sol_van'
-    local jerasure_sse42technique_cauchy='cauchy_good'
     for technique in ${TECHNIQUES} ; do
         for plugin in ${PLUGINS} ; do
             eval technique_parameter=\$${plugin}2technique_${technique}
index 793ab1a7b1a78e9796177782c97049bb54f58f6c..bd2bba5bbadae3af8c59176092642a863b5513fa 100644 (file)
@@ -8,22 +8,14 @@ $(function() {
            lines: { show: true },
        });
     }
-    if (typeof encode_vandermonde_jerasure_generic != 'undefined') {
+    if (typeof encode_vandermonde_jerasure != 'undefined') {
         encode.push({
-           data: encode_vandermonde_jerasure_generic,
+           data: encode_vandermonde_jerasure,
             label: "Jerasure Generic, Vandermonde",
            points: { show: true },
            lines: { show: true },
        });
     }
-    if (typeof encode_vandermonde_jerasure_sse4 != 'undefined') {
-        encode.push({
-           data: encode_vandermonde_jerasure_sse4,
-            label: "Jerasure SIMD, Vandermonde",
-           points: { show: true },
-           lines: { show: true },
-       });
-    }
     if (typeof encode_cauchy_isa != 'undefined') {
         encode.push({
            data: encode_cauchy_isa,
@@ -32,9 +24,9 @@ $(function() {
            lines: { show: true },
        });
     }
-    if (typeof encode_cauchy_jerasure_generic != 'undefined') {
+    if (typeof encode_cauchy_jerasure != 'undefined') {
         encode.push({
-           data: encode_cauchy_jerasure_generic,
+           data: encode_cauchy_jerasure,
             label: "Jerasure, Cauchy",
            points: { show: true },
            lines: { show: true },
@@ -56,22 +48,14 @@ $(function() {
            lines: { show: true },
        });
     }
-    if (typeof decode_vandermonde_jerasure_generic != 'undefined') {
+    if (typeof decode_vandermonde_jerasure != 'undefined') {
         decode.push({
-           data: decode_vandermonde_jerasure_generic,
+           data: decode_vandermonde_jerasure,
             label: "Jerasure Generic, Vandermonde",
            points: { show: true },
            lines: { show: true },
        });
     }
-    if (typeof decode_vandermonde_jerasure_sse4 != 'undefined') {
-        decode.push({
-           data: decode_vandermonde_jerasure_sse4,
-            label: "Jerasure SIMD, Vandermonde",
-           points: { show: true },
-           lines: { show: true },
-       });
-    }
     if (typeof decode_cauchy_isa != 'undefined') {
         decode.push({
            data: decode_cauchy_isa,
@@ -80,9 +64,9 @@ $(function() {
            lines: { show: true },
        });
     }
-    if (typeof decode_cauchy_jerasure_generic != 'undefined') {
+    if (typeof decode_cauchy_jerasure != 'undefined') {
         decode.push({
-           data: decode_cauchy_jerasure_generic,
+           data: decode_cauchy_jerasure,
             label: "Jerasure, Cauchy",
            points: { show: true },
            lines: { show: true },
index d0941c1123112e950f7d8e89f24411f5e1608255..943dea187f263bdd1c466d67f713a52c55567a59 100644 (file)
@@ -7,22 +7,6 @@ include_directories(jerasure/jerasure/include)
 include_directories(jerasure/gf-complete/include)
 include_directories(jerasure)
 
-if(TRUE)
-  list(APPEND jerasure_flavors generic)
-endif()
-
-if(HAVE_NEON)
-  list(APPEND jerasure_flavors neon)
-endif()
-
-if(HAVE_SSE)
-  list(APPEND jerasure_flavors sse3)
-endif()
-
-if(INTEL_SSE4_1)
-  list(APPEND jerasure_flavors sse4)
-endif()
-
 add_subdirectory(jerasure)
 add_subdirectory(lrc)
 add_subdirectory(shec)
@@ -42,9 +26,3 @@ add_custom_target(erasure_code_plugins DEPENDS
     ${EC_ISA_LIB}
     ec_lrc
     ec_jerasure)
-if(TARGET ec_jerasure_sse3)
-  add_dependencies(erasure_code_plugins ec_jerasure_sse3)
-endif()
-if(TARGET ec_jerasure_sse4)
-  add_dependencies(erasure_code_plugins ec_jerasure_sse4)
-endif()
index cf22a43d14d087409dcd9badfaef8e33ea4c2f6f..a17f5c392382a2a3d9f0ddef8034534fd431b085 100644 (file)
@@ -5,20 +5,39 @@ add_library(jerasure_utils OBJECT
   ErasureCodeJerasure.cc)
 add_dependencies(jerasure_utils ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
 
-add_library(ec_jerasure SHARED ErasureCodePluginSelectJerasure.cc)
-add_dependencies(ec_jerasure ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
-target_link_libraries(ec_jerasure ${EXTRALIBS})
-install(TARGETS ec_jerasure DESTINATION ${erasure_plugin_dir})
+# Set the CFLAGS correctly for gf-complete based on SIMD compiler support
+set(GF_COMPILE_FLAGS)
+if(HAVE_ARMV8_SIMD)
+  list(APPEND GF_COMPILE_FLAGS ARM_NEON ARCH_AARCH64)
+endif()
+if(HAVE_ARM_NEON)
+  list(APPEND GF_COMPILE_FLAGS ARM_NEON)
+endif()
+if(HAVE_INTEL_SSE)
+  list(APPEND GF_COMPILE_FLAGS INTEL_SSE)
+endif()
+if(HAVE_INTEL_SSE2)
+  list(APPEND GF_COMPILE_FLAGS INTEL_SSE2)
+endif()
+if(HAVE_INTEL_SSE3)
+  list(APPEND GF_COMPILE_FLAGS INTEL_SSE3)
+endif()
+if(HAVE_INTEL_SSSE3)
+  list(APPEND GF_COMPILE_FLAGS INTEL_SSSE3)
+endif()
+if(HAVE_INTEL_PCLMUL)
+  list(APPEND GF_COMPILE_FLAGS INTEL_SSE4_PCLMUL)
+endif()
+if(HAVE_INTEL_SSE4_1)
+  list(APPEND GF_COMPILE_FLAGS INTEL_SSE4)
+endif()
+if(HAVE_INTEL_SSE4_2)
+  list(APPEND GF_COMPILE_FLAGS INTEL_SSE4)
+endif()
 
-set(jerasure_srcs
-  jerasure/src/cauchy.c
-  jerasure/src/galois.c
-  jerasure/src/jerasure.c
-  jerasure/src/liberation.c
-  jerasure/src/reed_sol.c
+set(gf-complete_srcs
   gf-complete/src/gf_cpu.c
   gf-complete/src/gf_wgen.c
-  gf-complete/src/gf_method.c
   gf-complete/src/gf_w16.c
   gf-complete/src/gf.c
   gf-complete/src/gf_w32.c
@@ -29,44 +48,34 @@ set(jerasure_srcs
   gf-complete/src/gf_rand.c
   gf-complete/src/gf_w8.c)
 
-list(FIND jerasure_flavors generic found)
-if(found GREATER -1)
-  add_library(jerasure_generic OBJECT ${jerasure_srcs})
-endif()
-
-list(FIND jerasure_flavors neon found)
-if(found GREATER -1)
-  add_library(jerasure_neon OBJECT
-    ${jerasure_srcs}
+if(HAVE_ARM_NEON OR HAVE_ARMV8_SIMD)
+  list(APPEND gf-complete_srcs
     gf-complete/src/neon/gf_w4_neon.c
     gf-complete/src/neon/gf_w8_neon.c
     gf-complete/src/neon/gf_w16_neon.c
     gf-complete/src/neon/gf_w32_neon.c
     gf-complete/src/neon/gf_w64_neon.c)
-  set_target_properties(jerasure_neon PROPERTIES
-    COMPILE_FLAGS ${ARM_NEON_FLAGS})
 endif()
 
-list(FIND jerasure_flavors sse3 found)
-if(found GREATER -1)
-  add_library(jerasure_sse3 OBJECT ${jerasure_srcs})
-  set_target_properties(jerasure_sse3 PROPERTIES
-    COMPILE_FLAGS ${SSE3_FLAGS})
-endif()
+add_library(gf-complete_objs OBJECT ${gf-complete_srcs})
+set_target_properties(gf-complete_objs PROPERTIES 
+  COMPILE_FLAGS ${SIMD_COMPILE_FLAGS})
+set_target_properties(gf-complete_objs PROPERTIES 
+  COMPILE_DEFINITIONS "${GF_COMPILE_FLAGS}")
 
-list(FIND jerasure_flavors sse4 found)
-if(found GREATER -1)
-  add_library(jerasure_sse4 OBJECT ${jerasure_srcs})
-  set_target_properties(jerasure_sse4 PROPERTIES
-    COMPILE_FLAGS ${SSE4_FLAGS})
-endif()
+set(jerasure_srcs
+  jerasure/src/cauchy.c
+  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}) 
 
-foreach(flavor ${jerasure_flavors})
-  set(plugin_name "ec_jerasure_${flavor}")
-  add_library(${plugin_name} SHARED
-    $<TARGET_OBJECTS:jerasure_${flavor}>
-    $<TARGET_OBJECTS:jerasure_utils>
-    $<TARGET_OBJECTS:erasure_code_objs>)
-  target_link_libraries(${plugin_name} ${EXTRALIBS})
-  install(TARGETS ${plugin_name} DESTINATION ${erasure_plugin_dir})
-endforeach()
+add_library(ec_jerasure SHARED
+  $<TARGET_OBJECTS:gf-complete_objs>
+  $<TARGET_OBJECTS:jerasure_objs>
+  $<TARGET_OBJECTS:jerasure_utils>
+  $<TARGET_OBJECTS:erasure_code_objs>)
+target_link_libraries(ec_jerasure ${EXTRALIBS})
+install(TARGETS ec_jerasure DESTINATION ${erasure_plugin_dir})
index b3d03b56132aa4102332d951af7eba813248d89d..3ae4366635b56c9c6e5f3d302e0977be9e0cb40f 100644 (file)
@@ -19,6 +19,7 @@
 #include "common/debug.h"
 #include "erasure-code/ErasureCodePlugin.h"
 #include "ErasureCodeJerasure.h"
+#include "jerasure_init.h"
 
 #define dout_subsys ceph_subsys_osd
 #undef dout_prefix
@@ -72,25 +73,15 @@ public:
   }
 };
 
-extern "C" {
-#include "galois.h"
-
-extern gf_t *gfp_array[];
-extern int  gfp_is_composite[];
-}
-
 const char *__erasure_code_version() { return CEPH_GIT_NICE_VER; }
 
 int __erasure_code_init(char *plugin_name, char *directory)
 {
   ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
   int w[] = { 4, 8, 16, 32 };
-  for(int i = 0; i < 4; i++) {
-    int r = galois_init_default_field(w[i]);
-    if (r) {
-      derr << "failed to gf_init_easy(" << w[i] << ")" << dendl;
-      return -r;
-    }
+  int r = jerasure_init(4, w);
+  if (r) {
+    return -r;
   }
   return instance.add(plugin_name, new ErasureCodePluginJerasure());
 }
diff --git a/src/erasure-code/jerasure/ErasureCodePluginSelectJerasure.cc b/src/erasure-code/jerasure/ErasureCodePluginSelectJerasure.cc
deleted file mode 100644 (file)
index 96c2280..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph distributed storage system
- *
- * Copyright (C) 2014 Cloudwatt <libre.licensing@cloudwatt.com>
- * Copyright (C) 2014 Red Hat <contact@redhat.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 "ceph_ver.h"
-#include "common/debug.h"
-#include "arch/probe.h"
-#include "arch/intel.h"
-#include "arch/arm.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: ";
-}
-
-static string get_variant() {
-  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) {
-    return "sse4";
-  } else if (ceph_arch_intel_ssse3 &&
-            ceph_arch_intel_sse3 &&
-            ceph_arch_intel_sse2) {
-    return "sse3";
-  } else if (ceph_arch_neon) {
-    return "neon";
-  } else {
-    return "generic";
-  }
-}
-
-class ErasureCodePluginSelectJerasure : public ErasureCodePlugin {
-public:
-  virtual int factory(const std::string &directory,
-                     ErasureCodeProfile &profile,
-                     ErasureCodeInterfaceRef *erasure_code,
-                     ostream *ss) {
-    ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
-    int ret;
-    string name = "jerasure";
-    if (profile.count("jerasure-name"))
-      name = profile.find("jerasure-name")->second;
-    if (profile.count("jerasure-variant")) {
-      dout(10) << "jerasure-variant " 
-              << profile.find("jerasure-variant")->second << dendl;
-      ret = instance.factory(name + "_" + profile.find("jerasure-variant")->second,
-                            directory,
-                            profile, erasure_code, ss);
-    } else {
-      string variant = get_variant();
-      dout(10) << variant << " plugin" << dendl;
-      ret = instance.factory(name + "_" + variant, directory,
-                            profile, erasure_code, ss);
-    }
-    return ret;
-  }
-};
-
-const char *__erasure_code_version() { return CEPH_GIT_NICE_VER; }
-
-int __erasure_code_init(char *plugin_name, char *directory)
-{
-  ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
-  string variant = get_variant();
-  ErasureCodePlugin *plugin;
-  stringstream ss;
-  int r = instance.load(plugin_name + string("_") + variant,
-                       directory, &plugin, &ss);
-  if (r) {
-    derr << ss.str() << dendl;
-    return r;
-  }
-  dout(10) << ss.str() << dendl;
-  return instance.add(plugin_name, new ErasureCodePluginSelectJerasure());
-}
diff --git a/src/erasure-code/jerasure/jerasure_init.cc b/src/erasure-code/jerasure/jerasure_init.cc
new file mode 100644 (file)
index 0000000..d05c6ce
--- /dev/null
@@ -0,0 +1,35 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph distributed storage system
+ *
+ * Copyright (C) 2013,2014 Cloudwatt <libre.licensing@cloudwatt.com>
+ * Copyright (C) 2014 Red Hat <contact@redhat.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 "jerasure_init.h"
+
+extern "C" {
+#include "galois.h"
+}
+
+extern "C" int jerasure_init(int count, int *words)
+{
+  for(int i = 0; i < count; i++) {
+    int r = galois_init_default_field(words[i]);
+    if (r) {
+      derr << "failed to galois_init_default_field(" << words[i] << ")" << dendl;
+      return -r;
+    }
+  }
+  return 0;
+}
diff --git a/src/erasure-code/jerasure/jerasure_init.h b/src/erasure-code/jerasure/jerasure_init.h
new file mode 100644 (file)
index 0000000..758287a
--- /dev/null
@@ -0,0 +1,24 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph distributed storage system
+ *
+ * Copyright (C) 2013, 2014 Cloudwatt <libre.licensing@cloudwatt.com>
+ * Copyright (C) 2014 Red Hat <contact@redhat.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.
+ * 
+ */
+
+#ifndef CEPH_JERASURE_INIT_H
+#define CEPH_JERASURE_INIT_H
+
+extern "C" int jerasure_init(int count, int *words);
+
+#endif
+
index b49f75fc720826d9991238f84c7e6311f1cf7358..4c5eaf408b85b9d553e7a7ceb0138eb8f9b7ee66 100644 (file)
@@ -10,16 +10,10 @@ add_library(shec_utils OBJECT
   determinant.c)
 add_dependencies(shec_utils ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
 
-add_library(ec_shec SHARED ErasureCodePluginSelectShec.cc)
+add_library(ec_shec SHARED
+  $<TARGET_OBJECTS:gf-complete_objs>
+  $<TARGET_OBJECTS:jerasure_objs>
+  $<TARGET_OBJECTS:shec_utils>)
 add_dependencies(ec_shec ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
 target_link_libraries(ec_shec ${EXTRALIBS})
 install(TARGETS ec_shec DESTINATION ${erasure_plugin_dir})
-
-foreach(flavor ${jerasure_flavors})
-  set(plugin_name "ec_shec_${flavor}")
-  add_library(${plugin_name} SHARED
-    $<TARGET_OBJECTS:jerasure_${flavor}>
-    $<TARGET_OBJECTS:shec_utils>)
-  target_link_libraries(${plugin_name} ${EXTRALIBS})
-  install(TARGETS ${plugin_name} DESTINATION ${erasure_plugin_dir})
-endforeach()
diff --git a/src/erasure-code/shec/ErasureCodePluginSelectShec.cc b/src/erasure-code/shec/ErasureCodePluginSelectShec.cc
deleted file mode 100644 (file)
index 3a4f74e..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-// -*- 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) 2013,2014 Cloudwatt <libre.licensing@cloudwatt.com>
- * Copyright (C) 2014 Red Hat <contact@redhat.com>
- * Copyright (C) 2014,2015 FUJITSU LIMITED
- *
- * Author: Loic Dachary <loic@dachary.org>
- * Author: Shotaro Kawaguchi <kawaguchi.s@jp.fujitsu.com>
- * Author: Takanori Nakao <nakao.takanori@jp.fujitsu.com>
- * Author: Takeshi Miyamae <miyamae.takeshi@jp.fujitsu.com>
- *
- *  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 "ceph_ver.h"
-#include "common/debug.h"
-#include "arch/probe.h"
-#include "arch/intel.h"
-#include "arch/arm.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 << "ErasureCodePluginSelectShec: ";
-}
-
-static string get_variant() {
-  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) {
-    return "sse4";
-  } else if (ceph_arch_intel_ssse3 &&
-            ceph_arch_intel_sse3 &&
-            ceph_arch_intel_sse2) {
-    return "sse3";
-  } else if (ceph_arch_neon) {
-    return "neon";
-  } else {
-    return "generic";
-  }
-}
-
-class ErasureCodePluginSelectShec : public ErasureCodePlugin {
-public:
-  virtual int factory(const std::string &directory,
-                     ErasureCodeProfile &profile,
-                     ErasureCodeInterfaceRef *erasure_code,
-                     ostream *ss) {
-    ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
-    int ret;
-    string name = "shec";
-    if (profile.count("shec-name"))
-      name = profile.find("shec-name")->second;
-    if (profile.count("shec-variant")) {
-      dout(10) << "shec-variant "
-              << profile.find("shec-variant")->second << dendl;
-      ret = instance.factory(name + "_" + profile.find("shec-variant")->second,
-                            directory,
-                            profile, erasure_code, ss);
-    } else {
-      string variant = get_variant();
-      dout(10) << variant << " plugin" << dendl;
-      ret = instance.factory(name + "_" + variant, directory,
-                            profile, erasure_code, ss);
-    }
-    return ret;
-  }
-};
-
-const char *__erasure_code_version() { return CEPH_GIT_NICE_VER; }
-
-int __erasure_code_init(char *plugin_name, char *directory)
-{
-  ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
-  string variant = get_variant();
-  ErasureCodePlugin *plugin;
-  stringstream ss;
-  int r = instance.load(plugin_name + string("_") + variant,
-                       directory, &plugin, &ss);
-  if (r) {
-    derr << ss.str() << dendl;
-    return r;
-  }
-  dout(10) << ss.str() << dendl;
-  return instance.add(plugin_name, new ErasureCodePluginSelectShec());
-}
index d2b72f5d56fee48f53c174d1edeb60949ad30d35..7d242b4f7e01e806a6cd793e8c7cfcd27f1ecc7a 100644 (file)
@@ -23,6 +23,7 @@
 #include "erasure-code/ErasureCodePlugin.h"
 #include "ErasureCodeShecTableCache.h"
 #include "ErasureCodeShec.h"
+#include "jerasure_init.h"
 
 #define dout_subsys ceph_subsys_osd
 #undef dout_prefix
@@ -70,25 +71,15 @@ public:
   }
 };
 
-extern "C" {
-#include "jerasure/include/galois.h"
-
-extern gf_t *gfp_array[];
-extern int  gfp_is_composite[];
-}
-
 const char *__erasure_code_version() { return CEPH_GIT_NICE_VER; }
 
 int __erasure_code_init(char *plugin_name, char *directory = (char *)"")
 {
   ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
   int w[] = { 8, 16, 32 };
-  for(int i = 0; i < 3; i++) {
-    int r = galois_init_default_field(w[i]);
-    if (r) {
-      derr << "failed to gf_init_easy(" << w[i] << ")" << dendl;
-      return -r;
-    }
+  int r = jerasure_init(3, w);
+  if (r) {
+    return -r;
   }
   return instance.add(plugin_name, new ErasureCodePluginShec());
 }
index c9062e49acb719bd0d2c59fb14fa9055db71cacf..4426d88710e82d15d8f9406ac9579f2efa055392 100644 (file)
@@ -73,22 +73,6 @@ target_link_libraries(unittest_erasure_code
   common
   )
 
-add_library(ec_test_jerasure_neon SHARED TestJerasurePluginNEON.cc)
-add_dependencies(ec_test_jerasure_neon ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
-target_link_libraries(ec_test_jerasure_neon pthread ${EXTRALIBS})
-
-add_library(ec_test_jerasure_sse4 SHARED TestJerasurePluginSSE4.cc)
-add_dependencies(ec_test_jerasure_sse4 ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
-target_link_libraries(ec_test_jerasure_sse4 pthread ${EXTRALIBS})
-
-add_library(ec_test_jerasure_sse3 SHARED TestJerasurePluginSSE3.cc)
-add_dependencies(ec_test_jerasure_sse3 ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
-target_link_libraries(ec_test_jerasure_sse3 pthread ${EXTRALIBS})
-
-add_library(ec_test_jerasure_generic SHARED TestJerasurePluginGeneric.cc)
-add_dependencies(ec_test_jerasure_generic ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
-target_link_libraries(ec_test_jerasure_generic pthread ${EXTRALIBS})
-
 # unittest_erasure_code_plugin_jerasure
 add_executable(unittest_erasure_code_plugin_jerasure
   TestErasureCodePluginJerasure.cc
@@ -97,16 +81,10 @@ add_ceph_unittest(unittest_erasure_code_plugin_jerasure ${CMAKE_RUNTIME_OUTPUT_D
 target_link_libraries(unittest_erasure_code_plugin_jerasure
   global
   osd
-  ec_jerasure_generic
+  ec_jerasure
   common)
 add_dependencies(unittest_erasure_code_plugin_jerasure
-  ec_jerasure
-  ec_jerasure_sse3
-  ec_jerasure_sse4
-  ec_test_jerasure_neon 
-  ec_test_jerasure_sse4
-  ec_test_jerasure_sse3
-  ec_test_jerasure_generic)
+  ec_jerasure)
 
 if(HAVE_BETTER_YASM_ELF64)
 
@@ -160,34 +138,15 @@ add_executable(unittest_erasure_code_plugin_lrc
 add_ceph_unittest(unittest_erasure_code_plugin_lrc ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_erasure_code_plugin_lrc)
 add_dependencies(unittest_erasure_code_plugin_lrc 
   ec_lrc
-  ec_jerasure
-  ec_jerasure_sse3
-  ec_jerasure_sse4
-  ec_jerasure_generic)
+  ec_jerasure)
 target_link_libraries(unittest_erasure_code_plugin_lrc
   global
   osd
   ${CMAKE_DL_LIBS}
   ec_lrc
-  ec_jerasure_generic
+  ec_jerasure
   common)
 
-add_library(ec_test_shec_neon SHARED TestShecPluginNEON.cc)
-add_dependencies(ec_test_shec_neon ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
-target_link_libraries(ec_test_shec_neon pthread ${EXTRALIBS})
-
-add_library(ec_test_shec_sse4 SHARED TestShecPluginSSE4.cc)
-add_dependencies(ec_test_shec_sse4 ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
-target_link_libraries(ec_test_shec_sse4 pthread ${EXTRALIBS})
-
-add_library(ec_test_shec_sse3 SHARED TestShecPluginSSE3.cc)
-add_dependencies(ec_test_shec_sse3 ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
-target_link_libraries(ec_test_shec_sse3 pthread ${EXTRALIBS})
-
-add_library(ec_test_shec_generic SHARED TestShecPluginGeneric.cc)
-add_dependencies(ec_test_shec_generic ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
-target_link_libraries(ec_test_shec_generic pthread ${EXTRALIBS})
-
 # unittest_erasure_code_plugin_shec
 add_executable(unittest_erasure_code_plugin_shec
   TestErasureCodePluginShec.cc
@@ -198,16 +157,9 @@ target_link_libraries(unittest_erasure_code_plugin_shec
   osd
   ${CMAKE_DL_LIBS}
   common
-  ec_shec_generic)
+  ec_shec)
 add_dependencies(unittest_erasure_code_plugin_shec 
-  ec_shec
-  ec_shec_sse3
-  ec_shec_sse4
-  #ec_shec_neon
-  ec_test_shec_neon
-  ec_test_shec_sse3
-  ec_test_shec_sse4
-  ec_test_shec_generic)
+  ec_shec)
 
 # unittest_erasure_code_example
 add_executable(unittest_erasure_code_example
@@ -237,7 +189,7 @@ target_link_libraries(unittest_erasure_code_jerasure
   global
   osd
   common
-  ec_jerasure_generic
+  ec_jerasure
   )
 
 include_directories(${CMAKE_SOURCE_DIR}/src/erasure-code/jerasure)
@@ -253,7 +205,7 @@ target_link_libraries(unittest_erasure_code_shec
   osd
   ${CMAKE_DL_LIBS}
   common
-  ec_shec_generic
+  ec_shec
   )
 
 # unittest_erasure_code_shec_all
@@ -266,7 +218,7 @@ target_link_libraries(unittest_erasure_code_shec_all
   osd
   ${CMAKE_DL_LIBS}
   common
-  ec_shec_generic
+  ec_shec
   )
 
 # unittest_erasure_code_shec_thread
@@ -279,7 +231,7 @@ target_link_libraries(unittest_erasure_code_shec_thread
   osd
   ${CMAKE_DL_LIBS}
   common
-  ec_shec_generic
+  ec_shec
   )
 
 
@@ -293,5 +245,5 @@ target_link_libraries(unittest_erasure_code_shec_arguments
   osd
   ${CMAKE_DL_LIBS}
   common
-  ec_shec_generic
+  ec_shec
   )
index 6c06ccfd75f9b51358d9eff275ca98d789a9efda..9b1e1c7d389227b714eddc568bbc86319116d961 100644 (file)
@@ -17,9 +17,6 @@
 
 #include <errno.h>
 #include <stdlib.h>
-#include "arch/probe.h"
-#include "arch/intel.h"
-#include "arch/arm.h"
 #include "global/global_init.h"
 #include "erasure-code/ErasureCodePlugin.h"
 #include "common/ceph_argparse.h"
@@ -63,192 +60,6 @@ TEST(ErasureCodePlugin, factory)
   }
 }
 
-TEST(ErasureCodePlugin, select)
-{
-  ceph_arch_probe();
-  // save probe results
-  int arch_intel_pclmul = ceph_arch_intel_pclmul;
-  int arch_intel_sse42  = ceph_arch_intel_sse42;
-  int arch_intel_sse41  = ceph_arch_intel_sse41;
-  int arch_intel_ssse3  = ceph_arch_intel_ssse3;
-  int arch_intel_sse3   = ceph_arch_intel_sse3;
-  int arch_intel_sse2   = ceph_arch_intel_sse2;
-  int arch_neon                = ceph_arch_neon;
-
-  ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
-  ErasureCodeProfile profile;
-  // load test plugins instead of actual plugins to assert the desired side effect
-  // happens
-  profile["jerasure-name"] = "test_jerasure";
-  profile["technique"] = "reed_sol_van";
-
-  // all features are available, load the SSE4 plugin
-  {
-    ceph_arch_intel_pclmul = 1;
-    ceph_arch_intel_sse42  = 1;
-    ceph_arch_intel_sse41  = 1;
-    ceph_arch_intel_ssse3  = 1;
-    ceph_arch_intel_sse3   = 1;
-    ceph_arch_intel_sse2   = 1;
-    ceph_arch_neon        = 0;
-
-    ErasureCodeInterfaceRef erasure_code;
-    int sse4_side_effect = -444;
-    EXPECT_EQ(sse4_side_effect, instance.factory("jerasure",
-                                                g_conf->erasure_code_dir,
-                                                profile,
-                                                 &erasure_code, &cerr));
-  }
-  // pclmul is missing, load the SSE3 plugin
-  {
-    ceph_arch_intel_pclmul = 0;
-    ceph_arch_intel_sse42  = 1;
-    ceph_arch_intel_sse41  = 1;
-    ceph_arch_intel_ssse3  = 1;
-    ceph_arch_intel_sse3   = 1;
-    ceph_arch_intel_sse2   = 1;
-    ceph_arch_neon        = 0;
-
-    ErasureCodeInterfaceRef erasure_code;
-    int sse3_side_effect = -333;
-    EXPECT_EQ(sse3_side_effect, instance.factory("jerasure",
-                                                g_conf->erasure_code_dir,
-                                                profile,
-                                                 &erasure_code, &cerr));
-  }
-  // pclmul and sse3 are missing, load the generic plugin
-  {
-    ceph_arch_intel_pclmul = 0;
-    ceph_arch_intel_sse42  = 1;
-    ceph_arch_intel_sse41  = 1;
-    ceph_arch_intel_ssse3  = 1;
-    ceph_arch_intel_sse3   = 0;
-    ceph_arch_intel_sse2   = 1;
-    ceph_arch_neon        = 0;
-
-    ErasureCodeInterfaceRef erasure_code;
-    int generic_side_effect = -111;
-    EXPECT_EQ(generic_side_effect, instance.factory("jerasure",
-                                                   g_conf->erasure_code_dir,
-                                                   profile,
-                                                   &erasure_code, &cerr));
-  }
-  // neon is set, load the neon plugin
-  {
-    ceph_arch_intel_pclmul = 0;
-    ceph_arch_intel_sse42  = 0;
-    ceph_arch_intel_sse41  = 0;
-    ceph_arch_intel_ssse3  = 0;
-    ceph_arch_intel_sse3   = 0;
-    ceph_arch_intel_sse2   = 0;
-    ceph_arch_neon        = 1;
-
-    ErasureCodeInterfaceRef erasure_code;
-    int generic_side_effect = -555;
-    EXPECT_EQ(generic_side_effect, instance.factory("jerasure",
-                                                   g_conf->erasure_code_dir,
-                                                   profile,
-                                                   &erasure_code, &cerr));
-  }
-
-
-  // restore probe results
-  ceph_arch_intel_pclmul = arch_intel_pclmul;
-  ceph_arch_intel_sse42  = arch_intel_sse42;
-  ceph_arch_intel_sse41  = arch_intel_sse41;
-  ceph_arch_intel_ssse3  = arch_intel_ssse3;
-  ceph_arch_intel_sse3   = arch_intel_sse3;
-  ceph_arch_intel_sse2   = arch_intel_sse2;
-  ceph_arch_neon        = arch_neon;
-}
-
-TEST(ErasureCodePlugin, sse)
-{
-  ceph_arch_probe();
-  bool sse4 = ceph_arch_intel_pclmul &&
-    ceph_arch_intel_sse42 && ceph_arch_intel_sse41 &&
-    ceph_arch_intel_ssse3 && ceph_arch_intel_sse3 &&
-    ceph_arch_intel_sse2;
-  bool sse3 = ceph_arch_intel_ssse3 && ceph_arch_intel_sse3 &&
-    ceph_arch_intel_sse2;
-  vector<string> sse_variants;
-  sse_variants.push_back("generic");
-  if (!sse3)
-    cerr << "SKIP sse3 plugin testing because CPU does not support it\n";
-  else
-    sse_variants.push_back("sse3");
-  if (!sse4)
-    cerr << "SKIP sse4 plugin testing because CPU does not support it\n";
-  else
-    sse_variants.push_back("sse4");
-
-#define LARGE_ENOUGH 2048
-  bufferptr in_ptr(buffer::create_page_aligned(LARGE_ENOUGH));
-  in_ptr.zero();
-  in_ptr.set_length(0);
-  const char *payload =
-    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
-    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
-    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
-    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
-    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
-  in_ptr.append(payload, strlen(payload));
-  bufferlist in;
-  in.push_front(in_ptr);
-
-  ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
-  ErasureCodeProfile profile;
-  profile["technique"] = "reed_sol_van";
-  profile["k"] = "2";
-  profile["m"] = "1";
-  for (vector<string>::iterator sse_variant = sse_variants.begin();
-       sse_variant != sse_variants.end();
-       ++sse_variant) {
-    //
-    // load the plugin variant
-    //
-    ErasureCodeInterfaceRef erasure_code;
-    EXPECT_FALSE(erasure_code);
-    EXPECT_EQ(0, instance.factory("jerasure_" + *sse_variant,
-                                 g_conf->erasure_code_dir,
-                                 profile,
-                                  &erasure_code, &cerr));
-    EXPECT_TRUE(erasure_code.get());
-
-    //
-    // encode
-    //
-    int want_to_encode[] = { 0, 1, 2 };
-    map<int, bufferlist> encoded;
-    EXPECT_EQ(0, erasure_code->encode(set<int>(want_to_encode, want_to_encode+3),
-                                      in,
-                                      &encoded));
-    EXPECT_EQ(3u, encoded.size());
-    unsigned length =  encoded[0].length();
-    EXPECT_EQ(0, strncmp(encoded[0].c_str(), in.c_str(), length));
-    EXPECT_EQ(0, strncmp(encoded[1].c_str(), in.c_str() + length,
-                         in.length() - length));
-
-    //
-    // decode with reconstruction
-    //
-    map<int, bufferlist> degraded = encoded;
-    degraded.erase(1);
-    EXPECT_EQ(2u, degraded.size());
-    int want_to_decode[] = { 0, 1 };
-    map<int, bufferlist> decoded;
-    EXPECT_EQ(0, erasure_code->decode(set<int>(want_to_decode, want_to_decode+2),
-                                      degraded,
-                                      &decoded));
-    EXPECT_EQ(3u, decoded.size());
-    EXPECT_EQ(length, decoded[0].length());
-    EXPECT_EQ(0, strncmp(decoded[0].c_str(), in.c_str(), length));
-    EXPECT_EQ(0, strncmp(decoded[1].c_str(), in.c_str() + length,
-                         in.length() - length));
-
-  }
-}
-
 int main(int argc, char **argv)
 {
   vector<const char*> args;
index abd116ca7007625b41224aa8bbbb1c8111a39e94..a6d95205e4d68b96bf04decce60ec5d32bbcffbd 100644 (file)
@@ -18,9 +18,6 @@
 
 #include <errno.h>
 #include <stdlib.h>
-#include "arch/probe.h"
-#include "arch/intel.h"
-#include "arch/arm.h"
 #include "global/global_init.h"
 #include "erasure-code/ErasureCodePlugin.h"
 #include "common/ceph_argparse.h"
@@ -58,193 +55,6 @@ TEST(ErasureCodePlugin, factory)
   }
 }
 
-TEST(ErasureCodePlugin, select)
-{
-  ceph_arch_probe();
-  // save probe results
-  int arch_intel_pclmul = ceph_arch_intel_pclmul;
-  int arch_intel_sse42  = ceph_arch_intel_sse42;
-  int arch_intel_sse41  = ceph_arch_intel_sse41;
-  int arch_intel_ssse3  = ceph_arch_intel_ssse3;
-  int arch_intel_sse3   = ceph_arch_intel_sse3;
-  int arch_intel_sse2   = ceph_arch_intel_sse2;
-  int arch_neon                = ceph_arch_neon;
-
-  ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
-  map<std::string,std::string> profile;
-  // load test plugins instead of actual plugins to assert the desired side effect
-  // happens
-  profile["shec-name"] = "test_shec";
-  profile["technique"] = "multiple";
-
-  // all features are available, load the SSE4 plugin
-  {
-    ceph_arch_intel_pclmul = 1;
-    ceph_arch_intel_sse42  = 1;
-    ceph_arch_intel_sse41  = 1;
-    ceph_arch_intel_ssse3  = 1;
-    ceph_arch_intel_sse3   = 1;
-    ceph_arch_intel_sse2   = 1;
-    ceph_arch_neon        = 0;
-
-    ErasureCodeInterfaceRef erasure_code;
-    int sse4_side_effect = -444;
-    EXPECT_EQ(sse4_side_effect, instance.factory("shec",
-                                                g_conf->erasure_code_dir,
-                                                profile,
-                                                 &erasure_code, &cerr));
-  }
-  // pclmul is missing, load the SSE3 plugin
-  {
-    ceph_arch_intel_pclmul = 0;
-    ceph_arch_intel_sse42  = 1;
-    ceph_arch_intel_sse41  = 1;
-    ceph_arch_intel_ssse3  = 1;
-    ceph_arch_intel_sse3   = 1;
-    ceph_arch_intel_sse2   = 1;
-    ceph_arch_neon        = 0;
-
-    ErasureCodeInterfaceRef erasure_code;
-    int sse3_side_effect = -333;
-    EXPECT_EQ(sse3_side_effect, instance.factory("shec",
-                                                g_conf->erasure_code_dir,
-                                                profile,
-                                                 &erasure_code, &cerr));
-  }
-  // pclmul and sse3 are missing, load the generic plugin
-  {
-    ceph_arch_intel_pclmul = 0;
-    ceph_arch_intel_sse42  = 1;
-    ceph_arch_intel_sse41  = 1;
-    ceph_arch_intel_ssse3  = 1;
-    ceph_arch_intel_sse3   = 0;
-    ceph_arch_intel_sse2   = 1;
-    ceph_arch_neon        = 0;
-
-    ErasureCodeInterfaceRef erasure_code;
-    int generic_side_effect = -111;
-    EXPECT_EQ(generic_side_effect, instance.factory("shec",
-                                                   g_conf->erasure_code_dir,
-                                                   profile,
-                                                   &erasure_code, &cerr));
-  }
-  // neon is set, load the neon plugin
-  {
-    ceph_arch_intel_pclmul = 0;
-    ceph_arch_intel_sse42  = 0;
-    ceph_arch_intel_sse41  = 0;
-    ceph_arch_intel_ssse3  = 0;
-    ceph_arch_intel_sse3   = 0;
-    ceph_arch_intel_sse2   = 0;
-    ceph_arch_neon        = 1;
-
-    ErasureCodeInterfaceRef erasure_code;
-    int generic_side_effect = -555;
-    EXPECT_EQ(generic_side_effect, instance.factory("shec",
-                                                   g_conf->erasure_code_dir,
-                                                   profile,
-                                                   &erasure_code, &cerr));
-  }
-
-
-  // restore probe results
-  ceph_arch_intel_pclmul = arch_intel_pclmul;
-  ceph_arch_intel_sse42  = arch_intel_sse42;
-  ceph_arch_intel_sse41  = arch_intel_sse41;
-  ceph_arch_intel_ssse3  = arch_intel_ssse3;
-  ceph_arch_intel_sse3   = arch_intel_sse3;
-  ceph_arch_intel_sse2   = arch_intel_sse2;
-  ceph_arch_neon        = arch_neon;
-}
-
-TEST(ErasureCodePlugin, sse)
-{
-  ceph_arch_probe();
-  bool sse4 = ceph_arch_intel_pclmul &&
-    ceph_arch_intel_sse42 && ceph_arch_intel_sse41 &&
-    ceph_arch_intel_ssse3 && ceph_arch_intel_sse3 &&
-    ceph_arch_intel_sse2;
-  bool sse3 = ceph_arch_intel_ssse3 && ceph_arch_intel_sse3 &&
-    ceph_arch_intel_sse2;
-  vector<string> sse_variants;
-  sse_variants.push_back("generic");
-  if (!sse3)
-    cerr << "SKIP sse3 plugin testing because CPU does not support it\n";
-  else
-    sse_variants.push_back("sse3");
-  if (!sse4)
-    cerr << "SKIP sse4 plugin testing because CPU does not support it\n";
-  else
-    sse_variants.push_back("sse4");
-
-#define LARGE_ENOUGH 2048
-  bufferptr in_ptr(buffer::create_page_aligned(LARGE_ENOUGH));
-  in_ptr.zero();
-  in_ptr.set_length(0);
-  const char *payload =
-    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
-    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
-    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
-    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
-    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
-  in_ptr.append(payload, strlen(payload));
-  bufferlist in;
-  in.push_front(in_ptr);
-
-  ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
-  map<std::string,std::string> profile;
-  profile["technique"] = "multiple";
-  profile["k"] = "2";
-  profile["m"] = "1";
-  profile["c"] = "1";
-  for (vector<string>::iterator sse_variant = sse_variants.begin();
-       sse_variant != sse_variants.end();
-       ++sse_variant) {
-    //
-    // load the plugin variant
-    //
-    ErasureCodeInterfaceRef erasure_code;
-    EXPECT_FALSE(erasure_code);
-    EXPECT_EQ(0, instance.factory("shec_" + *sse_variant,
-                                 g_conf->erasure_code_dir,
-                                 profile,
-                                  &erasure_code, &cerr));
-    EXPECT_TRUE(erasure_code.get());
-
-    //
-    // encode
-    //
-    int want_to_encode[] = { 0, 1, 2 };
-    map<int, bufferlist> encoded;
-    EXPECT_EQ(0, erasure_code->encode(set<int>(want_to_encode, want_to_encode+3),
-                                      in,
-                                      &encoded));
-    EXPECT_EQ(3u, encoded.size());
-    unsigned length =  encoded[0].length();
-    EXPECT_EQ(0, strncmp(encoded[0].c_str(), in.c_str(), length));
-    EXPECT_EQ(0, strncmp(encoded[1].c_str(), in.c_str() + length,
-                         in.length() - length));
-
-    //
-    // decode with reconstruction
-    //
-    map<int, bufferlist> degraded = encoded;
-    degraded.erase(1);
-    EXPECT_EQ(2u, degraded.size());
-    int want_to_decode[] = { 0, 1 };
-    map<int, bufferlist> decoded;
-    EXPECT_EQ(0, erasure_code->decode(set<int>(want_to_decode, want_to_decode+2),
-                                      degraded,
-                                      &decoded));
-    EXPECT_EQ(3u, decoded.size());
-    EXPECT_EQ(length, decoded[0].length());
-    EXPECT_EQ(0, strncmp(decoded[0].c_str(), in.c_str(), length));
-    EXPECT_EQ(0, strncmp(decoded[1].c_str(), in.c_str() + length,
-                         in.length() - length));
-
-  }
-}
-
 int main(int argc, char **argv)
 {
   vector<const char*> args;
diff --git a/src/test/erasure-code/TestJerasurePluginGeneric.cc b/src/test/erasure-code/TestJerasurePluginGeneric.cc
deleted file mode 100644 (file)
index e7a7597..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph distributed storage system
- *
- * Copyright (C) 2014 Cloudwatt <libre.licensing@cloudwatt.com>
- * Copyright (C) 2014 Red Hat <contact@redhat.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 "ceph_ver.h"
-
-extern "C" const char *__erasure_code_version() { return CEPH_GIT_NICE_VER; }
-
-extern "C" int __erasure_code_init(char *plugin_name, char *directory)
-{
-  return -111;
-}
diff --git a/src/test/erasure-code/TestJerasurePluginNEON.cc b/src/test/erasure-code/TestJerasurePluginNEON.cc
deleted file mode 100644 (file)
index cd38ccb..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph distributed storage system
- *
- * Copyright (C) 2014 Cloudwatt <libre.licensing@cloudwatt.com>
- * Copyright (C) 2014 Red Hat <contact@redhat.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 "ceph_ver.h"
-
-extern "C" const char *__erasure_code_version() { return CEPH_GIT_NICE_VER; }
-
-extern "C" int __erasure_code_init(char *plugin_name, char *directory)
-{
-  return -555;
-}
diff --git a/src/test/erasure-code/TestJerasurePluginSSE3.cc b/src/test/erasure-code/TestJerasurePluginSSE3.cc
deleted file mode 100644 (file)
index 0c752b2..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph distributed storage system
- *
- * Copyright (C) 2014 Cloudwatt <libre.licensing@cloudwatt.com>
- * Copyright (C) 2014 Red Hat <contact@redhat.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 "ceph_ver.h"
-
-extern "C" const char *__erasure_code_version() { return CEPH_GIT_NICE_VER; }
-
-extern "C" int __erasure_code_init(char *plugin_name, char *directory)
-{
-  return -333;
-}
diff --git a/src/test/erasure-code/TestJerasurePluginSSE4.cc b/src/test/erasure-code/TestJerasurePluginSSE4.cc
deleted file mode 100644 (file)
index a39a9b4..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph distributed storage system
- *
- * Copyright (C) 2014 Cloudwatt <libre.licensing@cloudwatt.com>
- * Copyright (C) 2014 Red Hat <contact@redhat.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 "ceph_ver.h"
-
-extern "C" const char *__erasure_code_version() { return CEPH_GIT_NICE_VER; }
-
-extern "C" int __erasure_code_init(char *plugin_name, char *directory)
-{
-  return -444;
-}
diff --git a/src/test/erasure-code/TestShecPluginGeneric.cc b/src/test/erasure-code/TestShecPluginGeneric.cc
deleted file mode 100644 (file)
index 0bd063b..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph distributed storage system
- *
- * Copyright (C) 2014 Cloudwatt <libre.licensing@cloudwatt.com>
- * Copyright (C) 2014 Red Hat <contact@redhat.com>
- * Copyright (C) 2015 FUJITSU LIMITED
- *
- * Author: Loic Dachary <loic@dachary.org>
- * Author: Shotaro Kawaguchi <kawaguchi.s@jp.fujitsu.com>
- * Author: Takanori Nakao <nakao.takanori@jp.fujitsu.com>
- * Author: Takeshi Miyamae <miyamae.takeshi@jp.fujitsu.com>
- *
- *  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 "ceph_ver.h"
-
-extern "C" const char *__erasure_code_version() { return CEPH_GIT_NICE_VER; }
-
-extern "C" int __erasure_code_init(char *plugin_name, char *directory)
-{
-  return -111;
-}
diff --git a/src/test/erasure-code/TestShecPluginNEON.cc b/src/test/erasure-code/TestShecPluginNEON.cc
deleted file mode 100644 (file)
index 373f5eb..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph distributed storage system
- *
- * Copyright (C) 2014 Cloudwatt <libre.licensing@cloudwatt.com>
- * Copyright (C) 2014 Red Hat <contact@redhat.com>
- * Copyright (C) 2015 FUJITSU LIMITED
- *
- * Author: Loic Dachary <loic@dachary.org>
- * Author: Shotaro Kawaguchi <kawaguchi.s@jp.fujitsu.com>
- * Author: Takanori Nakao <nakao.takanori@jp.fujitsu.com>
- * Author: Takeshi Miyamae <miyamae.takeshi@jp.fujitsu.com>
- *
- *  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 "ceph_ver.h"
-
-extern "C" const char *__erasure_code_version() { return CEPH_GIT_NICE_VER; }
-
-extern "C" int __erasure_code_init(char *plugin_name, char *directory)
-{
-  return -555;
-}
diff --git a/src/test/erasure-code/TestShecPluginSSE3.cc b/src/test/erasure-code/TestShecPluginSSE3.cc
deleted file mode 100644 (file)
index 220ea7b..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph distributed storage system
- *
- * Copyright (C) 2014 Cloudwatt <libre.licensing@cloudwatt.com>
- * Copyright (C) 2014 Red Hat <contact@redhat.com>
- * Copyright (C) 2015 FUJITSU LIMITED
- *
- * Author: Loic Dachary <loic@dachary.org>
- * Author: Shotaro Kawaguchi <kawaguchi.s@jp.fujitsu.com>
- * Author: Takanori Nakao <nakao.takanori@jp.fujitsu.com>
- * Author: Takeshi Miyamae <miyamae.takeshi@jp.fujitsu.com>
- *
- *  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 "ceph_ver.h"
-
-extern "C" const char *__erasure_code_version() { return CEPH_GIT_NICE_VER; }
-
-extern "C" int __erasure_code_init(char *plugin_name, char *directory)
-{
-  return -333;
-}
diff --git a/src/test/erasure-code/TestShecPluginSSE4.cc b/src/test/erasure-code/TestShecPluginSSE4.cc
deleted file mode 100644 (file)
index ef8e841..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph distributed storage system
- *
- * Copyright (C) 2014 Cloudwatt <libre.licensing@cloudwatt.com>
- * Copyright (C) 2014 Red Hat <contact@redhat.com>
- * Copyright (C) 2015 FUJITSU LIMITED
- *
- * Author: Loic Dachary <loic@dachary.org>
- * Author: Shotaro Kawaguchi <kawaguchi.s@jp.fujitsu.com>
- * Author: Takanori Nakao <nakao.takanori@jp.fujitsu.com>
- * Author: Takeshi Miyamae <miyamae.takeshi@jp.fujitsu.com>
- *
- *  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 "ceph_ver.h"
-
-extern "C" const char *__erasure_code_version() { return CEPH_GIT_NICE_VER; }
-
-extern "C" int __erasure_code_init(char *plugin_name, char *directory)
-{
-  return -444;
-}