Skip to content

Commit

Permalink
avoid default ctor usage with map.at call
Browse files Browse the repository at this point in the history
  • Loading branch information
karthikeyann committed Oct 10, 2024
1 parent f3ac9c2 commit 05773a9
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion cpp/benchmarks/ndsh/q01.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void run_ndsh_q1(nvbench::state& state,

// Read out the `lineitem` table from parquet file
auto lineitem =
read_parquet(sources["lineitem"].make_source_info(), lineitem_cols, std::move(lineitem_pred));
read_parquet(sources.at("lineitem").make_source_info(), lineitem_cols, std::move(lineitem_pred));

// Calculate the discount price and charge columns and append to lineitem table
auto disc_price =
Expand Down
12 changes: 6 additions & 6 deletions cpp/benchmarks/ndsh/q05.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,17 @@ void run_ndsh_q5(nvbench::state& state,
// Read out the tables from parquet files
// while pushing down the column projections and filter predicates
auto const customer =
read_parquet(sources["customer"].make_source_info(), {"c_custkey", "c_nationkey"});
read_parquet(sources.at("customer").make_source_info(), {"c_custkey", "c_nationkey"});
auto const orders =
read_parquet(sources["orders"].make_source_info(), orders_cols, std::move(orders_pred));
auto const lineitem = read_parquet(sources["lineitem"].make_source_info(),
read_parquet(sources.at("orders").make_source_info(), orders_cols, std::move(orders_pred));
auto const lineitem = read_parquet(sources.at("lineitem").make_source_info(),
{"l_orderkey", "l_suppkey", "l_extendedprice", "l_discount"});
auto const supplier =
read_parquet(sources["supplier"].make_source_info(), {"s_suppkey", "s_nationkey"});
read_parquet(sources.at("supplier").make_source_info(), {"s_suppkey", "s_nationkey"});
auto const nation =
read_parquet(sources["nation"].make_source_info(), {"n_nationkey", "n_regionkey", "n_name"});
read_parquet(sources.at("nation").make_source_info(), {"n_nationkey", "n_regionkey", "n_name"});
auto const region =
read_parquet(sources["region"].make_source_info(), region_cols, std::move(region_pred));
read_parquet(sources.at("region").make_source_info(), region_cols, std::move(region_pred));

// Perform the joins
auto const join_a = apply_inner_join(region, nation, {"r_regionkey"}, {"n_regionkey"});
Expand Down
2 changes: 1 addition & 1 deletion cpp/benchmarks/ndsh/q06.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void run_ndsh_q6(nvbench::state& state,
auto const lineitem_pred = std::make_unique<cudf::ast::operation>(
cudf::ast::ast_operator::LOGICAL_AND, shipdate_pred_a, shipdate_pred_b);
auto lineitem =
read_parquet(sources["lineitem"].make_source_info(), lineitem_cols, std::move(lineitem_pred));
read_parquet(sources.at("lineitem").make_source_info(), lineitem_cols, std::move(lineitem_pred));

// Cast the discount and quantity columns to float32 and append to lineitem table
auto discout_float =
Expand Down
12 changes: 6 additions & 6 deletions cpp/benchmarks/ndsh/q09.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,16 @@ void run_ndsh_q9(nvbench::state& state,
{
// Read out the table from parquet files
auto const lineitem = read_parquet(
sources["lineitem"].make_source_info(),
sources.at("lineitem").make_source_info(),
{"l_suppkey", "l_partkey", "l_orderkey", "l_extendedprice", "l_discount", "l_quantity"});
auto const nation = read_parquet(sources["nation"].make_source_info(), {"n_nationkey", "n_name"});
auto const nation = read_parquet(sources.at("nation").make_source_info(), {"n_nationkey", "n_name"});
auto const orders =
read_parquet(sources["orders"].make_source_info(), {"o_orderkey", "o_orderdate"});
auto const part = read_parquet(sources["part"].make_source_info(), {"p_partkey", "p_name"});
auto const partsupp = read_parquet(sources["partsupp"].make_source_info(),
read_parquet(sources.at("orders").make_source_info(), {"o_orderkey", "o_orderdate"});
auto const part = read_parquet(sources.at("part").make_source_info(), {"p_partkey", "p_name"});
auto const partsupp = read_parquet(sources.at("partsupp").make_source_info(),
{"ps_suppkey", "ps_partkey", "ps_supplycost"});
auto const supplier =
read_parquet(sources["supplier"].make_source_info(), {"s_suppkey", "s_nationkey"});
read_parquet(sources.at("supplier").make_source_info(), {"s_suppkey", "s_nationkey"});

// Generating the `profit` table
// Filter the part table using `p_name like '%green%'`
Expand Down
8 changes: 4 additions & 4 deletions cpp/benchmarks/ndsh/q10.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ void run_ndsh_q10(nvbench::state& state,
// Read out the tables from parquet files
// while pushing down the column projections and filter predicates
auto const customer = read_parquet(
sources["customer"].make_source_info(),
sources.at("customer").make_source_info(),
{"c_custkey", "c_name", "c_nationkey", "c_acctbal", "c_address", "c_phone", "c_comment"});
auto const orders =
read_parquet(sources["orders"].make_source_info(), orders_cols, std::move(orders_pred));
read_parquet(sources.at("orders").make_source_info(), orders_cols, std::move(orders_pred));
auto const lineitem =
read_parquet(sources["lineitem"].make_source_info(),
read_parquet(sources.at("lineitem").make_source_info(),
{"l_extendedprice", "l_discount", "l_orderkey", "l_returnflag"},
std::move(lineitem_pred));
auto const nation = read_parquet(sources["nation"].make_source_info(), {"n_name", "n_nationkey"});
auto const nation = read_parquet(sources.at("nation").make_source_info(), {"n_name", "n_nationkey"});

// Perform the joins
auto const join_a = apply_inner_join(customer, nation, {"c_nationkey"}, {"n_nationkey"});
Expand Down
18 changes: 9 additions & 9 deletions cpp/benchmarks/ndsh/utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ void generate_parquet_data_sources(double scale_factor,

CUDF_FUNC_RANGE();
std::for_each(table_names.begin(), table_names.end(), [&](auto const& table_name) {
sources[table_name] = cuio_source_sink_pair(io_type::HOST_BUFFER);
sources.emplace(table_name, cuio_source_sink_pair(io_type::HOST_BUFFER));
});

auto [orders, lineitem, part] = cudf::datagen::generate_orders_lineitem_part(
Expand All @@ -406,14 +406,14 @@ void generate_parquet_data_sources(double scale_factor,
auto region = cudf::datagen::generate_region(cudf::get_default_stream(),
cudf::get_current_device_resource_ref());

write_to_parquet_device_buffer(std::move(orders), ORDERS_SCHEMA, sources["orders"]);
write_to_parquet_device_buffer(std::move(lineitem), LINEITEM_SCHEMA, sources["lineitem"]);
write_to_parquet_device_buffer(std::move(part), PART_SCHEMA, sources["part"]);
write_to_parquet_device_buffer(std::move(partsupp), PARTSUPP_SCHEMA, sources["partsupp"]);
write_to_parquet_device_buffer(std::move(customer), CUSTOMER_SCHEMA, sources["customer"]);
write_to_parquet_device_buffer(std::move(supplier), SUPPLIER_SCHEMA, sources["supplier"]);
write_to_parquet_device_buffer(std::move(nation), NATION_SCHEMA, sources["nation"]);
write_to_parquet_device_buffer(std::move(region), REGION_SCHEMA, sources["region"]);
write_to_parquet_device_buffer(std::move(orders), ORDERS_SCHEMA, sources.at("orders"));
write_to_parquet_device_buffer(std::move(lineitem), LINEITEM_SCHEMA, sources.at("lineitem"));
write_to_parquet_device_buffer(std::move(part), PART_SCHEMA, sources.at("part"));
write_to_parquet_device_buffer(std::move(partsupp), PARTSUPP_SCHEMA, sources.at("partsupp"));
write_to_parquet_device_buffer(std::move(customer), CUSTOMER_SCHEMA, sources.at("customer"));
write_to_parquet_device_buffer(std::move(supplier), SUPPLIER_SCHEMA, sources.at("supplier"));
write_to_parquet_device_buffer(std::move(nation), NATION_SCHEMA, sources.at("nation"));
write_to_parquet_device_buffer(std::move(region), REGION_SCHEMA, sources.at("region"));
// Restore the original memory resource
cudf::set_current_device_resource(old_mr);
}

0 comments on commit 05773a9

Please sign in to comment.