| 181 | } |
| 182 | |
| 183 | TEST(EmbeddingVariablePerformanceTest, TestLookupOrCreate) { |
| 184 | int num_of_batch = 100; |
| 185 | int batch_size = 1024 * 128; |
| 186 | int num_of_ids = 5000000; |
| 187 | std::vector<std::vector<int64>> input_batches(num_of_batch); |
| 188 | for (int i = 0; i < num_of_batch; i++) { |
| 189 | input_batches[i].resize(batch_size); |
| 190 | } |
| 191 | LOG(INFO)<<"[TestLookupOrCreate] Start generating skew input"; |
| 192 | GenerateSkewInput(num_of_ids, 0.8, input_batches); |
| 193 | LOG(INFO)<<"[TestLookupOrCreate] Finish generating skew input"; |
| 194 | std::vector<int> num_thread_vec({1, 2, 4, 8, 16}); |
| 195 | for (auto num_thread: num_thread_vec) { |
| 196 | LOG(INFO)<<"[TestLookupOrCreate] Test LookupOrCreate With " |
| 197 | <<num_thread<<" threads."; |
| 198 | double exec_time = PerfLookupOrCreate(input_batches, num_thread); |
| 199 | if (exec_time == -1.0) { |
| 200 | LOG(INFO)<<"[TestLookupOrCreate] Test Failed"; |
| 201 | } else { |
| 202 | LOG(INFO)<<"[TestLookupOrCreate] Performance of LookupOrCreate With " |
| 203 | <<num_thread<<" threads: "<<exec_time/1000000<<" ms"; |
| 204 | } |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | void thread_lookup( |
| 209 | EmbeddingVar<int64, float>* ev, |
nothing calls this directly
no test coverage detected