GCC Code Coverage Report


Directory: src/
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 46.7% 553 / 0 / 1184
Functions: 55.7% 39 / 0 / 70
Branches: 24.8% 494 / 0 / 1992

ps/base/dist_sharded_client.h
Line Branch Exec Source
1 #pragma once
2
3 // Shared implementation for distributed, sharded parameter-server clients.
4 //
5 // DistributedGRPCParameterClient (grpc/dist_grpc_ps_client.*) and
6 // DistributedBRPCParameterClient (brpc/dist_brpc_ps_client.*) are identical
7 // apart from the underlying single-shard client type. The routing, chunking,
8 // async fan-out, result merging and prefetch bookkeeping all live here as a
9 // CRTP-free class template parameterised on that client type.
10
11 #include <algorithm>
12 #include <cstring>
13 #include <future>
14 #include <memory>
15 #include <mutex>
16 #include <string>
17 #include <unordered_map>
18 #include <vector>
19
20 #include "base/array.h"
21 #include "base/hash.h"
22 #include "base/json.h"
23 #include "base/log.h"
24 #include "base/timer.h"
25 #include "ps/base/base_client.h"
26
27 #ifdef ENABLE_PERF_REPORT
28 # include <chrono>
29 # include "base/report/report_client.h"
30 #endif
31
32 using json = nlohmann::json;
33
34 namespace recstore {
35
36 // ClientT is the single-shard client type (GRPCParameterClient /
37 // BRPCParameterClient). It must expose GetParameter/PutParameter/
38 // UpdateParameter/Command/ClearPS/LoadFakeData/DumpFakeData/LoadCkpt/
39 // InitEmbeddingTable and the Prefetch* family.
40 template <typename ClientT>
41 class DistributedShardedClient : public BasePSClient {
42 public:
43 26 explicit DistributedShardedClient(json config, const char* transport_name)
44
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
26 : BasePSClient(config), transport_name_(transport_name) {
45 26 json client_config;
46
47
4/8
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 10 times.
✗ Branch 4 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 16 times.
✗ Branch 4 not taken.
26 if (config.contains("distributed_client")) {
48
6/12
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 10 times.
✗ Branch 8 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 16 times.
✗ Branch 8 not taken.
26 LOG(INFO) << "Detected recstore config format, extracting "
49 "distributed_client section";
50
4/8
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
26 client_config = config["distributed_client"];
51 } else {
52 LOG(FATAL)
53 << "Invalid config format. Expected either recstore config with "
54 "'distributed_client' section "
55 << "or direct client config with 'servers' and 'num_shards' fields";
56 }
57
58
6/12
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 10 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 10 times.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 16 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 16 times.
52 if (!client_config.contains("servers") ||
59
4/8
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 10 times.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 16 times.
26 !client_config["servers"].is_array()) {
60 LOG(FATAL)
61 << "Missing or invalid 'servers' field in distributed client config";
62 }
63
64
6/12
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 10 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 10 times.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 16 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 16 times.
52 if (!client_config.contains("num_shards") ||
65
4/8
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 10 times.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 16 times.
26 !client_config["num_shards"].is_number_integer()) {
66 LOG(FATAL) << "Missing or invalid 'num_shards' field in distributed "
67 "client config";
68 }
69
70
4/8
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
26 num_shards_ = client_config["num_shards"].get<int>();
71
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
26 max_keys_per_request_ = client_config.value("max_keys_per_request", 500);
72
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
26 hash_method_ = client_config.value("hash_method", "city_hash");
73
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
26 if (max_keys_per_request_ <= 0) {
74 LOG(FATAL) << "Invalid max_keys_per_request: " << max_keys_per_request_
75 << ", must be > 0";
76 }
77
78
4/8
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
26 auto servers = client_config["servers"];
79
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
26 server_configs_.reserve(servers.size());
80
81
4/4
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 20 times.
✓ Branch 2 taken 10 times.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 32 times.
✓ Branch 2 taken 16 times.
78 for (size_t i = 0; i < servers.size(); ++i) {
82
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
52 const auto& server = servers[i];
83
10/20
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 20 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 20 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 20 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 20 times.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 32 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 32 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 32 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 32 times.
104 if (!server.contains("host") || !server.contains("port") ||
84
4/8
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 20 times.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 32 times.
52 !server.contains("shard")) {
85 LOG(FATAL) << "Server config " << i
86 << " missing required fields (host, port, shard)";
87 }
88
89 52 ServerConfig cfg;
90
4/8
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 32 times.
✗ Branch 5 not taken.
52 cfg.host = server["host"].get<std::string>();
91
4/8
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 32 times.
✗ Branch 5 not taken.
52 cfg.port = server["port"].get<int>();
92
4/8
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 32 times.
✗ Branch 5 not taken.
52 cfg.shard = server["shard"].get<int>();
93
94
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
52 server_configs_.push_back(cfg);
95
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
52 shard_to_client_index_[cfg.shard] = i;
96 }
97
98
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
26 if (server_configs_.size() != static_cast<size_t>(num_shards_)) {
99 LOG(WARNING) << "Number of servers (" << server_configs_.size()
100 << ") doesn't match num_shards (" << num_shards_ << ")";
101 }
102
103
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
26 partitioned_key_buffer_.resize(num_shards_);
104
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
26 key_index_mapping_.resize(num_shards_);
105
106
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
26 InitializeClients();
107
108
4/8
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
52 LOG(INFO) << "Initialized Distributed" << transport_name_
109
6/12
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 10 times.
✗ Branch 8 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 16 times.
✗ Branch 8 not taken.
26 << "ParameterClient with " << num_shards_
110
6/12
recstore::DistributedShardedClient<BRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 10 times.
✗ Branch 8 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::DistributedShardedClient(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>, char const*):
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 16 times.
✗ Branch 8 not taken.
26 << " shards, hash method: " << hash_method_;
111 26 }
112
113 26 ~DistributedShardedClient() override = default;
114
115 8 int shard_count() const { return num_shards_; }
116
117 // ---- Extended (non-virtual) API ----------------------------------------
118
119 54 bool GetParameter(const base::ConstArray<uint64_t>& keys,
120 std::vector<std::vector<float>>* values) {
121 #ifdef ENABLE_PERF_REPORT
122 auto start_time = std::chrono::high_resolution_clock::now();
123 #endif
124
125
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 1 not taken.
✓ Branch 2 taken 40 times.
54 if (keys.Size() == 0) {
126 values->clear();
127 return true;
128 }
129
130
8/16
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 2 taken 14 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 14 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 14 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 14 times.
✗ Branch 12 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 2 taken 40 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 40 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 40 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 40 times.
✗ Branch 12 not taken.
108 xmh::Timer timer(std::string("Distributed") + transport_name_ +
131 "ParameterClient::GetParameter");
132
133 54 std::vector<std::vector<uint64_t>> partitioned_keys;
134
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
54 PartitionKeys(keys, partitioned_keys);
135
136 54 std::vector<std::future<int>> futures;
137 54 std::vector<std::vector<std::vector<float>>> partitioned_results(
138
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
54 num_shards_);
139
140
4/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 0 taken 28 times.
✓ Branch 1 taken 14 times.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 0 taken 80 times.
✓ Branch 1 taken 40 times.
162 for (int shard_id = 0; shard_id < num_shards_; ++shard_id) {
141
3/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 2 not taken.
✓ Branch 3 taken 28 times.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 72 times.
108 if (partitioned_keys[shard_id].empty()) {
142 8 continue;
143 }
144
145
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 1 taken 28 times.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
100 auto it = shard_to_client_index_.find(shard_id);
146
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 2 not taken.
✓ Branch 3 taken 28 times.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 2 not taken.
✓ Branch 3 taken 72 times.
100 if (it == shard_to_client_index_.end()) {
147 LOG(ERROR) << "No client found for shard " << shard_id;
148 return false;
149 }
150
151 100 int client_index = it->second;
152 100 auto* client = clients_[client_index].get();
153
154
4/8
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 1 taken 28 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 28 times.
✗ Branch 5 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 72 times.
✗ Branch 5 not taken.
100 futures.push_back(std::async(
155 238 std::launch::async, [=, &partitioned_keys, &partitioned_results]() {
156 44 const auto& shard_keys_vec = partitioned_keys[shard_id];
157 44 auto& shard_result_vec = partitioned_results[shard_id];
158 44 shard_result_vec.clear();
159 44 shard_result_vec.reserve(shard_keys_vec.size());
160
161
6/8
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*)::{lambda()#1}::operator()() const:
✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 30 times.
✓ Branch 5 taken 28 times.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*)::{lambda()#1}::operator()() const:
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✓ Branch 5 taken 16 times.
144 for (size_t start = 0; start < shard_keys_vec.size();
162 50 start += static_cast<size_t>(max_keys_per_request_)) {
163 50 size_t end =
164 100 std::min(start + static_cast<size_t>(max_keys_per_request_),
165 50 shard_keys_vec.size());
166 100 base::ConstArray<uint64_t> shard_chunk(
167 50 shard_keys_vec.data() + start, static_cast<int>(end - start));
168 50 std::vector<std::vector<float>> chunk_result;
169
4/8
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*)::{lambda()#1}::operator()() const:
✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 30 times.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*)::{lambda()#1}::operator()() const:
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 20 times.
50 if (!client->GetParameter(shard_chunk, &chunk_result)) {
170 return 0;
171 }
172
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*)::{lambda()#1}::operator()() const:
✓ Branch 5 taken 30 times.
✗ Branch 6 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*)::{lambda()#1}::operator()() const:
✓ Branch 5 taken 20 times.
✗ Branch 6 not taken.
50 shard_result_vec.insert(shard_result_vec.end(),
173 chunk_result.begin(),
174 chunk_result.end());
175 }
176 44 return 1;
177 }));
178 }
179
180
6/8
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 5 not taken.
✗ Branch 6 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*)::{lambda()#1}::operator()() const:
✓ Branch 5 taken 28 times.
✓ Branch 6 taken 14 times.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 5 taken 56 times.
✓ Branch 6 taken 32 times.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*)::{lambda()#1}::operator()() const:
✓ Branch 5 taken 16 times.
✓ Branch 6 taken 8 times.
154 for (auto& future : futures) {
181
6/16
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*)::{lambda()#1}::operator()() const:
✓ Branch 1 taken 28 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 28 times.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 1 taken 56 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 56 times.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*)::{lambda()#1}::operator()() const:
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 16 times.
100 if (!future.get()) {
182 LOG(ERROR) << "Failed to get parameters from one of the shards";
183 return false;
184 }
185 }
186
187
3/8
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*)::{lambda()#1}::operator()() const:
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*)::{lambda()#1}::operator()() const:
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
54 MergeResults(keys, partitioned_results, values);
188
189 #ifdef ENABLE_PERF_REPORT
190 auto end_time = std::chrono::high_resolution_clock::now();
191 auto duration = std::chrono::duration_cast<std::chrono::microseconds>(
192 end_time - start_time)
193 .count();
194 double start_us = std::chrono::duration_cast<std::chrono::microseconds>(
195 start_time.time_since_epoch())
196 .count();
197 FlameGraphData fg_data = {
198 "dist_client::GetParameter",
199 start_us,
200 1, // level
201 static_cast<double>(duration),
202 static_cast<double>(duration)};
203 std::string unique_id =
204 "embread_debug" + std::to_string(recstore::g_trace_id);
205 report_flame_graph("emb_read_flame_map", unique_id.c_str(), fg_data);
206 #endif
207
208 54 return true;
209 54 }
210
211 20 bool ClearPS() {
212 20 std::vector<std::future<bool>> futures;
213
4/4
recstore::DistributedShardedClient<BRPCParameterClient>::ClearPS():
✓ Branch 4 taken 20 times.
✓ Branch 5 taken 10 times.
recstore::DistributedShardedClient<GRPCParameterClient>::ClearPS():
✓ Branch 4 taken 20 times.
✓ Branch 5 taken 10 times.
60 for (auto& client : clients_) {
214
4/8
recstore::DistributedShardedClient<BRPCParameterClient>::ClearPS():
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::ClearPS():
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
40 futures.push_back(std::async(std::launch::async,
215 40 [&client]() { return client->ClearPS(); }));
216 }
217 20 bool all_success = true;
218
4/4
recstore::DistributedShardedClient<BRPCParameterClient>::ClearPS()::{lambda()#1}::operator()() const:
✓ Branch 5 taken 20 times.
✓ Branch 6 taken 10 times.
recstore::DistributedShardedClient<GRPCParameterClient>::ClearPS()::{lambda()#1}::operator()() const:
✓ Branch 5 taken 20 times.
✓ Branch 6 taken 10 times.
60 for (auto& future : futures) {
219
4/8
recstore::DistributedShardedClient<BRPCParameterClient>::ClearPS()::{lambda()#1}::operator()() const:
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 20 times.
recstore::DistributedShardedClient<GRPCParameterClient>::ClearPS()::{lambda()#1}::operator()() const:
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 20 times.
40 if (!future.get()) {
220 all_success = false;
221 }
222 }
223 20 return all_success;
224 20 }
225
226 2 bool LoadFakeData(int64_t n) {
227 2 std::vector<std::future<bool>> futures;
228
2/2
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 2 times.
6 for (auto& client : clients_) {
229 4 ClientT* raw = client.get();
230
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
4 futures.push_back(std::async(std::launch::async,
231 4 [raw, n]() { return raw->LoadFakeData(n); }));
232 }
233 2 bool all_success = true;
234
2/2
✓ Branch 5 taken 4 times.
✓ Branch 6 taken 2 times.
6 for (auto& future : futures) {
235
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
4 if (!future.get()) {
236 all_success = false;
237 }
238 }
239 2 return all_success;
240 2 }
241
242 2 bool DumpFakeData(int64_t n) {
243 2 std::vector<std::future<bool>> futures;
244
2/2
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 2 times.
6 for (auto& client : clients_) {
245 4 ClientT* raw = client.get();
246
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
4 futures.push_back(std::async(std::launch::async,
247 4 [raw, n]() { return raw->DumpFakeData(n); }));
248 }
249 2 bool all_success = true;
250
2/2
✓ Branch 5 taken 4 times.
✓ Branch 6 taken 2 times.
6 for (auto& future : futures) {
251
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
4 if (!future.get()) {
252 all_success = false;
253 }
254 }
255 2 return all_success;
256 2 }
257
258 bool LoadCkpt(const std::vector<std::string>& model_config_path,
259 const std::vector<std::string>& emb_file_path) {
260 std::vector<std::future<bool>> futures;
261 for (auto& client : clients_) {
262 futures.push_back(std::async(
263 std::launch::async, [&client, &model_config_path, &emb_file_path]() {
264 return client->LoadCkpt(model_config_path, emb_file_path);
265 }));
266 }
267 bool all_success = true;
268 for (auto& future : futures) {
269 if (!future.get()) {
270 all_success = false;
271 }
272 }
273 return all_success;
274 }
275
276 bool SaveCheckpoint(const std::string& path,
277 const std::string& metadata) override {
278 return FanOutCheckpoint(path, metadata, true);
279 }
280
281 bool LoadCheckpoint(const std::string& path,
282 const std::string& metadata) override {
283 return FanOutCheckpoint(path, metadata, false);
284 }
285
286 // ---- BasePSClient virtual overrides ------------------------------------
287
288 32 int GetParameter(const base::ConstArray<uint64_t>& keys,
289 float* values) override {
290 32 std::vector<std::vector<float>> result_vectors;
291
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, float*):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, float*):
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
32 bool success = GetParameter(keys, &result_vectors);
292
293
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, float*):
✗ Branch 0 not taken.
✗ Branch 1 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, float*):
✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
32 if (!success) {
294 return -1;
295 }
296
297
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, float*):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, float*):
✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
32 if (keys.Size() == 0) {
298 return 0;
299 }
300 32 int emb_dim = 0;
301
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, float*):
✗ Branch 5 not taken.
✗ Branch 6 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, float*):
✓ Branch 5 taken 32 times.
✗ Branch 6 not taken.
32 for (const auto& row : result_vectors) {
302
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, float*):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, float*):
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
32 if (!row.empty()) {
303 32 emb_dim = static_cast<int>(row.size());
304 32 break;
305 }
306 }
307
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, float*):
✗ Branch 0 not taken.
✗ Branch 1 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, float*):
✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
32 if (emb_dim == 0) {
308 LOG(WARNING) << "No valid embeddings found";
309 return 0;
310 }
311
312
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, float*):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, float*):
✓ Branch 1 taken 92 times.
✓ Branch 2 taken 32 times.
124 for (size_t i = 0; i < result_vectors.size(); ++i) {
313 92 const auto& row = result_vectors[i];
314
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, float*):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, float*):
✗ Branch 1 not taken.
✓ Branch 2 taken 92 times.
92 if (row.empty()) {
315 continue;
316 }
317
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, float*):
✗ Branch 3 not taken.
✗ Branch 4 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetParameter(base::ConstArray<unsigned long> const&, float*):
✓ Branch 3 taken 92 times.
✗ Branch 4 not taken.
92 std::copy(row.begin(), row.end(), values + i * emb_dim);
318 }
319 32 return 0;
320 32 }
321
322 int AsyncGetParameter(const base::ConstArray<uint64_t>& keys,
323 float* values) override {
324 return GetParameter(keys, values);
325 }
326
327 62 int PutParameter(const base::ConstArray<uint64_t>& keys,
328 const std::vector<std::vector<float>>& values) override {
329
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
recstore::DistributedShardedClient<GRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✗ Branch 2 not taken.
✓ Branch 3 taken 56 times.
62 if (keys.Size() != values.size()) {
330 LOG(ERROR) << "Keys and values size mismatch: " << keys.Size() << " vs "
331 << values.size();
332 return -1;
333 }
334
335 62 std::vector<std::vector<uint64_t>> partitioned_keys;
336
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✓ Branch 1 taken 56 times.
✗ Branch 2 not taken.
62 PartitionKeys(keys, partitioned_keys);
337
338 62 std::vector<std::vector<std::vector<float>>> partitioned_values(
339
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✓ Branch 1 taken 56 times.
✗ Branch 2 not taken.
62 num_shards_);
340
4/4
recstore::DistributedShardedClient<BRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 6 times.
recstore::DistributedShardedClient<GRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✓ Branch 0 taken 112 times.
✓ Branch 1 taken 56 times.
186 for (int shard_id = 0; shard_id < num_shards_; ++shard_id) {
341
4/4
recstore::DistributedShardedClient<BRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✓ Branch 2 taken 212 times.
✓ Branch 3 taken 12 times.
recstore::DistributedShardedClient<GRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✓ Branch 2 taken 1238 times.
✓ Branch 3 taken 112 times.
1574 for (size_t i = 0; i < key_index_mapping_[shard_id].size(); ++i) {
342 1450 size_t original_index = key_index_mapping_[shard_id][i];
343
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✓ Branch 3 taken 212 times.
✗ Branch 4 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✓ Branch 3 taken 1238 times.
✗ Branch 4 not taken.
1450 partitioned_values[shard_id].push_back(values[original_index]);
344 }
345 }
346
347 62 std::vector<std::future<int>> futures;
348
4/4
recstore::DistributedShardedClient<BRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 6 times.
recstore::DistributedShardedClient<GRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✓ Branch 0 taken 112 times.
✓ Branch 1 taken 56 times.
186 for (int shard_id = 0; shard_id < num_shards_; ++shard_id) {
349
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✗ Branch 2 not taken.
✓ Branch 3 taken 12 times.
recstore::DistributedShardedClient<GRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✗ Branch 2 not taken.
✓ Branch 3 taken 112 times.
124 if (partitioned_keys[shard_id].empty()) {
350 continue;
351 }
352
353
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✓ Branch 1 taken 112 times.
✗ Branch 2 not taken.
124 auto it = shard_to_client_index_.find(shard_id);
354
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✗ Branch 2 not taken.
✓ Branch 3 taken 12 times.
recstore::DistributedShardedClient<GRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✗ Branch 2 not taken.
✓ Branch 3 taken 112 times.
124 if (it == shard_to_client_index_.end()) {
355 LOG(ERROR) << "No client found for shard " << shard_id;
356 return -1;
357 }
358
359 124 int client_index = it->second;
360 124 auto* client = clients_[client_index].get();
361
362
4/8
recstore::DistributedShardedClient<BRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 12 times.
✗ Branch 5 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✓ Branch 1 taken 112 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 112 times.
✗ Branch 5 not taken.
124 futures.push_back(std::async(
363 542 std::launch::async, [=, &partitioned_keys, &partitioned_values]() {
364 88 const auto& shard_keys_vec = partitioned_keys[shard_id];
365 88 const auto& shard_vals_vec = partitioned_values[shard_id];
366
6/8
recstore::DistributedShardedClient<BRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&)::{lambda()#1}::operator()() const:
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 14 times.
✓ Branch 5 taken 12 times.
recstore::DistributedShardedClient<GRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&)::{lambda()#1}::operator()() const:
✓ Branch 1 taken 108 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 108 times.
✓ Branch 5 taken 76 times.
332 for (size_t start = 0; start < shard_keys_vec.size();
367 122 start += static_cast<size_t>(max_keys_per_request_)) {
368 122 size_t end =
369 244 std::min(start + static_cast<size_t>(max_keys_per_request_),
370 122 shard_keys_vec.size());
371 244 base::ConstArray<uint64_t> shard_chunk(
372 122 shard_keys_vec.data() + start, static_cast<int>(end - start));
373
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&)::{lambda()#1}::operator()() const:
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&)::{lambda()#1}::operator()() const:
✓ Branch 4 taken 108 times.
✗ Branch 5 not taken.
366 std::vector<std::vector<float>> value_chunk(
374 366 shard_vals_vec.begin() + start, shard_vals_vec.begin() + end);
375
4/8
recstore::DistributedShardedClient<BRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&)::{lambda()#1}::operator()() const:
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
recstore::DistributedShardedClient<GRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&)::{lambda()#1}::operator()() const:
✓ Branch 1 taken 108 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 108 times.
122 if (client->PutParameter(shard_chunk, value_chunk) != 1) {
376 return 0;
377 }
378 }
379 88 return 1;
380 }));
381 }
382
383
6/8
recstore::DistributedShardedClient<BRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✗ Branch 5 not taken.
✗ Branch 6 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&)::{lambda()#1}::operator()() const:
✓ Branch 5 taken 12 times.
✓ Branch 6 taken 6 times.
recstore::DistributedShardedClient<GRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✓ Branch 5 taken 36 times.
✓ Branch 6 taken 18 times.
recstore::DistributedShardedClient<GRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&)::{lambda()#1}::operator()() const:
✓ Branch 5 taken 76 times.
✓ Branch 6 taken 38 times.
186 for (auto& future : futures) {
384
6/16
recstore::DistributedShardedClient<BRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&)::{lambda()#1}::operator()() const:
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 12 times.
recstore::DistributedShardedClient<GRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&):
✓ Branch 1 taken 36 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 36 times.
recstore::DistributedShardedClient<GRPCParameterClient>::PutParameter(base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&)::{lambda()#1}::operator()() const:
✓ Branch 1 taken 76 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 76 times.
124 if (future.get() != 1) {
385 LOG(ERROR) << "Failed to put parameters to one of the shards";
386 return -1;
387 }
388 }
389
390 62 return 0;
391 62 }
392
393 void Command(PSCommand command) override {
394 std::vector<std::future<void>> futures;
395 for (auto& client : clients_) {
396 futures.push_back(std::async(std::launch::async, [&client, command]() {
397 client->Command(command);
398 }));
399 }
400 for (auto& future : futures) {
401 future.wait();
402 }
403 }
404
405 2 int UpdateParameter(const std::string& table_name,
406 const base::ConstArray<uint64_t>& keys,
407 const std::vector<std::vector<float>>* grads) override {
408
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✗ Branch 0 not taken.
✗ Branch 1 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (grads == nullptr) {
409 LOG(ERROR) << "UpdateParameter grads pointer is null";
410 return -1;
411 }
412
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
2 if (keys.Size() != grads->size()) {
413 LOG(ERROR) << "UpdateParameter keys/grads size mismatch: " << keys.Size()
414 << " vs " << grads->size();
415 return -1;
416 }
417
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
2 if (keys.Size() == 0) {
418 return 0;
419 }
420
421 2 std::vector<std::vector<uint64_t>> partitioned_keys;
422
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 PartitionKeys(keys, partitioned_keys);
423
424
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 std::vector<std::vector<std::vector<float>>> partitioned_grads(num_shards_);
425
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✗ Branch 0 not taken.
✗ Branch 1 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 2 times.
6 for (int shard_id = 0; shard_id < num_shards_; ++shard_id) {
426
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 4 times.
8 for (size_t i = 0; i < key_index_mapping_[shard_id].size(); ++i) {
427 4 size_t original_index = key_index_mapping_[shard_id][i];
428
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✗ Branch 3 not taken.
✗ Branch 4 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
4 partitioned_grads[shard_id].push_back((*grads)[original_index]);
429 }
430 }
431
432 2 std::vector<std::future<int>> futures;
433
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✗ Branch 0 not taken.
✗ Branch 1 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 2 times.
6 for (int shard_id = 0; shard_id < num_shards_; ++shard_id) {
434
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 2 times.
4 if (partitioned_keys[shard_id].empty()) {
435 2 continue;
436 }
437
438
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 auto it = shard_to_client_index_.find(shard_id);
439
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
2 if (it == shard_to_client_index_.end()) {
440 LOG(ERROR) << "No client found for shard " << shard_id;
441 return -1;
442 }
443 2 int client_index = it->second;
444 2 auto* client = clients_[client_index].get();
445
446
3/12
recstore::DistributedShardedClient<BRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
2 futures.push_back(std::async(
447 std::launch::async, [=, &partitioned_keys, &partitioned_grads]() {
448 const auto& shard_keys_vec = partitioned_keys[shard_id];
449 const auto& shard_grads_vec = partitioned_grads[shard_id];
450 for (size_t start = 0; start < shard_keys_vec.size();
451 start += static_cast<size_t>(max_keys_per_request_)) {
452 size_t end =
453 std::min(start + static_cast<size_t>(max_keys_per_request_),
454 shard_keys_vec.size());
455 base::ConstArray<uint64_t> shard_chunk(
456 shard_keys_vec.data() + start, static_cast<int>(end - start));
457 std::vector<std::vector<float>> grad_chunk(
458 shard_grads_vec.begin() + start,
459 shard_grads_vec.begin() + end);
460 if (client->UpdateParameter(
461 table_name, shard_chunk, &grad_chunk) != 0) {
462 return -1;
463 }
464 }
465 return 0;
466 }));
467 }
468
469
2/8
recstore::DistributedShardedClient<BRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✗ Branch 5 not taken.
✗ Branch 6 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*)::{lambda()#1}::operator()() const:
✗ Branch 5 not taken.
✗ Branch 6 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 2 times.
recstore::DistributedShardedClient<GRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*)::{lambda()#1}::operator()() const:
✗ Branch 5 not taken.
✗ Branch 6 not taken.
4 for (auto& future : futures) {
470
2/16
recstore::DistributedShardedClient<BRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*)::{lambda()#1}::operator()() const:
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
recstore::DistributedShardedClient<GRPCParameterClient>::UpdateParameter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const*)::{lambda()#1}::operator()() const:
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
2 if (future.get() != 0) {
471 LOG(ERROR) << "Failed to update parameters on one of the shards";
472 return -1;
473 }
474 }
475
476 2 return 0;
477 2 }
478
479 2 int UpdateParameterFlat(const std::string& table_name,
480 const base::ConstArray<uint64_t>& keys,
481 const float* grads,
482 int64_t num_rows,
483 int64_t embedding_dim) override {
484
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::UpdateParameterFlat(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, float const*, long, long):
✗ Branch 0 not taken.
✗ Branch 1 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::UpdateParameterFlat(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, float const*, long, long):
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (grads == nullptr) {
485 LOG(ERROR) << "UpdateParameterFlat grads pointer is null";
486 return -1;
487 }
488
2/8
recstore::DistributedShardedClient<BRPCParameterClient>::UpdateParameterFlat(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, float const*, long, long):
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::UpdateParameterFlat(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, float const*, long, long):
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
2 if (num_rows < 0 || embedding_dim <= 0) {
489 LOG(ERROR) << "UpdateParameterFlat invalid shape: rows=" << num_rows
490 << " dim=" << embedding_dim;
491 return -1;
492 }
493
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::UpdateParameterFlat(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, float const*, long, long):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::UpdateParameterFlat(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, float const*, long, long):
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
2 if (keys.Size() != static_cast<size_t>(num_rows)) {
494 LOG(ERROR) << "UpdateParameterFlat keys/grads size mismatch: "
495 << keys.Size() << " vs " << num_rows;
496 return -1;
497 }
498
499 2 std::vector<std::vector<float>> row_grads;
500
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::UpdateParameterFlat(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, float const*, long, long):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::UpdateParameterFlat(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, float const*, long, long):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 row_grads.reserve(static_cast<size_t>(num_rows));
501
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::UpdateParameterFlat(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, float const*, long, long):
✗ Branch 0 not taken.
✗ Branch 1 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::UpdateParameterFlat(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, float const*, long, long):
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 2 times.
6 for (int64_t i = 0; i < num_rows; ++i) {
502 4 const float* row = grads + i * embedding_dim;
503
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::UpdateParameterFlat(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, float const*, long, long):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::UpdateParameterFlat(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, float const*, long, long):
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 row_grads.emplace_back(row, row + embedding_dim);
504 }
505
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::UpdateParameterFlat(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, float const*, long, long):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::UpdateParameterFlat(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::ConstArray<unsigned long> const&, float const*, long, long):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 return UpdateParameter(table_name, keys, &row_grads);
506 2 }
507
508 10 int InitEmbeddingTable(const std::string& table_name,
509 const recstore::EmbeddingTableConfig& config) override {
510 10 std::vector<std::future<int>> futures;
511
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::InitEmbeddingTable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, recstore::EmbeddingTableConfig const&):
✗ Branch 4 not taken.
✗ Branch 5 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::InitEmbeddingTable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, recstore::EmbeddingTableConfig const&):
✓ Branch 4 taken 20 times.
✓ Branch 5 taken 10 times.
30 for (auto& client : clients_) {
512
2/8
recstore::DistributedShardedClient<BRPCParameterClient>::InitEmbeddingTable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, recstore::EmbeddingTableConfig const&):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::InitEmbeddingTable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, recstore::EmbeddingTableConfig const&):
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
20 futures.push_back(
513 std::async(std::launch::async, [&client, &table_name, &config]() {
514 return client->InitEmbeddingTable(table_name, config);
515 }));
516 }
517
518
2/8
recstore::DistributedShardedClient<BRPCParameterClient>::InitEmbeddingTable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, recstore::EmbeddingTableConfig const&):
✗ Branch 5 not taken.
✗ Branch 6 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::InitEmbeddingTable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, recstore::EmbeddingTableConfig const&)::{lambda()#1}::operator()() const:
✗ Branch 5 not taken.
✗ Branch 6 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::InitEmbeddingTable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, recstore::EmbeddingTableConfig const&):
✓ Branch 5 taken 20 times.
✓ Branch 6 taken 10 times.
recstore::DistributedShardedClient<GRPCParameterClient>::InitEmbeddingTable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, recstore::EmbeddingTableConfig const&)::{lambda()#1}::operator()() const:
✗ Branch 5 not taken.
✗ Branch 6 not taken.
30 for (auto& future : futures) {
519
2/16
recstore::DistributedShardedClient<BRPCParameterClient>::InitEmbeddingTable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, recstore::EmbeddingTableConfig const&):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::InitEmbeddingTable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, recstore::EmbeddingTableConfig const&)::{lambda()#1}::operator()() const:
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::InitEmbeddingTable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, recstore::EmbeddingTableConfig const&):
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 20 times.
recstore::DistributedShardedClient<GRPCParameterClient>::InitEmbeddingTable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, recstore::EmbeddingTableConfig const&)::{lambda()#1}::operator()() const:
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
20 if (future.get() != 0) {
520 LOG(ERROR) << "InitEmbeddingTable failed on one of the shards";
521 return -1;
522 }
523 }
524 10 return 0;
525 10 }
526
527 uint64_t
528 38 PrefetchParameter(const base::ConstArray<uint64_t>& keys) override {
529 2 auto cleanup_state = [this](const DistPrefetchState& state) {
530 for (const auto& shard_state : state.shard_states) {
531 if (shard_state.client_index < 0 ||
532 shard_state.client_index >= static_cast<int>(clients_.size())) {
533 continue;
534 }
535 auto* client = clients_[shard_state.client_index].get();
536 for (uint64_t child_prefetch_id : shard_state.child_prefetch_ids) {
537 client->WaitForPrefetch(child_prefetch_id);
538 std::vector<std::vector<float>> tmp;
539 client->GetPrefetchResult(child_prefetch_id, &tmp);
540 }
541 }
542 };
543
544
2/8
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&) const:
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&) const:
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
38 if (keys.Size() == 0) {
545 std::lock_guard<std::mutex> lk(prefetch_mu_);
546 uint64_t prefetch_id = next_prefetch_id_++;
547 auto state = std::make_shared<DistPrefetchState>();
548 state->total_keys = 0;
549 prefetch_states_[prefetch_id] = state;
550 return prefetch_id;
551 }
552
553
2/8
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&) const:
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&) const:
✓ Branch 2 taken 36 times.
✗ Branch 3 not taken.
38 std::vector<std::vector<uint64_t>> shard_keys(num_shards_);
554
2/8
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&) const:
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&) const:
✓ Branch 2 taken 36 times.
✗ Branch 3 not taken.
38 std::vector<std::vector<size_t>> shard_indices(num_shards_);
555
4/8
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&) const:
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 2 times.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&) const:
✓ Branch 1 taken 416 times.
✓ Branch 2 taken 36 times.
462 for (size_t i = 0; i < keys.Size(); ++i) {
556
2/8
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&) const:
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&) const:
✓ Branch 2 taken 416 times.
✗ Branch 3 not taken.
424 const int shard_id = GetShardId(keys[i]);
557
2/8
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✗ Branch 3 not taken.
✗ Branch 4 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&) const:
✗ Branch 3 not taken.
✗ Branch 4 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✓ Branch 3 taken 8 times.
✗ Branch 4 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&) const:
✓ Branch 3 taken 416 times.
✗ Branch 4 not taken.
424 shard_keys[shard_id].push_back(keys[i]);
558
2/8
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&) const:
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&) const:
✓ Branch 2 taken 416 times.
✗ Branch 3 not taken.
424 shard_indices[shard_id].push_back(i);
559 }
560
561
2/8
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&) const:
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&) const:
✓ Branch 1 taken 36 times.
✗ Branch 2 not taken.
38 auto state = std::make_shared<DistPrefetchState>();
562 38 state->total_keys = keys.Size();
563
564
6/16
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&) const:
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 2 times.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&) const:
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 72 times.
✓ Branch 4 taken 36 times.
190 for (int shard_id = 0; shard_id < num_shards_; ++shard_id) {
565
2/8
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&) const:
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&) const:
✗ Branch 2 not taken.
✓ Branch 3 taken 72 times.
76 if (shard_keys[shard_id].empty()) {
566 continue;
567 }
568
569
2/8
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&) const:
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&) const:
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
76 auto it = shard_to_client_index_.find(shard_id);
570
2/8
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&) const:
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&) const:
✗ Branch 2 not taken.
✓ Branch 3 taken 72 times.
76 if (it == shard_to_client_index_.end()) {
571 LOG(ERROR) << "No client found for shard " << shard_id;
572 cleanup_state(*state);
573 return 0;
574 }
575
576 76 DistPrefetchShardState shard_state;
577 76 shard_state.shard_id = shard_id;
578 76 shard_state.client_index = it->second;
579 76 shard_state.original_indices = std::move(shard_indices[shard_id]);
580
581 76 const auto& skeys = shard_keys[shard_id];
582
4/8
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&) const:
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 4 times.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&) const:
✓ Branch 1 taken 100 times.
✓ Branch 2 taken 72 times.
180 for (size_t start = 0; start < skeys.size();
583 104 start += static_cast<size_t>(max_keys_per_request_)) {
584 208 size_t end = std::min(
585 104 start + static_cast<size_t>(max_keys_per_request_), skeys.size());
586 208 base::ConstArray<uint64_t> chunk(
587 104 skeys.data() + start, static_cast<int>(end - start));
588 104 uint64_t child_prefetch_id =
589
2/8
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✗ Branch 3 not taken.
✗ Branch 4 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&) const:
✗ Branch 3 not taken.
✗ Branch 4 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&) const:
✓ Branch 3 taken 100 times.
✗ Branch 4 not taken.
104 clients_[shard_state.client_index]->PrefetchParameter(chunk);
590
2/8
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✗ Branch 0 not taken.
✗ Branch 1 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&) const:
✗ Branch 0 not taken.
✗ Branch 1 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&) const:
✗ Branch 0 not taken.
✓ Branch 1 taken 100 times.
104 if (child_prefetch_id == 0) {
591 LOG(ERROR) << "PrefetchParameter failed for shard " << shard_id;
592 cleanup_state(*state);
593 return 0;
594 }
595
2/8
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&) const:
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&) const:
✓ Branch 1 taken 100 times.
✗ Branch 2 not taken.
104 shard_state.child_prefetch_ids.push_back(child_prefetch_id);
596
2/8
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&) const:
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&) const:
✓ Branch 1 taken 100 times.
✗ Branch 2 not taken.
104 shard_state.chunk_sizes.push_back(static_cast<int>(end - start));
597 }
598
2/8
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✗ Branch 3 not taken.
✗ Branch 4 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&) const:
✗ Branch 3 not taken.
✗ Branch 4 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&) const:
✓ Branch 3 taken 72 times.
✗ Branch 4 not taken.
76 state->shard_states.push_back(std::move(shard_state));
599 }
600
601
2/8
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&) const:
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&) const:
✓ Branch 1 taken 36 times.
✗ Branch 2 not taken.
38 std::lock_guard<std::mutex> lk(prefetch_mu_);
602 38 uint64_t prefetch_id = next_prefetch_id_++;
603
2/8
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<BRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<BRPCParameterClient>::DistPrefetchState const&) const:
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&):
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PrefetchParameter(base::ConstArray<unsigned long> const&)::{lambda(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&)#1}::operator()(recstore::DistributedShardedClient<GRPCParameterClient>::DistPrefetchState const&) const:
✓ Branch 2 taken 36 times.
✗ Branch 3 not taken.
38 prefetch_states_[prefetch_id] = std::move(state);
604 38 return prefetch_id;
605 38 }
606
607 4 bool IsPrefetchDone(uint64_t prefetch_id) override {
608 4 std::shared_ptr<DistPrefetchState> state;
609 {
610
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::IsPrefetchDone(unsigned long):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::IsPrefetchDone(unsigned long):
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 std::lock_guard<std::mutex> lk(prefetch_mu_);
611
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::IsPrefetchDone(unsigned long):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::IsPrefetchDone(unsigned long):
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 auto it = prefetch_states_.find(prefetch_id);
612
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::IsPrefetchDone(unsigned long):
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::IsPrefetchDone(unsigned long):
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 2 times.
4 if (it == prefetch_states_.end()) {
613
4/16
recstore::DistributedShardedClient<BRPCParameterClient>::IsPrefetchDone(unsigned long):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::IsPrefetchDone(unsigned long):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
2 LOG(ERROR) << "Invalid prefetch_id: " << prefetch_id;
614 2 return false;
615 }
616 2 state = it->second;
617
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::IsPrefetchDone(unsigned long):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::IsPrefetchDone(unsigned long):
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 2 times.
4 }
618
619
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::IsPrefetchDone(unsigned long):
✗ Branch 6 not taken.
✗ Branch 7 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::IsPrefetchDone(unsigned long):
✓ Branch 6 taken 4 times.
✓ Branch 7 taken 2 times.
6 for (const auto& shard_state : state->shard_states) {
620 4 auto* client = clients_[shard_state.client_index].get();
621
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::IsPrefetchDone(unsigned long):
✗ Branch 5 not taken.
✗ Branch 6 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::IsPrefetchDone(unsigned long):
✓ Branch 5 taken 4 times.
✓ Branch 6 taken 4 times.
8 for (uint64_t child_prefetch_id : shard_state.child_prefetch_ids) {
622
2/8
recstore::DistributedShardedClient<BRPCParameterClient>::IsPrefetchDone(unsigned long):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::IsPrefetchDone(unsigned long):
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
4 if (!client->IsPrefetchDone(child_prefetch_id)) {
623 return false;
624 }
625 }
626 }
627 2 return true;
628 4 }
629
630 74 void WaitForPrefetch(uint64_t prefetch_id) override {
631 74 std::shared_ptr<DistPrefetchState> state;
632 {
633
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::WaitForPrefetch(unsigned long):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::WaitForPrefetch(unsigned long):
✓ Branch 1 taken 74 times.
✗ Branch 2 not taken.
74 std::lock_guard<std::mutex> lk(prefetch_mu_);
634
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::WaitForPrefetch(unsigned long):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::WaitForPrefetch(unsigned long):
✓ Branch 1 taken 74 times.
✗ Branch 2 not taken.
74 auto it = prefetch_states_.find(prefetch_id);
635
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::WaitForPrefetch(unsigned long):
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::WaitForPrefetch(unsigned long):
✗ Branch 2 not taken.
✓ Branch 3 taken 74 times.
74 if (it == prefetch_states_.end()) {
636 LOG(ERROR) << "Invalid prefetch_id: " << prefetch_id;
637 return;
638 }
639 74 state = it->second;
640
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::WaitForPrefetch(unsigned long):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::WaitForPrefetch(unsigned long):
✓ Branch 1 taken 74 times.
✗ Branch 2 not taken.
74 }
641
642
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::WaitForPrefetch(unsigned long):
✗ Branch 6 not taken.
✗ Branch 7 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::WaitForPrefetch(unsigned long):
✓ Branch 6 taken 148 times.
✓ Branch 7 taken 74 times.
222 for (const auto& shard_state : state->shard_states) {
643 148 auto* client = clients_[shard_state.client_index].get();
644
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::WaitForPrefetch(unsigned long):
✗ Branch 5 not taken.
✗ Branch 6 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::WaitForPrefetch(unsigned long):
✓ Branch 5 taken 204 times.
✓ Branch 6 taken 148 times.
352 for (uint64_t child_prefetch_id : shard_state.child_prefetch_ids) {
645
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::WaitForPrefetch(unsigned long):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::WaitForPrefetch(unsigned long):
✓ Branch 1 taken 204 times.
✗ Branch 2 not taken.
204 client->WaitForPrefetch(child_prefetch_id);
646 }
647 }
648
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::WaitForPrefetch(unsigned long):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::WaitForPrefetch(unsigned long):
✓ Branch 1 taken 74 times.
✗ Branch 2 not taken.
74 }
649
650 42 bool GetPrefetchResult(uint64_t prefetch_id,
651 std::vector<std::vector<float>>* values) override {
652
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 0 not taken.
✗ Branch 1 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 0 not taken.
✓ Branch 1 taken 42 times.
42 if (values == nullptr) {
653 LOG(ERROR) << "GetPrefetchResult output pointer is null";
654 return false;
655 }
656
657 42 std::shared_ptr<DistPrefetchState> state;
658 {
659
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 1 taken 42 times.
✗ Branch 2 not taken.
42 std::lock_guard<std::mutex> lk(prefetch_mu_);
660
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 1 taken 42 times.
✗ Branch 2 not taken.
42 auto it = prefetch_states_.find(prefetch_id);
661
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 38 times.
42 if (it == prefetch_states_.end()) {
662
4/16
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
4 LOG(ERROR) << "Invalid prefetch_id: " << prefetch_id;
663 4 return false;
664 }
665 38 state = it->second;
666
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 1 taken 38 times.
✓ Branch 2 taken 4 times.
42 }
667
668 // Ensure all child RPCs are completed before consuming payloads.
669
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 1 taken 38 times.
✗ Branch 2 not taken.
38 WaitForPrefetch(prefetch_id);
670
671 38 values->clear();
672
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 2 taken 38 times.
✗ Branch 3 not taken.
38 values->resize(state->total_keys);
673
674 38 bool ok_all = true;
675
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 6 not taken.
✗ Branch 7 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 6 taken 76 times.
✓ Branch 7 taken 38 times.
114 for (const auto& shard_state : state->shard_states) {
676 76 auto* client = clients_[shard_state.client_index].get();
677 76 size_t shard_offset = 0;
678
3/8
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 1 taken 104 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 104 times.
✓ Branch 5 taken 76 times.
284 for (size_t i = 0; i < shard_state.child_prefetch_ids.size(); ++i) {
679 104 std::vector<std::vector<float>> chunk_values;
680
2/8
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 2 taken 104 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 104 times.
104 if (!client->GetPrefetchResult(shard_state.child_prefetch_ids[i],
681 &chunk_values)) {
682 ok_all = false;
683 break;
684 }
685 104 const int expected =
686
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 1 taken 104 times.
✗ Branch 2 not taken.
104 (i < shard_state.chunk_sizes.size() ? shard_state.chunk_sizes[i]
687 : -1);
688
2/8
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 0 taken 104 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 104 times.
208 if (expected >= 0 &&
689
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 1 not taken.
✓ Branch 2 taken 104 times.
104 static_cast<int>(chunk_values.size()) != expected) {
690 LOG(ERROR) << "Prefetch chunk size mismatch: got "
691 << chunk_values.size() << ", expected " << expected;
692 ok_all = false;
693 break;
694 }
695
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 5 not taken.
✗ Branch 6 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 5 taken 424 times.
✓ Branch 6 taken 104 times.
528 for (const auto& row : chunk_values) {
696
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 1 not taken.
✓ Branch 2 taken 424 times.
424 if (shard_offset >= shard_state.original_indices.size()) {
697 LOG(ERROR) << "Prefetch result overflow in shard "
698 << shard_state.shard_id;
699 ok_all = false;
700 break;
701 }
702
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 3 not taken.
✗ Branch 4 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 3 taken 424 times.
✗ Branch 4 not taken.
424 (*values)[shard_state.original_indices[shard_offset++]] = row;
703 }
704
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 0 not taken.
✗ Branch 1 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 0 not taken.
✓ Branch 1 taken 104 times.
104 if (!ok_all) {
705 break;
706 }
707 }
708
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 0 not taken.
✗ Branch 1 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 0 not taken.
✓ Branch 1 taken 76 times.
76 if (!ok_all) {
709 break;
710 }
711 }
712
713 {
714
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 1 taken 38 times.
✗ Branch 2 not taken.
38 std::lock_guard<std::mutex> lk(prefetch_mu_);
715
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResult(unsigned long, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*):
✓ Branch 1 taken 38 times.
✗ Branch 2 not taken.
38 prefetch_states_.erase(prefetch_id);
716 38 }
717 38 return ok_all;
718 42 }
719
720 6 bool GetPrefetchResultFlat(uint64_t prefetch_id,
721 std::vector<float>* values,
722 int64_t* num_rows,
723 int64_t embedding_dim) override {
724
2/8
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResultFlat(unsigned long, std::vector<float, std::allocator<float> >*, long*, long):
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResultFlat(unsigned long, std::vector<float, std::allocator<float> >*, long*, long):
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
6 if (values == nullptr || num_rows == nullptr) {
725 LOG(ERROR) << "GetPrefetchResultFlat output pointer is null";
726 return false;
727 }
728
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResultFlat(unsigned long, std::vector<float, std::allocator<float> >*, long*, long):
✗ Branch 0 not taken.
✗ Branch 1 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResultFlat(unsigned long, std::vector<float, std::allocator<float> >*, long*, long):
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 if (embedding_dim <= 0) {
729 LOG(ERROR) << "GetPrefetchResultFlat invalid embedding_dim: "
730 << embedding_dim;
731 return false;
732 }
733
734 6 std::vector<std::vector<float>> merged_values;
735
3/8
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResultFlat(unsigned long, std::vector<float, std::allocator<float> >*, long*, long):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResultFlat(unsigned long, std::vector<float, std::allocator<float> >*, long*, long):
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 4 times.
6 if (!GetPrefetchResult(prefetch_id, &merged_values)) {
736 2 return false;
737 }
738
739 4 *num_rows = static_cast<int64_t>(merged_values.size());
740 4 values->assign(
741 4 static_cast<size_t>(*num_rows) * static_cast<size_t>(embedding_dim),
742
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResultFlat(unsigned long, std::vector<float, std::allocator<float> >*, long*, long):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResultFlat(unsigned long, std::vector<float, std::allocator<float> >*, long*, long):
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 0.0f);
743
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResultFlat(unsigned long, std::vector<float, std::allocator<float> >*, long*, long):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResultFlat(unsigned long, std::vector<float, std::allocator<float> >*, long*, long):
✓ Branch 1 taken 24 times.
✓ Branch 2 taken 4 times.
28 for (size_t i = 0; i < merged_values.size(); ++i) {
744 24 const auto& row = merged_values[i];
745
1/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetPrefetchResultFlat(unsigned long, std::vector<float, std::allocator<float> >*, long*, long):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetPrefetchResultFlat(unsigned long, std::vector<float, std::allocator<float> >*, long*, long):
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
24 if (row.empty()) {
746 continue;
747 }
748 24 const int64_t copy_d =
749 24 std::min<int64_t>(embedding_dim, static_cast<int64_t>(row.size()));
750 24 std::memcpy(values->data() + i * static_cast<size_t>(embedding_dim),
751 24 row.data(),
752 24 static_cast<size_t>(copy_d) * sizeof(float));
753 }
754 4 return true;
755 6 }
756
757 private:
758 struct ServerConfig {
759 std::string host;
760 int port;
761 int shard;
762 };
763
764 struct DistPrefetchShardState {
765 int shard_id = -1;
766 int client_index = -1;
767 std::vector<size_t> original_indices;
768 std::vector<uint64_t> child_prefetch_ids;
769 std::vector<int> chunk_sizes;
770 };
771
772 struct DistPrefetchState {
773 size_t total_keys = 0;
774 std::vector<DistPrefetchShardState> shard_states;
775 };
776
777 static std::string
778 ShardCheckpointPath(const std::string& path, int shard_id) {
779 const std::string prefix =
780 path.empty() || path.back() == '/' ? path : path + "/";
781 return prefix + "recstore-shard-" + std::to_string(shard_id) + ".bin";
782 }
783
784 bool FanOutCheckpoint(
785 const std::string& path, const std::string& metadata, bool save) {
786 if (path.empty() || metadata.empty()) {
787 LOG(ERROR) << "Checkpoint path and metadata must be non-empty";
788 return false;
789 }
790 std::vector<std::future<bool>> futures;
791 for (const auto& server : server_configs_) {
792 const auto it = shard_to_client_index_.find(server.shard);
793 if (it == shard_to_client_index_.end()) {
794 LOG(ERROR) << "No client found for shard " << server.shard;
795 return false;
796 }
797 ClientT* client = clients_[it->second].get();
798 const std::string file = ShardCheckpointPath(path, server.shard);
799 futures.push_back(
800 std::async(std::launch::async, [client, file, metadata, save]() {
801 return save ? client->SaveCheckpoint(file, metadata)
802 : client->LoadCheckpoint(file, metadata);
803 }));
804 }
805 bool all_success = true;
806 for (auto& future : futures) {
807 all_success = future.get() && all_success;
808 }
809 return all_success;
810 }
811
812 26 void InitializeClients() {
813 26 clients_.clear();
814 26 clients_.reserve(server_configs_.size());
815
816
4/4
recstore::DistributedShardedClient<BRPCParameterClient>::InitializeClients():
✓ Branch 5 taken 20 times.
✓ Branch 6 taken 10 times.
recstore::DistributedShardedClient<GRPCParameterClient>::InitializeClients():
✓ Branch 5 taken 32 times.
✓ Branch 6 taken 16 times.
78 for (const auto& server_config : server_configs_) {
817
16/32
recstore::DistributedShardedClient<BRPCParameterClient>::InitializeClients():
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 20 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 20 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 20 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 20 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 20 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 20 times.
✗ Branch 23 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::InitializeClients():
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 32 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 32 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 32 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 32 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 32 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 32 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 32 times.
✗ Branch 23 not taken.
780 json client_config = {{"host", server_config.host},
818 52 {"port", server_config.port},
819 52 {"shard", server_config.shard}};
820
821
4/8
recstore::DistributedShardedClient<BRPCParameterClient>::InitializeClients():
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::InitializeClients():
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 32 times.
✗ Branch 5 not taken.
52 clients_.push_back(std::make_unique<ClientT>(client_config));
822
823
10/20
recstore::DistributedShardedClient<BRPCParameterClient>::InitializeClients():
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 20 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 20 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 20 times.
✗ Branch 14 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::InitializeClients():
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 32 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 32 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 32 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 32 times.
✗ Branch 14 not taken.
104 LOG(INFO) << "Created " << transport_name_ << " client for shard "
824
8/16
recstore::DistributedShardedClient<BRPCParameterClient>::InitializeClients():
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 20 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 20 times.
✗ Branch 11 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::InitializeClients():
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 32 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 32 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 32 times.
✗ Branch 11 not taken.
52 << server_config.shard << " at " << server_config.host << ":"
825
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::InitializeClients():
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::InitializeClients():
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
52 << server_config.port;
826 }
827 26 }
828
829 2464 int GetShardId(uint64_t key) const {
830
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::GetShardId(unsigned long) const:
✓ Branch 1 taken 448 times.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::GetShardId(unsigned long) const:
✓ Branch 1 taken 2016 times.
✗ Branch 2 not taken.
2464 if (hash_method_ == "city_hash") {
831 2464 return GetHash(key) % num_shards_;
832 } else if (hash_method_ == "simple_mod") {
833 return key % num_shards_;
834 } else {
835 LOG(ERROR) << "Unknown hash method: " << hash_method_
836 << ", using city_hash";
837 return GetHash(key) % num_shards_;
838 }
839 }
840
841 118 void PartitionKeys(
842 const base::ConstArray<uint64_t>& keys,
843 std::vector<std::vector<uint64_t>>& partitioned_keys) const {
844
4/4
recstore::DistributedShardedClient<BRPCParameterClient>::PartitionKeys(base::ConstArray<unsigned long> const&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > >&) const:
✓ Branch 5 taken 40 times.
✓ Branch 6 taken 20 times.
recstore::DistributedShardedClient<GRPCParameterClient>::PartitionKeys(base::ConstArray<unsigned long> const&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > >&) const:
✓ Branch 5 taken 196 times.
✓ Branch 6 taken 98 times.
354 for (auto& partition : partitioned_key_buffer_) {
845 236 partition.clear();
846 }
847
4/4
recstore::DistributedShardedClient<BRPCParameterClient>::PartitionKeys(base::ConstArray<unsigned long> const&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > >&) const:
✓ Branch 5 taken 40 times.
✓ Branch 6 taken 20 times.
recstore::DistributedShardedClient<GRPCParameterClient>::PartitionKeys(base::ConstArray<unsigned long> const&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > >&) const:
✓ Branch 5 taken 196 times.
✓ Branch 6 taken 98 times.
354 for (auto& mapping : key_index_mapping_) {
848 236 mapping.clear();
849 }
850
851
4/4
recstore::DistributedShardedClient<BRPCParameterClient>::PartitionKeys(base::ConstArray<unsigned long> const&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > >&) const:
✓ Branch 1 taken 448 times.
✓ Branch 2 taken 20 times.
recstore::DistributedShardedClient<GRPCParameterClient>::PartitionKeys(base::ConstArray<unsigned long> const&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > >&) const:
✓ Branch 1 taken 1592 times.
✓ Branch 2 taken 98 times.
2158 for (size_t i = 0; i < keys.Size(); ++i) {
852 2040 uint64_t key = keys[i];
853
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::PartitionKeys(base::ConstArray<unsigned long> const&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > >&) const:
✓ Branch 1 taken 448 times.
✗ Branch 2 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PartitionKeys(base::ConstArray<unsigned long> const&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > >&) const:
✓ Branch 1 taken 1592 times.
✗ Branch 2 not taken.
2040 int shard_id = GetShardId(key);
854
855
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::PartitionKeys(base::ConstArray<unsigned long> const&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > >&) const:
✓ Branch 2 taken 448 times.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PartitionKeys(base::ConstArray<unsigned long> const&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > >&) const:
✓ Branch 2 taken 1592 times.
✗ Branch 3 not taken.
2040 partitioned_key_buffer_[shard_id].push_back(key);
856
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::PartitionKeys(base::ConstArray<unsigned long> const&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > >&) const:
✓ Branch 2 taken 448 times.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::PartitionKeys(base::ConstArray<unsigned long> const&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > >&) const:
✓ Branch 2 taken 1592 times.
✗ Branch 3 not taken.
2040 key_index_mapping_[shard_id].push_back(i);
857 }
858
859 118 partitioned_keys = partitioned_key_buffer_;
860 118 }
861
862 54 void MergeResults(
863 const base::ConstArray<uint64_t>& keys,
864 const std::vector<std::vector<std::vector<float>>>& partitioned_results,
865 std::vector<std::vector<float>>* values) const {
866 54 values->clear();
867 54 values->resize(keys.Size());
868
869
4/4
recstore::DistributedShardedClient<BRPCParameterClient>::MergeResults(base::ConstArray<unsigned long> const&, std::vector<std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >, std::allocator<std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > > > const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*) const:
✓ Branch 0 taken 28 times.
✓ Branch 1 taken 14 times.
recstore::DistributedShardedClient<GRPCParameterClient>::MergeResults(base::ConstArray<unsigned long> const&, std::vector<std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >, std::allocator<std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > > > const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*) const:
✓ Branch 0 taken 80 times.
✓ Branch 1 taken 40 times.
162 for (int shard_id = 0; shard_id < num_shards_; ++shard_id) {
870
4/4
recstore::DistributedShardedClient<BRPCParameterClient>::MergeResults(base::ConstArray<unsigned long> const&, std::vector<std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >, std::allocator<std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > > > const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*) const:
✓ Branch 2 taken 236 times.
✓ Branch 3 taken 28 times.
recstore::DistributedShardedClient<GRPCParameterClient>::MergeResults(base::ConstArray<unsigned long> const&, std::vector<std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >, std::allocator<std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > > > const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*) const:
✓ Branch 2 taken 350 times.
✓ Branch 3 taken 80 times.
694 for (size_t i = 0; i < key_index_mapping_[shard_id].size(); ++i) {
871 586 size_t original_index = key_index_mapping_[shard_id][i];
872
2/4
recstore::DistributedShardedClient<BRPCParameterClient>::MergeResults(base::ConstArray<unsigned long> const&, std::vector<std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >, std::allocator<std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > > > const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*) const:
✓ Branch 2 taken 236 times.
✗ Branch 3 not taken.
recstore::DistributedShardedClient<GRPCParameterClient>::MergeResults(base::ConstArray<unsigned long> const&, std::vector<std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >, std::allocator<std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > > > const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >*) const:
✓ Branch 2 taken 350 times.
✗ Branch 3 not taken.
586 if (i < partitioned_results[shard_id].size()) {
873 586 (*values)[original_index] = partitioned_results[shard_id][i];
874 }
875 }
876 }
877 54 }
878
879 const char* transport_name_;
880
881 // Config
882 int num_shards_;
883 int max_keys_per_request_;
884 std::string hash_method_;
885
886 std::vector<ServerConfig> server_configs_;
887
888 // Single-shard clients (one per server entry).
889 std::vector<std::unique_ptr<ClientT>> clients_;
890
891 // Logical shard id -> index in clients_.
892 std::unordered_map<int, int> shard_to_client_index_;
893
894 // Partition buffers (reused).
895 mutable std::vector<std::vector<uint64_t>> partitioned_key_buffer_;
896 mutable std::vector<std::vector<size_t>> key_index_mapping_;
897
898 std::mutex prefetch_mu_;
899 std::unordered_map<uint64_t, std::shared_ptr<DistPrefetchState>>
900 prefetch_states_;
901 uint64_t next_prefetch_id_ = 1;
902 };
903
904 } // namespace recstore
905