Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace JNA usage in ArrowTransferDefinitions with JavaCPP #499

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
28 changes: 26 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ lazy val root = Project(id = "spark-cyclone-sql-plugin", base = file("."))
.configs(VectorEngine)
.configs(TPC)
.configs(CMake)
.enablePlugins(SbtJavaCPP4S)
.settings(version := "0.9.2")

lazy val tracing = project
Expand All @@ -43,6 +44,22 @@ lazy val tracing = project
reStart / envVars += "LOG_DIR" -> file("tracing-dir").getAbsolutePath
)

gppCompilerPath := "g++"
nativeJavaClassPath := "com.nec.arrow.TransferDefinitions"

includePath := (baseDirectory in Compile).value / "src/main/resources/com/nec/cyclone/cpp"

libraryName := "libTransferDefinitions"

makeLibraryCommands := Seq(
"g++ -std=c++17 -fPIC",
"-I", includePath.value.toString,
currentLibraryMeta.value.option,
"-o",
(libraryDestinationPath.value / s"${libraryName.value}.${currentLibraryMeta.value.extension}").toString,
((baseDirectory in Compile).value / "src/main/resources/com/nec/cyclone/cpp/cyclone/" / "transfer-definitions.hpp").toString
)

/**
* Run with:
*
Expand Down Expand Up @@ -149,6 +166,8 @@ libraryDependencies ++= {
}
}


Test / fork := true
Test / unmanagedJars ++= sys.env
.get("CUDF_PATH")
.map(path => new File(path))
Expand All @@ -168,7 +187,9 @@ CMake / parallelExecution := true
*/
CMake / testGrouping := (CMake / definedTests).value.map { suite =>
import sbt.Tests._
Group(suite.name, Seq(suite), SubProcess(ForkOptions()))
Group(suite.name, Seq(suite), SubProcess(ForkOptions(runJVMOptions = Vector("-Djava.library.path=target/libjni"),
bootJars=Vector[java.io.File](), javaHome=None, outputStrategy=None,
workingDirectory=None, connectInput=false, envVars = Map[String, String]())))
}

/** Vector Engine specific configuration */
Expand All @@ -184,7 +205,9 @@ VectorEngine / run / fork := true
*/
VectorEngine / testGrouping := (VectorEngine / definedTests).value.map { suite =>
import sbt.Tests._
Group(suite.name, Seq(suite), SubProcess(ForkOptions()))
Group(suite.name, Seq(suite), SubProcess(ForkOptions(runJVMOptions = Vector("-Djava.library.path=target/libjni"),
bootJars=Vector[java.io.File](), javaHome=None, outputStrategy=None,
workingDirectory=None, connectInput=false, envVars = Map[String, String]())))
}

/** This generates a file 'java.hprof.txt' in the project root for very simple profiling. * */
Expand All @@ -194,6 +217,7 @@ VectorEngine / run / javaOptions ++= {
List("-agentlib:hprof=cpu=samples")
else Nil
}

VectorEngine / sourceDirectory := baseDirectory.value / "src" / "test"
VectorEngine / testOptions := Seq(Tests.Filter(veFilter))

Expand Down
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.6")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.0")
addSbtPlugin("org.bytedeco" % "sbt-javacpp" % "1.17")
addSbtPlugin("com.github.y-yu" % "sbt-javacpp4s" % "0.1.4")
283 changes: 0 additions & 283 deletions src/main/java/com/nec/arrow/ArrowTransferStructures.java

This file was deleted.

Loading