From a89e48fe8567d33478961c4336dbe0460690d63f Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Wed, 7 Sep 2022 19:55:21 +0800 Subject: [PATCH] use xxhash instead of cryptopp (#45837) --- paddle/fluid/framework/CMakeLists.txt | 6 +----- paddle/fluid/framework/program_desc.cc | 15 +++++++-------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/paddle/fluid/framework/CMakeLists.txt b/paddle/fluid/framework/CMakeLists.txt index c72e53308e6..85806014312 100755 --- a/paddle/fluid/framework/CMakeLists.txt +++ b/paddle/fluid/framework/CMakeLists.txt @@ -509,13 +509,9 @@ cc_library( operator glog version + xxhash dist_attr) -if(WITH_CRYPTO) - add_dependencies(proto_desc cryptopp) - target_link_libraries(proto_desc cryptopp) -endif() - cc_library( op_registry SRCS op_registry.cc diff --git a/paddle/fluid/framework/program_desc.cc b/paddle/fluid/framework/program_desc.cc index 7b4f0a71a53..79e8f0bba00 100644 --- a/paddle/fluid/framework/program_desc.cc +++ b/paddle/fluid/framework/program_desc.cc @@ -14,12 +14,13 @@ limitations under the License. */ #include "paddle/fluid/framework/program_desc.h" +extern "C" { +#include +} + #include #include "paddle/fluid/framework/feed_fetch_type.h" #include "paddle/fluid/framework/version.h" -#ifdef PADDLE_WITH_CRYPTO -#include "paddle/fluid/framework/io/crypto/sha.h" -#endif namespace paddle { namespace framework { @@ -257,11 +258,9 @@ std::string ProgramDesc::CachedHashString() { if (cached_hash_str_.size() == 0 || NeedUpdate()) { Flush(); desc_.SerializePartialToString(&serialize_str); -#ifdef PADDLE_WITH_CRYPTO - cached_hash_str_ = HexEncoding(GetSha1(serialize_str)); -#else - cached_hash_str_ = serialize_str; -#endif + // non-cryptographic is enough + cached_hash_str_ = + std::to_string(XXH64(serialize_str.c_str(), serialize_str.size(), 1)); } return cached_hash_str_; } -- GitLab