How to compile Tensorflow with SSE4.2 and AVX instructions?

前端 未结 12 743
南笙
南笙 2020-11-22 04:14

This is the message received from running a script to check if Tensorflow is working:

I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUD         


        
12条回答
  •  太阳男子
    2020-11-22 04:46

    Thanks to all this replies + some trial and errors, I managed to install it on a Mac with clang. So just sharing my solution in case it is useful to someone.

    1. Follow the instructions on Documentation - Installing TensorFlow from Sources

    2. When prompted for

      Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native]

    then copy-paste this string:

    -mavx -mavx2 -mfma -msse4.2
    

    (The default option caused errors, so did some of the other flags. I got no errors with the above flags. BTW I replied n to all the other questions)

    After installing, I verify a ~2x to 2.5x speedup when training deep models with respect to another installation based on the default wheels - Installing TensorFlow on macOS

    Hope it helps

提交回复
热议问题