未验证 提交 a89e48fe 编写于 作者: L Leo Chen 提交者: GitHub

use xxhash instead of cryptopp (#45837)

上级 f7832fea
...@@ -509,13 +509,9 @@ cc_library( ...@@ -509,13 +509,9 @@ cc_library(
operator operator
glog glog
version version
xxhash
dist_attr) dist_attr)
if(WITH_CRYPTO)
add_dependencies(proto_desc cryptopp)
target_link_libraries(proto_desc cryptopp)
endif()
cc_library( cc_library(
op_registry op_registry
SRCS op_registry.cc SRCS op_registry.cc
......
...@@ -14,12 +14,13 @@ limitations under the License. */ ...@@ -14,12 +14,13 @@ limitations under the License. */
#include "paddle/fluid/framework/program_desc.h" #include "paddle/fluid/framework/program_desc.h"
extern "C" {
#include <xxhash.h>
}
#include <algorithm> #include <algorithm>
#include "paddle/fluid/framework/feed_fetch_type.h" #include "paddle/fluid/framework/feed_fetch_type.h"
#include "paddle/fluid/framework/version.h" #include "paddle/fluid/framework/version.h"
#ifdef PADDLE_WITH_CRYPTO
#include "paddle/fluid/framework/io/crypto/sha.h"
#endif
namespace paddle { namespace paddle {
namespace framework { namespace framework {
...@@ -257,11 +258,9 @@ std::string ProgramDesc::CachedHashString() { ...@@ -257,11 +258,9 @@ std::string ProgramDesc::CachedHashString() {
if (cached_hash_str_.size() == 0 || NeedUpdate()) { if (cached_hash_str_.size() == 0 || NeedUpdate()) {
Flush(); Flush();
desc_.SerializePartialToString(&serialize_str); desc_.SerializePartialToString(&serialize_str);
#ifdef PADDLE_WITH_CRYPTO // non-cryptographic is enough
cached_hash_str_ = HexEncoding(GetSha1(serialize_str)); cached_hash_str_ =
#else std::to_string(XXH64(serialize_str.c_str(), serialize_str.size(), 1));
cached_hash_str_ = serialize_str;
#endif
} }
return cached_hash_str_; return cached_hash_str_;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册