-
Notifications
You must be signed in to change notification settings - Fork 434
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[VL] Add uniffle integration (#3767)
- Loading branch information
Showing
18 changed files
with
705 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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"> | ||
<parent> | ||
<artifactId>gluten-uniffle</artifactId> | ||
<groupId>org.apache.gluten</groupId> | ||
<version>1.2.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>gluten-uniffle-package</artifactId> | ||
<packaging>jar</packaging> | ||
<name>Gluten Uniffle Package</name> | ||
|
||
<profiles> | ||
<profile> | ||
<id>backends-velox</id> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.gluten</groupId> | ||
<artifactId>gluten-uniffle-velox</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</profile> | ||
</profiles> | ||
</project> |
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,89 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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"> | ||
<parent> | ||
<artifactId>gluten-parent</artifactId> | ||
<groupId>org.apache.gluten</groupId> | ||
<version>1.2.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>gluten-uniffle</artifactId> | ||
<packaging>pom</packaging> | ||
<name>Gluten Uniffle</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.hadoop</groupId> | ||
<artifactId>hadoop-common</artifactId> | ||
<version>${hadoop.version}</version> | ||
<scope>provided</scope> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>net.minidev</groupId> | ||
<artifactId>json-smart</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>com.sun.jersey</groupId> | ||
<artifactId>jersey-json</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.gluten</groupId> | ||
<artifactId>gluten-core</artifactId> | ||
<version>${project.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.uniffle</groupId> | ||
<artifactId>rss-client-spark${spark.major.version}-shaded</artifactId> | ||
<version>${uniffle.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.spark</groupId> | ||
<artifactId>spark-core_${scala.binary.version}</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.spark</groupId> | ||
<artifactId>spark-sql_${scala.binary.version}</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>net.alchim31.maven</groupId> | ||
<artifactId>scala-maven-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.scalastyle</groupId> | ||
<artifactId>scalastyle-maven-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-checkstyle-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>com.diffplug.spotless</groupId> | ||
<artifactId>spotless-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<profiles> | ||
<profile> | ||
<id>backends-velox</id> | ||
<properties> | ||
</properties> | ||
<modules> | ||
<module>velox</module> | ||
<module>package</module> | ||
</modules> | ||
</profile> | ||
</profiles> | ||
</project> |
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,62 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>gluten-uniffle</artifactId> | ||
<groupId>org.apache.gluten</groupId> | ||
<version>1.2.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>gluten-uniffle-velox</artifactId> | ||
<packaging>jar</packaging> | ||
<name>Gluten Uniffle Velox</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.gluten</groupId> | ||
<artifactId>backends-velox</artifactId> | ||
<version>${project.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.gluten</groupId> | ||
<artifactId>gluten-data</artifactId> | ||
<version>${project.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<outputDirectory>target/scala-${scala.binary.version}/classes</outputDirectory> | ||
<testOutputDirectory>target/scala-${scala.binary.version}/test-classes</testOutputDirectory> | ||
<plugins> | ||
<plugin> | ||
<groupId>net.alchim31.maven</groupId> | ||
<artifactId>scala-maven-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.scalastyle</groupId> | ||
<artifactId>scalastyle-maven-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-checkstyle-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>com.diffplug.spotless</groupId> | ||
<artifactId>spotless-maven-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
87 changes: 87 additions & 0 deletions
87
...le/velox/src/main/java/org/apache/spark/shuffle/gluten/uniffle/UniffleShuffleManager.java
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,87 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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.shuffle.gluten.uniffle; | ||
|
||
import org.apache.spark.ShuffleDependency; | ||
import org.apache.spark.SparkConf; | ||
import org.apache.spark.SparkEnv; | ||
import org.apache.spark.TaskContext; | ||
import org.apache.spark.executor.ShuffleWriteMetrics; | ||
import org.apache.spark.shuffle.ColumnarShuffleDependency; | ||
import org.apache.spark.shuffle.RssShuffleHandle; | ||
import org.apache.spark.shuffle.RssShuffleManager; | ||
import org.apache.spark.shuffle.RssSparkConfig; | ||
import org.apache.spark.shuffle.ShuffleHandle; | ||
import org.apache.spark.shuffle.ShuffleWriteMetricsReporter; | ||
import org.apache.spark.shuffle.ShuffleWriter; | ||
import org.apache.spark.shuffle.writer.VeloxUniffleColumnarShuffleWriter; | ||
import org.apache.uniffle.common.exception.RssException; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class UniffleShuffleManager extends RssShuffleManager { | ||
private static final Logger LOG = LoggerFactory.getLogger(UniffleShuffleManager.class); | ||
|
||
private boolean isDriver() { | ||
return "driver".equals(SparkEnv.get().executorId()); | ||
} | ||
|
||
public UniffleShuffleManager(SparkConf conf, boolean isDriver) { | ||
super(conf, isDriver); | ||
conf.set(RssSparkConfig.SPARK_RSS_CONFIG_PREFIX + RssSparkConfig.RSS_ROW_BASED, "false"); | ||
} | ||
|
||
@Override | ||
public <K, V, C> ShuffleHandle registerShuffle( | ||
int shuffleId, ShuffleDependency<K, V, C> dependency) { | ||
return super.registerShuffle(shuffleId, dependency); | ||
} | ||
|
||
@Override | ||
public <K, V> ShuffleWriter<K, V> getWriter( | ||
ShuffleHandle handle, long mapId, TaskContext context, ShuffleWriteMetricsReporter metrics) { | ||
if (!(handle instanceof RssShuffleHandle)) { | ||
throw new RssException("Unexpected ShuffleHandle:" + handle.getClass().getName()); | ||
} | ||
RssShuffleHandle<K, V, V> rssHandle = (RssShuffleHandle<K, V, V>) handle; | ||
if (rssHandle.getDependency() instanceof ColumnarShuffleDependency) { | ||
setPusherAppId(rssHandle); | ||
String taskId = "" + context.taskAttemptId() + "_" + context.attemptNumber(); | ||
ShuffleWriteMetrics writeMetrics; | ||
if (metrics != null) { | ||
writeMetrics = new WriteMetrics(metrics); | ||
} else { | ||
writeMetrics = context.taskMetrics().shuffleWriteMetrics(); | ||
} | ||
return new VeloxUniffleColumnarShuffleWriter<>( | ||
context.partitionId(), | ||
rssHandle.getAppId(), | ||
rssHandle.getShuffleId(), | ||
taskId, | ||
context.taskAttemptId(), | ||
writeMetrics, | ||
this, | ||
sparkConf, | ||
shuffleWriteClient, | ||
rssHandle, | ||
this::markFailedTask, | ||
context); | ||
} else { | ||
return super.getWriter(handle, mapId, context, metrics); | ||
} | ||
} | ||
} |
Oops, something went wrong.