Skip to content

Does TensorFlow-Java support Apple Silicon Macs? #252

@Taiyx

Description

@Taiyx

Please make sure that this is a bug. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:bug_template

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow):
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): MacOs Big Sur ver11.0.1, M1 slices
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:
  • TensorFlow installed from (source or binary): Maven
  • TensorFlow version (use command below): Old tensorflow version(1.4.0/1.5.0), and new tensorflow Java Version 0.2.0
  • JVM version: 1.8.0_162
  • No GPU

Describe the current behavior
I just try to run tensorflow java offical example, and get tensorflow version for test. but It dosen't work.
I have test different versions of tensorflow java interface, and only ver 1.13.1 works well.
And all other versions can not work, for example old tensorflow version(1.4.0/1.5.0), and new tensorflow Java Version 0.2.0/0.3.0(tensorflow ver2.3.1/2.4.1) .

The Error shows below:

A fatal error has been detected by the Java Runtime Environment:

SIGILL (0x4) at pc=0x00000001290edc15, pid=6333, tid=0x0000000000001a03

JRE version: Java(TM) SE Runtime Environment (8.0_162-b12) (build 1.8.0_162-b12)
Java VM: Java HotSpot(TM) 64-Bit Server VM (25.162-b12 mixed mode bsd-amd64 compressed oops)
Problematic frame:
C [libtensorflow_framework.2.dylib+0x14c15] tensorflow::monitoring::MetricDef<(tensorflow::monitoring::MetricKind)1, long long, 2>::MetricDef<char [11], char [7]>(absl::lts_2020_02_25::string_view, absl::lts_2020_02_25::string_view, char const (&) [11], char const (&) [7])+0x125

Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

An error report file with more information is saved as:
/***/tf_test/hs_err_pid6333.log

If you would like to submit a bug report, please visit:
http://bugreport.java.com/bugreport/crash.jsp
The crash happened outside the Java Virtual Machine in native code.
See problematic frame for where to report the bug.

Code to reproduce the issue
Java code:


import org.tensorflow.TensorFlow;
public class HelloTensorFlow {
    public static void main(String[] args) throws Exception {
        System.out.println("Hello TensorFlow " +TensorFlow.version());
    }
}

pom.xml

<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.myorg</groupId>
    <artifactId>hellotensorflow</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <exec.mainClass>HelloTensorFlow</exec.mainClass>
    <!-- Minimal version for compiling TensorFlow Java is JDK 8 -->
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <dependencies>
    <!-- Include TensorFlow (pure CPU only) for all supported platforms -->
        <dependency>
            <groupId>org.tensorflow</groupId>
            <artifactId>tensorflow-core-platform</artifactId>
            <version>0.2.0</version>
        </dependency>
    </dependencies>
</project>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions