Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
marin-ma committed Jun 5, 2024
1 parent ecebb29 commit 2605d84
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
11 changes: 6 additions & 5 deletions cpp/velox/benchmarks/GenericBenchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -361,8 +362,8 @@ int main(int argc, char** argv) {
gflags::ParseCommandLineFlags(&argc, &argv, true);

// Init Velox backend.
std::unordered_map<std::string, std::string> backendConf;
std::unordered_map<std::string, std::string> 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);
Expand Down
11 changes: 8 additions & 3 deletions cpp/velox/benchmarks/common/BenchmarkUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,15 @@ DEFINE_int32(iterations, 1, "The number of iterations to run this benchmark");

namespace gluten {
namespace {
std::unordered_map<std::string, std::string> bmConfMap = defaultConf();
}

std::unordered_map<std::string, std::string> bmConfMap = {{gluten::kSparkBatchSize, std::to_string(FLAGS_batch_size)}};

} // namespace
std::unordered_map<std::string, std::string> defaultConf() {
return {
{gluten::kSparkBatchSize, std::to_string(FLAGS_batch_size)},
{gluten::kDebugModeEnabled, "true"},
};
}

void initVeloxBackend(std::unordered_map<std::string, std::string>& conf) {
gluten::VeloxBackend::create(conf);
Expand Down
3 changes: 3 additions & 0 deletions cpp/velox/benchmarks/common/BenchmarkUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ DECLARE_int32(threads);
DECLARE_int32(iterations);

namespace gluten {

std::unordered_map<std::string, std::string> defaultConf();

/// Initialize the Velox backend with default value.
void initVeloxBackend();

Expand Down
2 changes: 0 additions & 2 deletions cpp/velox/benchmarks/common/FileReaderIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ class FileReaderIterator : public ColumnarBatchIterator {

virtual ~FileReaderIterator() = default;

virtual void createReader() = 0;

virtual std::shared_ptr<arrow::Schema> getSchema() = 0;

int64_t getCollectBatchTime() const {
Expand Down
2 changes: 1 addition & 1 deletion cpp/velox/benchmarks/common/ParquetReaderIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 2605d84

Please sign in to comment.