首页 文章

使用SSE4.2和AVX编译TensorFlow失败并使用bazel

提问于
浏览
0

我已经安装了Tensorflow Bazel和MSYS,我尝试使用Win 10命令提示符中的以下命令使Tensorflow编译为支持 CPU extensions, such as SSE4.1, SSE4.2, AVX, AVX2, FMA

bazel build -c opt --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=- 
  mfpmath=both --copt=-msse4.2 --config=cuda -k 
 //tensorflow/tools/pip_package:build_pip_package

但它失败了以下错误:

C:\WINDOWS\system32>bazel build -c opt --copt=-mavx --copt=-mavx2 
--copt=-mfma --copt=-mfpmath=both --copt=-msse4.2 --config=cuda - 
 k //tensorflow/tools/pip_package:build_pip_package
 Bazel on Windows requires bash.exe and other Unix tools, but we 
could not find them.
If you do not have them installed, the easiest is to install 
 MSYS2 from
 http://repo.msys2.org/distrib/msys2-x86_64-latest.exe
 or git-on-Windows from
 https://git-scm.com/download/win

If you already have bash.exe installed but Bazel cannot find 
it,
set BAZEL_SH environment variable to its location:
set BAZEL_SH=c:\path\to\bash.exe
[bazel INFO src/main/cpp/blaze_util_windows.cc:1231] Cannot 
 open 
 HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\Git_is1
 [bazel ERROR src/main/cpp/blaze_util_windows.cc:1303] bash.exe 
 not found on PATH
 [bazel INFO src/main/cpp/blaze_util_windows.cc:1328] BAZEL_SH 
 detection took 0 msec, found

MSYS正常运行如下所示:

ippok@DESKTOP-4QMUDH4 MSYS ~
$

1 回答

  • 1

    错误消息告诉您该怎么做:将 BAZEL_SH envvar设置为bash.exe的路径 .

    要为当前cmd.exe会话设置它,请使用:

    set BAZEL_SH=c:\msys64\usr\bin\bash.exe
    

    为所有将来的cmd.exe会话(不是这个)设置它:

    setx BAZEL_SH "c:\msys64\usr\bin\bash.exe"
    

    如果您在其他位置安装了MSYS,请相应地更改这些命令 .

相关问题