-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemenent a Spark 3.2.1-SNAPSHOT Shim
Signed-off-by: Gera Shegalov <gera@apache.org>
- Loading branch information
1 parent
17500a5
commit 5dc32e8
Showing
29 changed files
with
342 additions
and
3 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2021, 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. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>com.nvidia</groupId> | ||
<artifactId>rapids-4-spark-shims_2.12</artifactId> | ||
<version>21.12.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<artifactId>rapids-4-spark-shims-spark321_2.12</artifactId> | ||
<name>RAPIDS Accelerator for Apache Spark SQL Plugin Spark 3.2.1 Shim</name> | ||
<description>The RAPIDS SQL plugin for Apache Spark 3.2.1 Shim</description> | ||
<version>21.12.0-SNAPSHOT</version> | ||
<properties> | ||
<!-- don't move to the parent module shims due to conflicting tmp files --> | ||
<target.classifier/> | ||
</properties> | ||
|
||
<!-- Set 'spark.version' for the shims layer --> | ||
<!-- Create a separate file 'SPARK_VER.properties' in the jar to save cudf & spark version info --> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-antrun-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>dependency</id> | ||
<phase>generate-resources</phase> | ||
<configuration> | ||
<target> | ||
<mkdir dir="${project.build.directory}/extra-resources"/> | ||
<exec executable="bash" failonerror="true" | ||
output="${project.build.directory}/extra-resources/spark-${spark321.version}-info.properties"> | ||
<arg value="${user.dir}/build/dependency-info.sh"/> | ||
<arg value="${cudf.version}"/> | ||
<arg value="${cuda.version}"/> | ||
<arg value="${spark321.version}"/> | ||
</exec> | ||
</target> | ||
</configuration> | ||
<goals> | ||
<goal>run</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
|
||
<resources> | ||
<resource> | ||
<!-- Include the properties file to provide the build information. --> | ||
<directory>${project.build.directory}/extra-resources</directory> | ||
</resource> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
</resource> | ||
</resources> | ||
</build> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.spark</groupId> | ||
<artifactId>spark-sql_${scala.binary.version}</artifactId> | ||
<version>${spark321.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
24 changes: 24 additions & 0 deletions
24
shims/spark321/src/main/scala/com/nvidia/spark/rapids/shims/spark321/Spark321Shims.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,24 @@ | ||
/* | ||
* Copyright (c) 2021, 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. | ||
*/ | ||
|
||
package com.nvidia.spark.rapids.shims.spark321 | ||
|
||
import com.nvidia.spark.rapids._ | ||
import com.nvidia.spark.rapids.shims.v2._ | ||
|
||
class Spark321Shims extends Spark32XShims { | ||
override def getSparkShimVersion: ShimVersion = SparkShimServiceProvider.VERSION | ||
} |
35 changes: 35 additions & 0 deletions
35
...k321/src/main/scala/com/nvidia/spark/rapids/shims/spark321/SparkShimServiceProvider.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,35 @@ | ||
/* | ||
* Copyright (c) 2021, 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. | ||
*/ | ||
|
||
package com.nvidia.spark.rapids.shims.spark321 | ||
|
||
import com.nvidia.spark.rapids.{SparkShims, SparkShimVersion} | ||
|
||
object SparkShimServiceProvider { | ||
val VERSION = SparkShimVersion(3, 2, 1) | ||
val VERSIONNAMES = Seq(s"$VERSION", s"$VERSION-SNAPSHOT") | ||
} | ||
|
||
class SparkShimServiceProvider extends com.nvidia.spark.rapids.SparkShimServiceProvider { | ||
|
||
def matchesVersion(version: String): Boolean = { | ||
SparkShimServiceProvider.VERSIONNAMES.contains(version) | ||
} | ||
|
||
def buildShim: SparkShims = { | ||
new Spark321Shims() | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
shims/spark321/src/main/scala/com/nvidia/spark/rapids/spark321/RapidsShuffleManager.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,26 @@ | ||
/* | ||
* Copyright (c) 2021, 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. | ||
*/ | ||
|
||
package com.nvidia.spark.rapids.spark321 | ||
|
||
import org.apache.spark.SparkConf | ||
import org.apache.spark.sql.rapids.shims.spark321.ProxyRapidsShuffleInternalManager | ||
|
||
/** A shuffle manager optimized for the RAPIDS Plugin for Apache Spark. */ | ||
sealed class RapidsShuffleManager( | ||
conf: SparkConf, | ||
isDriver: Boolean) extends ProxyRapidsShuffleInternalManager(conf, isDriver) { | ||
} |
60 changes: 60 additions & 0 deletions
60
.../main/scala/org/apache/spark/sql/rapids/shims/spark321/RapidsShuffleInternalManager.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,60 @@ | ||
/* | ||
* Copyright (c) 2021, 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. | ||
*/ | ||
|
||
package org.apache.spark.sql.rapids.shims.spark321 | ||
|
||
import org.apache.spark.{SparkConf, TaskContext} | ||
import org.apache.spark.shuffle._ | ||
import org.apache.spark.sql.rapids.{ProxyRapidsShuffleInternalManagerBase, RapidsShuffleInternalManagerBase} | ||
|
||
/** | ||
* A shuffle manager optimized for the RAPIDS Plugin For Apache Spark. | ||
* @note This is an internal class to obtain access to the private | ||
* `ShuffleManager` and `SortShuffleManager` classes. | ||
*/ | ||
class RapidsShuffleInternalManager(conf: SparkConf, isDriver: Boolean) | ||
extends RapidsShuffleInternalManagerBase(conf, isDriver) { | ||
|
||
def getReader[K, C]( | ||
handle: ShuffleHandle, | ||
startMapIndex: Int, | ||
endMapIndex: Int, | ||
startPartition: Int, | ||
endPartition: Int, | ||
context: TaskContext, | ||
metrics: ShuffleReadMetricsReporter): ShuffleReader[K, C] = { | ||
getReaderInternal(handle, startMapIndex, endMapIndex, startPartition, endPartition, context, | ||
metrics) | ||
} | ||
} | ||
|
||
|
||
class ProxyRapidsShuffleInternalManager(conf: SparkConf, isDriver: Boolean) | ||
extends ProxyRapidsShuffleInternalManagerBase(conf, isDriver) with ShuffleManager { | ||
|
||
def getReader[K, C]( | ||
handle: ShuffleHandle, | ||
startMapIndex: Int, | ||
endMapIndex: Int, | ||
startPartition: Int, | ||
endPartition: Int, | ||
context: TaskContext, | ||
metrics: ShuffleReadMetricsReporter | ||
): ShuffleReader[K, C] = { | ||
self.getReader(handle, startMapIndex, endMapIndex, startPartition, endPartition, context, | ||
metrics) | ||
} | ||
} |
Oops, something went wrong.