Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions velox/core/QueryConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,9 @@ class QueryConfig {
static constexpr const char* kMarkSortedZeroCopyThreshold =
"mark_sorted_zero_copy_threshold";

/// Number of cuDF TopN batches to accumulate before merging.
static constexpr const char* kCudfTopNBatchSize = "cudf_topn_batch_size";

enum class RowSizeTrackingMode {
DISABLED = 0,
EXCLUDE_DELTA_SPLITS = 1,
Expand Down
134 changes: 0 additions & 134 deletions velox/experimental/cudf/CudfConfig.h

This file was deleted.

15 changes: 8 additions & 7 deletions velox/experimental/cudf/benchmarks/CudfTpchBenchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#include "velox/experimental/cudf/CudfConfig.h"
#include "velox/experimental/cudf/benchmarks/CudfTpchBenchmark.h"
#include "velox/experimental/cudf/common/CudfSystemConfig.h"
#include "velox/experimental/cudf/connectors/hive/CudfHiveConfig.h"
#include "velox/experimental/cudf/connectors/hive/CudfHiveTableHandle.h"
#include "velox/experimental/cudf/exec/CudfConversion.h"
Expand Down Expand Up @@ -97,12 +97,13 @@ void CudfTpchBenchmark::initialize() {
connector::registerConnector(cudfHiveConnector);
}

cudf_velox::CudfConfig::getInstance().memoryResource =
FLAGS_cudf_memory_resource;
cudf_velox::CudfConfig::getInstance().memoryPercent =
FLAGS_cudf_memory_percent;

cudf_velox::CudfConfig::getInstance().debugEnabled = FLAGS_cudf_debug_enabled;
cudf_velox::CudfSystemConfig::getInstance().updateConfigs(
{{cudf_velox::CudfSystemConfig::kCudfMemoryResource,
FLAGS_cudf_memory_resource},
{cudf_velox::CudfSystemConfig::kCudfMemoryPercent,
folly::to<std::string>(FLAGS_cudf_memory_percent)},
{cudf_velox::CudfSystemConfig::kCudfDebugEnabled,
FLAGS_cudf_debug_enabled ? "true" : "false"}});
// Enable cuDF operators
cudf_velox::registerCudf();

Expand Down
17 changes: 17 additions & 0 deletions velox/experimental/cudf/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

add_library(velox_cudf_config CudfSystemConfig.cpp)

target_link_libraries(velox_cudf_config PRIVATE velox_common_base)
58 changes: 58 additions & 0 deletions velox/experimental/cudf/common/CudfSystemConfig.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "velox/experimental/cudf/common/CudfSystemConfig.h"

#include <algorithm>

namespace facebook::velox::cudf_velox {

CudfSystemConfig::CudfSystemConfig()
: velox::config::ConfigBase(
std::unordered_map<std::string, std::string>{},
true) {}

CudfSystemConfig::CudfSystemConfig(
std::unordered_map<std::string, std::string>&& values)
: velox::config::ConfigBase(std::move(values), true) {
validateConfigs();
}

CudfSystemConfig& CudfSystemConfig::getInstance() {
static CudfSystemConfig instance;
return instance;
}

void CudfSystemConfig::validateConfigs() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this function and add the body to updateConfigs.

if (auto cudfMemoryPercent = get<int32_t>(kCudfMemoryPercent)) {
VELOX_USER_CHECK_GT(
cudfMemoryPercent,
0,
"cudf.memory_percent must be greater than 0 to initialize cuDF memory resource");
}
}

void CudfSystemConfig::updateConfigs(
std::unordered_map<std::string, std::string>&& config) {
for (auto& [key, value] : config) {
// TODO(ps): Revert support for legacy config names.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an example of legacy config.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throw a warning for legacy config?

auto canonicalKey = key;
std::replace(canonicalKey.begin(), canonicalKey.end(), '_', '-');
set(canonicalKey, value);
}
}

} // namespace facebook::velox::cudf_velox
Loading
Loading