Skip to content

linux-arm64: add build support for native and framework jars #545

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

Merged
merged 2 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,18 @@
</property>
</activation>
</profile>
<profile>
<id>linux-arm64</id>
<activation>
<os>
<name>linux</name>
<arch>aarch64</arch>
</os>
<property>
<name>!javacpp.platform.extension</name>
</property>
</activation>
</profile>
<profile>
<id>macosx</id>
<activation>
Expand Down
10 changes: 10 additions & 0 deletions tensorflow-core/tensorflow-core-native/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@
<version>${project.version}</version>
<classifier>${javacpp.platform.windows-x86_64}</classifier>
</artifactItem>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<classifier>${javacpp.platform.linux-arm64}</classifier>
</artifactItem>
</artifactItems>
</configuration>
</execution>
Expand Down Expand Up @@ -169,6 +175,10 @@
<file>${project.build.directory}/${project.artifactId}-${project.version}-${javacpp.platform.windows-x86_64}.jar</file>
<classifier>${javacpp.platform.windows-x86_64}</classifier>
</artifact>
<artifact>
<file>${project.build.directory}/${project.artifactId}-${project.version}-${javacpp.platform.linux-arm64}.jar</file>
<classifier>${javacpp.platform.linux-arm64}</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ case ${PLATFORM:-} in
WHEEL_URL='https://files.pythonhosted.org/packages/e0/36/6278e4e7e69a90c00e0f82944d8f2713dd85a69d1add455d9e50446837ab/tensorflow_intel-2.16.1-cp311-cp311-win_amd64.whl'
CLIB_URL='https://storage.googleapis.com/tensorflow/versions/2.16.1/libtensorflow-cpu-windows-x86_64.zip'
;;
'linux-arm64')
WHEEL_URL='https://files.pythonhosted.org/packages/41/ab/e5386c722548df2043c1eaadc431ea3ba0ee42a66b3af7f8013bbbacecd3/tensorflow-2.16.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl'
;;
*)
echo "TensorFlow distribution for ${PLATFORM} is not supported for download"
exit 1;
Expand All @@ -34,6 +37,9 @@ if [[ -n "$WHEEL_URL" ]]; then
curl -L $WHEEL_URL --output 'tensorflow.whl'
fi
yes | unzip -q -u 'tensorflow.whl' # use 'yes' because for some reasons -u does not work on Windows
if [[ "$PLATFORM" == "linux-arm64" ]]; then
cp $DOWNLOAD_FOLDER/tensorflow.libs/* $DOWNLOAD_FOLDER/tensorflow/
fi
fi

if [[ -n "$CLIB_URL" ]]; then
Expand All @@ -48,6 +54,9 @@ cd tensorflow
if [[ "$PLATFORM" =~ "linux" ]]; then
ln -fs libtensorflow_cc.so.2 libtensorflow_cc.so
ln -fs libtensorflow_framework.so.2 libtensorflow_framework.so
if [[ "$PLATFORM" == "linux-arm64" ]]; then
ln -fs libomp-*.so.5 libomp.so
fi
elif [[ "$PLATFORM" =~ "macosx" ]]; then
ln -fs libtensorflow_cc.2.dylib libtensorflow_cc.dylib
ln -fs libtensorflow_framework.2.dylib libtensorflow_framework.dylib
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
},
link = {"[email protected]", "[email protected]"},
resource = {"LICENSE", "THIRD_PARTY_TF_JNI_LICENSES"}),
@Platform(
value = {"linux-arm64"},
link = {"[email protected]", "[email protected]", "[email protected]"}),
@Platform(
value = "windows",
preload = {
Expand Down
8 changes: 7 additions & 1 deletion tensorflow-core/tensorflow-core-platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
<version>${project.version}</version>
<classifier>linux-x86_64</classifier>
</dependency>
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core-native</artifactId>
<version>${project.version}</version>
<classifier>linux-arm64</classifier>
</dependency>
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core-native</artifactId>
Expand Down Expand Up @@ -73,7 +79,7 @@
<configuration>
<archive>
<manifestEntries>
<Class-Path>tensorflow-core-api.jar tensorflow-core-native.jar tensorflow-core-native-linux-x86_64.jar tensorflow-core-native-macosx-arm64.jar tensorflow-core-native-macosx-x86_64.jar tensorflow-core-native-windows-x86_64.jar</Class-Path>
<Class-Path>tensorflow-core-api.jar tensorflow-core-native.jar tensorflow-core-native-linux-x86_64.jar tensorflow-core-native-macosx-arm64.jar tensorflow-core-native-macosx-x86_64.jar tensorflow-core-native-windows-x86_64.jar tensorflow-core-native-linux-arm64.jar</Class-Path>
<Automatic-Module-Name>${java.module.name}</Automatic-Module-Name>
</manifestEntries>
</archive>
Expand Down
Loading