forked from NVIDIA/spark-rapids
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add command-line interface for TPC-* for use with spark-submit (NVIDI…
…A#823) * rename tpch benchmark file Signed-off-by: Andy Grove <andygrove@nvidia.com> * Add command-line interface to benchmarks Signed-off-by: Andy Grove <andygrove@nvidia.com>
- Loading branch information
1 parent
dcd29aa
commit 0e20631
Showing
8 changed files
with
411 additions
and
126 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
82 changes: 82 additions & 0 deletions
82
integration_tests/src/main/scala/com/nvidia/spark/rapids/tests/common/CompareResults.scala
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,82 @@ | ||
/* | ||
* Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. | ||
* | ||
* 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. | ||
*/ | ||
package com.nvidia.spark.rapids.tests.common | ||
|
||
import org.rogach.scallop.ScallopConf | ||
|
||
import org.apache.spark.sql.SparkSession | ||
|
||
/** | ||
* Utility for comparing two csv or parquet files, such as the output from a benchmark, to | ||
* verify that they match, allowing for differences in precision. | ||
* | ||
* This utility is intended to be run via spark-submit. | ||
* | ||
* Example usage: | ||
* | ||
* <pre> | ||
* $SPARK_HOME/bin/spark-submit --jars $SPARK_RAPIDS_PLUGIN_JAR,$CUDF_JAR \ | ||
* --master local[*] \ | ||
* --class com.nvidia.spark.rapids.tests.common.CompareResults \ | ||
* $SPARK_RAPIDS_PLUGIN_INTEGRATION_TEST_JAR \ | ||
* --input1 /path/to/result1 \ | ||
* --input2 /path/to/result2 \ | ||
* --input-format parquet | ||
* </pre> | ||
*/ | ||
object CompareResults { | ||
def main(arg: Array[String]): Unit = { | ||
val conf = new Conf(arg) | ||
|
||
val spark = SparkSession.builder.appName("CompareResults").getOrCreate() | ||
|
||
val (df1, df2) = conf.inputFormat() match { | ||
case "csv" => | ||
(spark.read.csv(conf.input1()), spark.read.csv(conf.input2())) | ||
case "parquet" => | ||
(spark.read.parquet(conf.input1()), spark.read.parquet(conf.input2())) | ||
} | ||
|
||
BenchUtils.compareResults( | ||
df1, | ||
df2, | ||
conf.ignoreOrdering(), | ||
conf.useIterator(), | ||
conf.maxErrors(), | ||
conf.epsilon()) | ||
} | ||
} | ||
|
||
class Conf(arguments: Seq[String]) extends ScallopConf(arguments) { | ||
/** Path to first data set */ | ||
val input1 = opt[String](required = true) | ||
/** Path to second data set */ | ||
val input2 = opt[String](required = true) | ||
/** Input format (csv or parquet) */ | ||
val inputFormat = opt[String](required = true) | ||
/** Sort the data collected from the DataFrames before comparing them. */ | ||
val ignoreOrdering = opt[Boolean](required = false, default = Some(false)) | ||
/** | ||
* When set to true, use `toLocalIterator` to load one partition at a time into driver memory, | ||
* reducing memory usage at the cost of performance because processing will be single-threaded. | ||
*/ | ||
val useIterator = opt[Boolean](required = false, default = Some(false)) | ||
/** Maximum number of differences to report */ | ||
val maxErrors = opt[Int](required = false, default = Some(10)) | ||
/** Allow for differences in precision when comparing floating point values */ | ||
val epsilon = opt[Double](required = false, default = Some(0.00001)) | ||
verify() | ||
} |
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
107 changes: 0 additions & 107 deletions
107
integration_tests/src/main/scala/com/nvidia/spark/rapids/tests/tpch/Benchmarks.scala
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.