diff --git a/cpp/velox/benchmarks/GenericBenchmark.cc b/cpp/velox/benchmarks/GenericBenchmark.cc index 381403f8fa28d..3402675a41b6e 100644 --- a/cpp/velox/benchmarks/GenericBenchmark.cc +++ b/cpp/velox/benchmarks/GenericBenchmark.cc @@ -169,11 +169,12 @@ void populateWriterMetrics( void setCpu(::benchmark::State& state) { // Pin each threads to different CPU# starting from 0 or --cpu. + auto cpu = state.thread_index(); if (FLAGS_cpu != -1) { - gluten::setCpu(FLAGS_cpu + state.thread_index()); - } else { - gluten::setCpu(state.thread_index()); + cpu += FLAGS_cpu; } + LOG(INFO) << "Setting CPU for thread " << state.thread_index() << " to " << cpu; + gluten::setCpu(cpu); } void runShuffle( @@ -361,8 +362,8 @@ int main(int argc, char** argv) { gflags::ParseCommandLineFlags(&argc, &argv, true); // Init Velox backend. - std::unordered_map backendConf; - std::unordered_map sessionConf; + auto backendConf = gluten::defaultConf(); + auto sessionConf = gluten::defaultConf(); backendConf.insert({gluten::kSparkBatchSize, std::to_string(FLAGS_batch_size)}); if (!FLAGS_conf.empty()) { abortIfFileNotExists(FLAGS_conf); diff --git a/cpp/velox/benchmarks/common/BenchmarkUtils.cc b/cpp/velox/benchmarks/common/BenchmarkUtils.cc index 362de92935a6c..54e24879e3222 100644 --- a/cpp/velox/benchmarks/common/BenchmarkUtils.cc +++ b/cpp/velox/benchmarks/common/BenchmarkUtils.cc @@ -33,10 +33,15 @@ DEFINE_int32(iterations, 1, "The number of iterations to run this benchmark"); namespace gluten { namespace { +std::unordered_map bmConfMap = defaultConf(); +} -std::unordered_map bmConfMap = {{gluten::kSparkBatchSize, std::to_string(FLAGS_batch_size)}}; - -} // namespace +std::unordered_map defaultConf() { + return { + {gluten::kSparkBatchSize, std::to_string(FLAGS_batch_size)}, + {gluten::kDebugModeEnabled, "true"}, + }; +} void initVeloxBackend(std::unordered_map& conf) { gluten::VeloxBackend::create(conf); diff --git a/cpp/velox/benchmarks/common/BenchmarkUtils.h b/cpp/velox/benchmarks/common/BenchmarkUtils.h index 22475720d0c23..181e56807bcd5 100644 --- a/cpp/velox/benchmarks/common/BenchmarkUtils.h +++ b/cpp/velox/benchmarks/common/BenchmarkUtils.h @@ -43,6 +43,9 @@ DECLARE_int32(threads); DECLARE_int32(iterations); namespace gluten { + +std::unordered_map defaultConf(); + /// Initialize the Velox backend with default value. void initVeloxBackend(); diff --git a/cpp/velox/benchmarks/common/FileReaderIterator.h b/cpp/velox/benchmarks/common/FileReaderIterator.h index 3fa94b6afba52..16db58ce45693 100644 --- a/cpp/velox/benchmarks/common/FileReaderIterator.h +++ b/cpp/velox/benchmarks/common/FileReaderIterator.h @@ -38,8 +38,6 @@ class FileReaderIterator : public ColumnarBatchIterator { virtual ~FileReaderIterator() = default; - virtual void createReader() = 0; - virtual std::shared_ptr getSchema() = 0; int64_t getCollectBatchTime() const { diff --git a/cpp/velox/benchmarks/common/ParquetReaderIterator.h b/cpp/velox/benchmarks/common/ParquetReaderIterator.h index e654dc1897b28..6d162e4b68d5e 100644 --- a/cpp/velox/benchmarks/common/ParquetReaderIterator.h +++ b/cpp/velox/benchmarks/common/ParquetReaderIterator.h @@ -27,7 +27,7 @@ class ParquetReaderIterator : public FileReaderIterator { public: explicit ParquetReaderIterator(const std::string& path) : FileReaderIterator(path) {} - void createReader() override { + void createReader() { parquet::ArrowReaderProperties properties = parquet::default_arrow_reader_properties(); properties.set_batch_size(FLAGS_batch_size); GLUTEN_THROW_NOT_OK(parquet::arrow::FileReader::Make(