tensorflow / tensorflow/java

Not utilising AVX2 instructions after compilation from sources

オープン
#98 コメント 11 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Java
スター
928
フォーク
227
PR マージ指標
30日以内にマージされた PR はありません

説明

System information

  • OS Platform and Distribution: Linux Ubuntu 20.04
  • TensorFlow installed from (source or binary): built via "mvn install"
  • TensorFlow version: 2.3 (using 0.2.0-SNAPSHOT)
  • Python version: 3.8.2
  • Bazel version (if compiling from source): 3.4.1
  • GCC/Compiler version (if compiling from source): 9.3.0

Problem:

I have been using TF 1.15 from original java TF repository

<dependency>
    <groupId>org.tensorflow</groupId>
    <artifactId>tensorflow</artifactId>
    <version>1.15.0</version>
</dependency>

which gave me this output:

I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2494460000 Hz
I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x7f77250299d0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version

so found out this repo, made environment to be able to build TF from sources, ran mvn install command which, I would assume, compiled TF on my specific platform. Using dependencies in my project:

<dependency>
    <groupId>org.tensorflow</groupId>
    <artifactId>tensorflow-core-api</artifactId>
    <version>0.2.0-SNAPSHOT</version>
</dependency>
<dependency>
    <groupId>org.tensorflow</groupId>
    <artifactId>tensorflow-core-api</artifactId>
    <version>0.2.0-SNAPSHOT</version>
    <classifier>linux-x86_64</classifier>
</dependency>

getting output:

Warning: Could not load Loader: java.lang.UnsatisfiedLinkError: no jnijavacpp in java.library.path: [/usr/java/packages/lib, /usr/lib64, /lib64, /lib, /usr/lib]
Warning: Could not load Pointer: java.lang.UnsatisfiedLinkError: no jnijavacpp in java.library.path: [/usr/java/packages/lib, /usr/lib64, /lib64, /lib, /usr/lib]
Warning: Could not load BytePointer: java.lang.UnsatisfiedLinkError: no jnijavacpp in java.library.path: [/usr/java/packages/lib, /usr/lib64, /lib64, /lib, /usr/lib]
I external/org_tensorflow/tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations: AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
Warning: Could not load PointerPointer: java.lang.UnsatisfiedLinkError: no jnijavacpp in java.library.path: [/usr/java/packages/lib, /usr/lib64, /lib64, /lib, /usr/lib]

Everything somehow runs, but throughput is about the same as generic 1.15 version and latency is about 2 times worse than the previous version using the same TF model with V1 behavior enabled. Not sure how to enable AVX2 FMA instructions when TF clearly founds them. I suppose it has something to do about missing jnijavacpp library. Could anyone help me, please?

Thanks

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

ソースファイルやテストは指定されていません。まず mvn install を使って Ubuntu 20.04 のビルドを再現し、その後、ネイティブライブラリの読み込みに関する警告と、報告された AVX2/FMA メッセージを調査してください。完了とするには、ビルドされた Java パッケージが期待されるパフォーマンスと一致しない理由を特定し、同等のスループットおよびレイテンシ測定によって修正を文書化または検証する必要があります。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java, tensorflow
領域
build-system, machine-learning
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
20/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。