Add farmhash fingerprint64 into hash.h and include corresponding dependencies.

Change: 122273744
This commit is contained in:
Yutaka Leon 2016-05-13 09:46:52 -08:00 committed by TensorFlower Gardener
parent f24b02735f
commit 50fd1301af
6 changed files with 105 additions and 6 deletions

21
farmhash.BUILD Normal file
View File

@ -0,0 +1,21 @@
package(default_visibility = ["//visibility:public"])
prefix_dir = "farmhash-34c13ddfab0e35422f4c3979f360635a8c050260"
genrule(
name = "configure",
srcs = glob(
["**/*"],
exclude = [prefix_dir + "/config.h"],
),
outs = [prefix_dir + "/config.h"],
cmd = "pushd external/farmhash_archive/%s; workdir=$$(mktemp -d -t tmp.XXXXXXXXXX); cp -a * $$workdir; pushd $$workdir; ./configure; popd; popd; cp $$workdir/config.h $(@D); rm -rf $$workdir;" % prefix_dir,
)
cc_library(
name = "farmhash",
srcs = [prefix_dir + "/src/farmhash.cc"],
hdrs = [prefix_dir + "/src/farmhash.h"] + [":configure"],
includes = [prefix_dir],
visibility = ["//visibility:public"]
)

View File

@ -199,6 +199,7 @@ cc_library(
"lib/strings/stringprintf.h", "lib/strings/stringprintf.h",
"platform/env.h", "platform/env.h",
"platform/file_system.h", "platform/file_system.h",
"platform/fingerprint.h",
"platform/host_info.h", # TODO(josh11b): make internal "platform/host_info.h", # TODO(josh11b): make internal
"platform/init_main.h", "platform/init_main.h",
"platform/logging.h", "platform/logging.h",

View File

@ -33,20 +33,21 @@ tf_cuda_library(
"//tensorflow/stream_executor", "//tensorflow/stream_executor",
] + select({ ] + select({
"//third_party/gpus/cuda:darwin": ["IOKit"], "//third_party/gpus/cuda:darwin": ["IOKit"],
"//conditions:default": [] "//conditions:default": [],
}), }),
) )
# OSX framework for device driver access # OSX framework for device driver access
cc_library( cc_library(
name = "IOKit", name = "IOKit",
linkopts = ["-framework IOKit"], linkopts = ["-framework IOKit"],
) )
cc_library( cc_library(
name = "platformlib", name = "platformlib",
copts = tf_copts(), copts = tf_copts(),
deps = [ deps = [
"@farmhash_archive//:farmhash",
"@jpeg_archive//:jpeg", "@jpeg_archive//:jpeg",
"@png_archive//:png", "@png_archive//:png",
"@re2//:re2", "@re2//:re2",
@ -83,12 +84,12 @@ cc_library(
linkopts = select({ linkopts = select({
"//third_party/gpus/cuda:darwin": [ "//third_party/gpus/cuda:darwin": [
"-Wl,-rpath,third_party/gpus/cuda/lib", "-Wl,-rpath,third_party/gpus/cuda/lib",
"-Wl,-rpath,third_party/gpus/cuda/extras/CUPTI/lib" "-Wl,-rpath,third_party/gpus/cuda/extras/CUPTI/lib",
], ],
"//conditions:default": [ "//conditions:default": [
"-Wl,-rpath,third_party/gpus/cuda/lib64", "-Wl,-rpath,third_party/gpus/cuda/lib64",
"-Wl,-rpath,third_party/gpus/cuda/extras/CUPTI/lib64" "-Wl,-rpath,third_party/gpus/cuda/extras/CUPTI/lib64",
] ],
}), }),
deps = [ deps = [
"//third_party/gpus/cuda:cudart", "//third_party/gpus/cuda:cudart",

View File

@ -0,0 +1,29 @@
/* Copyright 2016 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_CORE_PLATFORM_DEFAULT_FINGERPRINT_H_
#define TENSORFLOW_CORE_PLATFORM_DEFAULT_FINGERPRINT_H_
#include "farmhash-34c13ddfab0e35422f4c3979f360635a8c050260/src/farmhash.h"
namespace tensorflow {
inline uint64 Fingerprint64(const string& s) {
return ::util::Fingerprint64(s);
}
} // namespace tensorflow
#endif // TENSORFLOW_CORE_PLATFORM_DEFAULT_FINGERPRINT_H_

View File

@ -0,0 +1,35 @@
/* Copyright 2016 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_CORE_PLATFORM_FINGERPRINT_H_
#define TENSORFLOW_CORE_PLATFORM_FINGERPRINT_H_
#include "tensorflow/core/platform/types.h"
namespace tensorflow {
// This is a portable fingerprint interface for strings that will never change.
// However, it is not suitable for cryptography.
uint64 Fingerprint64(const string& s);
} // namespace tensorflow
#if defined(PLATFORM_GOOGLE)
#include "tensorflow/core/platform/google/fingerprint.h"
#else
#include "tensorflow/core/platform/default/fingerprint.h"
#endif
#endif // TENSORFLOW_CORE_PLATFORM_FINGERPRINT_H_

View File

@ -40,6 +40,18 @@ def tf_workspace(path_prefix = "", tf_repo_name = ""):
commit = "96d3acab46fbb03855ca22c2ee2bb9831ac8c83c", commit = "96d3acab46fbb03855ca22c2ee2bb9831ac8c83c",
) )
native.new_http_archive(
name = "farmhash_archive",
url = "https://github.com/google/farmhash/archive/34c13ddfab0e35422f4c3979f360635a8c050260.zip",
sha256 = "e3d37a59101f38fd58fb799ed404d630f0eee18bfc2a2433910977cc8fea9c28",
build_file = path_prefix + "farmhash.BUILD",
)
native.bind(
name = "farmhash",
actual = "@farmhash//:farmhash",
)
native.new_http_archive( native.new_http_archive(
name = "jpeg_archive", name = "jpeg_archive",
url = "http://www.ijg.org/files/jpegsrc.v9a.tar.gz", url = "http://www.ijg.org/files/jpegsrc.v9a.tar.gz",