From 48e4af130db5f9511aa26779c49999f1c59d8ed5 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Wed, 16 Dec 2020 08:48:22 -0800 Subject: [PATCH 01/16] [ML] Add a vectorized BLAS implementation Whenever a native BLAS implementation isn't available on the system, Spark automatically falls back onto a Java implementation. With the recent release of the Vector API in the OpenJDK [1], we can use hardware acceleration for such operations. This patch introduces a VectorizedBLAS class which implements such hardware-accelerated BLAS operations. This feature is hidden behind the "vectorized" profile that you can enable by passing "-Pvectorized" to sbt or maven. The Vector API has been introduced in JDK 16. Following discussion on the mailing list, this API is introduced transparently and needs to be enabled explicitely. [1] https://openjdk.java.net/jeps/338 --- mllib-local/pom.xml | 40 ++++ .../org/apache/spark/ml/linalg/BLAS.scala | 46 ++-- .../spark/ml/linalg/BLASBenchmark.scala | 226 ++++++++++++++++++ .../apache/spark/ml/linalg/BLASSuite.scala | 2 +- .../spark/ml/linalg/VectorizedBLAS.java | 162 +++++++++++++ .../apache/spark/ml/recommendation/ALS.scala | 2 +- project/SparkBuild.scala | 10 + 7 files changed, 468 insertions(+), 20 deletions(-) create mode 100644 mllib-local/src/test/scala/org/apache/spark/ml/linalg/BLASBenchmark.scala create mode 100644 mllib-local/src/vectorized/java/org/apache/spark/ml/linalg/VectorizedBLAS.java diff --git a/mllib-local/pom.xml b/mllib-local/pom.xml index 2a2c373242201..977febdc7ccb8 100644 --- a/mllib-local/pom.xml +++ b/mllib-local/pom.xml @@ -56,6 +56,11 @@ org.apache.spark spark-tags_${scala.binary.version} + + org.apache.spark + spark-core_${scala.binary.version} + ${project.version} +