Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
zhztheplayer committed Aug 5, 2024
1 parent 8fa6f0d commit 959e280
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* 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.gluten.integration;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class SparkJvmOptions {
private static final String MODULE_OPTIONS_CLASS_NAME = "org.apache.spark.launcher.JavaModuleOptions";

public static String read() {
try {
final Class<?> clazz = Class.forName("org.apache.spark.launcher.JavaModuleOptions");
final Method method = clazz.getMethod("defaultModuleOptions");
return (String) method.invoke(null);
} catch (ClassNotFoundException e) {
// Could happen in Spark 3.2 which doesn't have this class yet.
return "";
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
throw new RuntimeException(e);
}
}

public static void main(String[] args) {
System.out.println(read());
}
}
29 changes: 7 additions & 22 deletions tools/gluten-it/sbin/gluten-it.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

set -euf

GLUTEN_IT_JVM_ARGS=${GLUTEN_IT_JVM_ARGS:-"-Xmx2G -XX:ErrorFile=/var/log/java/hs_err_pid%p.log"}

BASEDIR=$(dirname $0)

LIB_DIR=$BASEDIR/../package/target/lib
Expand All @@ -28,6 +26,8 @@ fi

JAR_PATH=$LIB_DIR/*

SPARK_JVM_OPTIONS=$($JAVA_HOME/bin/java -cp $JAR_PATH org.apache.gluten.integration.SparkJvmOptions)

EMBEDDED_SPARK_HOME=$BASEDIR/../spark-home

export SPARK_HOME=${SPARK_HOME:-$EMBEDDED_SPARK_HOME}
Expand All @@ -36,25 +36,10 @@ export SPARK_SCALA_VERSION=${SPARK_SCALA_VERSION:-'2.12'}
echo "SPARK_HOME set at [$SPARK_HOME]."
echo "SPARK_SCALA_VERSION set at [$SPARK_SCALA_VERSION]."

$JAVA_HOME/bin/java $GLUTEN_IT_JVM_ARGS \
-XX:+IgnoreUnrecognizedVMOptions \
--add-modules=jdk.incubator.vector \
--add-opens=java.base/java.lang=ALL-UNNAMED \
--add-opens=java.base/java.lang.invoke=ALL-UNNAMED \
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED \
--add-opens=java.base/java.io=ALL-UNNAMED \
--add-opens=java.base/java.net=ALL-UNNAMED \
--add-opens=java.base/java.nio=ALL-UNNAMED \
--add-opens=java.base/java.util=ALL-UNNAMED \
--add-opens=java.base/java.util.concurrent=ALL-UNNAMED \
--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED \
--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED \
--add-opens=java.base/sun.nio.ch=ALL-UNNAMED \
--add-opens=java.base/sun.nio.cs=ALL-UNNAMED \
--add-opens=java.base/sun.security.action=ALL-UNNAMED \
--add-opens=java.base/sun.util.calendar=ALL-UNNAMED \
--add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED \
-Djdk.reflect.useDirectMethodHandle=false \
-Dio.netty.tryReflectionSetAccessible=true \
GLUTEN_IT_JVM_ARGS=${GLUTEN_IT_JVM_ARGS:-"-Xmx2G -XX:ErrorFile=/var/log/java/hs_err_pid%p.log"}

$JAVA_HOME/bin/java \
$SPARK_JVM_OPTIONS \
$GLUTEN_IT_JVM_ARGS \
-cp $JAR_PATH \
org.apache.gluten.integration.Cli $@

0 comments on commit 959e280

Please sign in to comment.