-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an explain only mode to the plugin (#4322)
* Add an explain only mode configuration to run plugin on CPU to get what would have run on GPU Signed-off-by: Thomas Graves <[email protected]> * Updates * Don't allocate gpu or enable shuffle for explain only mode * explain only mode check for rapids shuffle internal manager * update doc * Change how we check explain with sql enabled * update not work message: * fix spacing * Update doc adding explain option * update docs * Add explian only mode test to make sure runs on cpu * add note about adaptive * get rest of broadcast shims * Update logging of enabled and explain only mode * update config docs * Update to use the spark.rapids.sql.mode config Signed-off-by: Thomas Graves <[email protected]> * update config doc and formatting * update docs * fix typo * update configs.md * Change to check for isSqlEnabled and the mode separately because we may want to initialize stuff on startup with the plugin disabled and dynamically enable it afterwards * fix spacing * update auto generated configs doc * Update docs/get-started/getting-started-workload-qualification.md Co-authored-by: Jason Lowe <[email protected]> * Update docs/get-started/getting-started-workload-qualification.md Co-authored-by: Jason Lowe <[email protected]> * update copyrights and change text from plugin to Rapids Accelerator * Update sql-plugin/src/main/scala/com/nvidia/spark/rapids/RapidsConf.scala Co-authored-by: Jason Lowe <[email protected]> * Update sql-plugin/src/main/scala/com/nvidia/spark/rapids/RapidsConf.scala Co-authored-by: Jason Lowe <[email protected]> * Update sql-plugin/src/main/scala/com/nvidia/spark/rapids/RapidsConf.scala Co-authored-by: Jason Lowe <[email protected]> * update configs doc Co-authored-by: Jason Lowe <[email protected]>
- Loading branch information
Showing
12 changed files
with
230 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Copyright (c) 2022, NVIDIA CORPORATION. | ||
# | ||
# 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. | ||
|
||
import pytest | ||
from pyspark.sql.types import * | ||
from asserts import assert_gpu_fallback_collect | ||
from data_gen import * | ||
from marks import ignore_order | ||
|
||
# copied from sort_test and added explainOnly mode | ||
_explain_mode_conf = {'spark.rapids.sql.mode': 'explainOnly', | ||
'spark.sql.join.preferSortMergeJoin': 'True', | ||
'spark.sql.shuffle.partitions': '2', | ||
'spark.sql.legacy.allowNegativeScaleOfDecimal': 'true' | ||
} | ||
|
||
def create_df(spark, data_gen, left_length, right_length): | ||
left = binary_op_df(spark, data_gen, length=left_length) | ||
right = binary_op_df(spark, data_gen, length=right_length).withColumnRenamed("a", "r_a")\ | ||
.withColumnRenamed("b", "r_b") | ||
return left, right | ||
|
||
|
||
# just run with one join type since not testing join itself | ||
all_join_types = ['Left'] | ||
|
||
# use a subset of types just to test explain only mode | ||
all_gen = [StringGen(), ByteGen()] | ||
|
||
# here we use the assert_gpu_fallback_collect to make sure explain only mode runs on the CPU | ||
@ignore_order(local=True) | ||
@pytest.mark.parametrize('data_gen', all_gen, ids=idfn) | ||
@pytest.mark.parametrize('join_type', all_join_types, ids=idfn) | ||
def test_explain_only_sortmerge_join(data_gen, join_type): | ||
def do_join(spark): | ||
left, right = create_df(spark, data_gen, 500, 500) | ||
return left.join(right, left.a == right.r_a, join_type) | ||
assert_gpu_fallback_collect(do_join, 'SortMergeJoinExec', conf=_explain_mode_conf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.