Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
Loic Dachary
committed
Mar 27, 2014
1 parent
e9878db
commit 10fd6b3
Showing
3 changed files
with
145 additions
and
20 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
src/erasure-code/jerasure/ErasureCodePluginSelectJerasure.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters