diff options
author | 2018-01-03 08:22:37 -0800 | |
---|---|---|
committer | 2018-01-03 08:26:54 -0800 | |
commit | 5d66ea93b2b17dbd4dcc886dcadc455b90bc6e08 (patch) | |
tree | 42b1ac42b55645d7d1fef08081191838b244a9f0 /tensorflow/contrib/tensorboard | |
parent | 0a2a5acbe38df2d1f869aa8d46167ad6d67f3da6 (diff) |
Add Snappy support to SQLite
This change also puts the necessary build infrastructure in place so we can
continue to build many proper lightweight SQLite extensions in the future that
are easy for users to copy over into their own environments, so they can
readily access their data.
PiperOrigin-RevId: 180673039
Diffstat (limited to 'tensorflow/contrib/tensorboard')
-rw-r--r-- | tensorflow/contrib/tensorboard/db/BUILD | 1 | ||||
-rw-r--r-- | tensorflow/contrib/tensorboard/db/summary_db_writer.cc | 20 |
2 files changed, 5 insertions, 16 deletions
diff --git a/tensorflow/contrib/tensorboard/db/BUILD b/tensorflow/contrib/tensorboard/db/BUILD index 9d3d60c24d..3a3402c59b 100644 --- a/tensorflow/contrib/tensorboard/db/BUILD +++ b/tensorflow/contrib/tensorboard/db/BUILD @@ -19,6 +19,7 @@ cc_library( tf_cc_test( name = "schema_test", + size = "small", srcs = ["schema_test.cc"], deps = [ ":schema", diff --git a/tensorflow/contrib/tensorboard/db/summary_db_writer.cc b/tensorflow/contrib/tensorboard/db/summary_db_writer.cc index 04b9c8e457..8929605817 100644 --- a/tensorflow/contrib/tensorboard/db/summary_db_writer.cc +++ b/tensorflow/contrib/tensorboard/db/summary_db_writer.cc @@ -23,7 +23,6 @@ limitations under the License. #include "tensorflow/core/lib/random/random.h" #include "tensorflow/core/lib/strings/stringprintf.h" #include "tensorflow/core/platform/fingerprint.h" -#include "tensorflow/core/platform/snappy.h" #include "tensorflow/core/util/event.pb.h" namespace tensorflow { @@ -56,21 +55,11 @@ Status Serialize(const protobuf::MessageLite& proto, string* output) { return Status::OK(); } -Status Compress(const string& data, string* output) { - output->clear(); - if (!port::Snappy_Compress(data.data(), data.size(), output)) { - return errors::FailedPrecondition("TensorBase needs Snappy"); - } - return Status::OK(); -} - Status BindProto(SqliteStatement* stmt, int parameter, const protobuf::MessageLite& proto) { string serialized; TF_RETURN_IF_ERROR(Serialize(proto, &serialized)); - string compressed; - TF_RETURN_IF_ERROR(Compress(serialized, &compressed)); - stmt->BindBlob(parameter, compressed); + stmt->BindBlob(parameter, serialized); return Status::OK(); } @@ -78,7 +67,6 @@ Status BindTensor(SqliteStatement* stmt, int parameter, const Tensor& t) { // TODO(@jart): Make portable between little and big endian systems. // TODO(@jart): Use TensorChunks with minimal copying for big tensors. // TODO(@jart): Add field to indicate encoding. - // TODO(@jart): Allow crunch tool to re-compress with zlib instead. TensorProto p; t.AsProtoTensorContent(&p); return BindProto(stmt, parameter, p); @@ -250,7 +238,7 @@ class GraphSaver { Status SaveNodes() { auto insert = db_->Prepare(R"sql( INSERT INTO Nodes (graph_id, node_id, node_name, op, device, node_def) - VALUES (?, ?, ?, ?, ?, ?) + VALUES (?, ?, ?, ?, ?, snap(?)) )sql"); for (int node_id = 0; node_id < graph_->node_size(); ++node_id) { NodeDef* node = graph_->mutable_node(node_id); @@ -276,7 +264,7 @@ class GraphSaver { Status SaveGraph() { auto insert = db_->Prepare(R"sql( INSERT INTO Graphs (graph_id, inserted_time, graph_def) - VALUES (?, ?, ?) + VALUES (?, ?, snap(?)) )sql"); insert.BindInt(1, graph_id_); insert.BindDouble(2, GetWallTime(env_)); @@ -305,7 +293,7 @@ class RunWriter { user_name_{user_name}, insert_tensor_{db_->Prepare(R"sql( INSERT OR REPLACE INTO Tensors (tag_id, step, computed_time, tensor) - VALUES (?, ?, ?, ?) + VALUES (?, ?, ?, snap(?)) )sql")} {} ~RunWriter() { |