clearlinux / distribution

Placeholder repository to allow filing of general bugs/issues/etc against the Clear Linux OS for Intel Architecture linux distribution
521 stars 29 forks source link

Cannot build Tensorflow 2.2.0 from source #1974

Open 0xA1B2 opened 4 years ago

0xA1B2 commented 4 years ago

I try to compile Tensorflow 2.2.0 without AVX as my CPU only supports SSE 4.2.

Looks like CL comes with an unsupported Bazel version for Tensorflow (needs Bazel 2.0.0), even as they are in the same bundles ?

Steps taken:

Build Tensorflow 2.2.0 from Source

Get bazel

swupd bundle-add machine-learning-basic

Get TF

cd /home/cookie/Downloads

git clone https://github.com/tensorflow/tensorflow.git

cd tensorflow

./configure

Build - Generic

bazel build //tensorflow/tools/pip_package:build_pip_package

Error …

Starting local Bazel server and connecting to it... INFO: Options provided by the client: Inherited 'common' options: --isatty=1 --terminal_columns=135 INFO: Reading rc options for 'build' from /home/cookie/Downloads/tensorflow/.bazelrc: Inherited 'common' options: --experimental_repo_remote_exec ERROR: Unrecognized option: --experimental_repo_remote_exec

Community Topic https://community.clearlinux.org/t/steps-to-build-tensorflow/4612

lebensterben commented 4 years ago

Updating Bazel should help. The current Bazel in CL is very outdated.

0xA1B2 commented 4 years ago

Its not possible to build TF 2.2.0 on CL as GCC 10.1.x gives compiler errors.

https://github.com/tensorflow/tensorflow/issues/39467

lebensterben commented 4 years ago

Its not possible to build TF 2.2.0 on CL as GCC 10.1.x gives compiler errors. ...

@0xA1B2 you can install a old GCC via swupd

0xA1B2 commented 4 years ago

Build Tensorflow 2.2.0 from Source with Clear Linux 5.6.14-955

Get Tensorflow cd /home/docbrown/Downloads git clone https://github.com/tensorflow/tensorflow.git cd tensorflow

Checkout specific TF version if master is not wanted git checkout v2.2.0

./configure

Pip Packages pip install -U --user pip six numpy wheel setuptools mock 'future>=0.17.1' pip install -U --user keras_applications --no-deps pip install -U --user keras_preprocessing --no-deps

Bazel https://github.com/bazelbuild/bazelisk/releases download last version rename to bazel move to /usr/local/bin give all write and execute permissions

CPU Optimized Build https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html

Check CPU type gcc -march=native -Q --help=target

Native CPU arch with 2 Cores, O3 and half RAM usage bazel build --jobs 2 --local_ram_resources=*HOST_RAM0.5 --copt=-march=native --copt=-mtune=native --copt=-O3** --config=noaws --config=nogcp --config=nohdfs --config=nonccl --output_filter=DONT_MATCH_ANYTHING //tensorflow/tools/pip_package:build_pip_package

Example: Intel Atom Z3795 (Fujitsu Q55) - Silvermont

bazel build --jobs 2 --local_ram_resources=HOST_RAM*0.5 --copt=-march=silvermont --copt=-mtune=silvermont --copt=-O3 --config=noaws --config=nogcp --config=nohdfs --config=nonccl --output_filter=DONT_MATCH_ANYTHING //tensorflow/tools/pip_package:build_pip_package

Source Code Bug Fix: upb.c (multiple files) https://github.com/tensorflow/tensorflow/issues/39467

Create Wheel ./bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg

Install Wheel pip install /tmp/tensorflow_pkg/tensorflow*.whl

Test python LSTM_XOR.py