gpt4 book ai didi

c++ - tensorflow 错误此文件需要编译器和库支持 ISO C++ 2011 标准

转载 作者:行者123 更新时间:2023-12-01 14:36:45 29 4
gpt4 key购买 nike

结果如下,我运行项目stylegan2,但是失败了。所以我需要帮助。链接是https://github.com/NVlabs/stylegan2

File "/home/ubuntu/workspaces/workspace_lsh/stylegan2/dnnlib/tflib/network.py",    line 154, in _init_graph    out_expr = self._build_func(*self.input_templates, **build_kwargs)   
File "<string>", line 491, in G_synthesis_stylegan2 File "<string>", line 455, in layer
File "<string>", line 99, in modulated_conv2d_layer File "<string>", line 68, in apply_bias_act
File "/home/ubuntu/workspaces/workspace_lsh/stylegan2/dnnlib/tflib/ops/fused_bias_act.py", line 68, in fused_bias_act return impl_dict[impl](x=x, b=b, axis=axis, act=act, alpha=alpha, gain=gain)
File "/home/ubuntu/workspaces/workspace_lsh/stylegan2/dnnlib/tflib/ops/fused_bias_act.py", line 122, in _fused_bias_act_cuda cuda_kernel = _get_plugin().fused_bias_act
File "/home/ubuntu/workspaces/workspace_lsh/stylegan2/dnnlib/tflib/ops/fused_bias_act.py", line 16, in _get_plugin return custom_ops.get_plugin(os.path.splitext(__file__)[0] + '.cu')
File "/home/ubuntu/workspaces/workspace_lsh/stylegan2/dnnlib/tflib/custom_ops.py", line 111, in get_plugin _run_cmd(_prepare_nvcc_cli('"%s" --preprocess -o "%s" --keep --keep-dir "%s"' % (cuda_file, tmp_file, tmp_dir)))
File "/home/ubuntu/workspaces/workspace_lsh/stylegan2/dnnlib/tflib/custom_ops.py", line 61, in _run_cmd raise RuntimeError('NVCC returned an error. See below for full command line and output log:\n\n%s\n\n%s' % (cmd, output)) RuntimeError: NVCC returned an error. See below for full command line and output log:
nvcc "/home/ubuntu/workspaces/workspace_lsh/stylegan2/dnnlib/tflib/ops/fused_bias_act.cu" --preprocess -o "/tmp/tmph2fk0y_4/fused_bias_act_tmp.cu" --keep --keep-dir "/tmp/tmph2fk0y_4" --disable-warnings --include-path "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tensorflow_core/include"
--include-path "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tensorflow_core/include/external/protobuf_archive/src"
--include-path "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tensorflow_core/include/external/com_google_absl"
--include-path "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tensorflow_core/include/external/eigen_archive" 2>&1
In file
included from /usr/include/c++/5/unordered_map:35:0,
from /home/ubuntu/anaconda3/lib/python3.7/site-packages/tensorflow_core/include/tensorflow/core/framework/op.h:20,
from /home/ubuntu/workspaces/workspace_lsh/stylegan2/dnnlib/tflib/ops/fused_bias_act.cu:9:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options. #error This file requires compiler and library support \ ^ In file included from /home/ubuntu/anaconda3/lib/python3.7/site-packages/tensorflow_core/include/absl/base/config.h:66:0,
/home/ubuntu/anaconda3/lib/python3.7/site-packages/tensorflow_core/include/absl/base/policy_checks.h:77:2: error: #error "C++ versions less than C++11 are not supported." #error "C++ versions less than C++11 are not supported."

我需要帮助。

最佳答案

我遇到了同样的错误。一个讨厌的解决方法是添加标志 --std=c++11-DNDEBUGnvcc调用 dnnlib/tflib/custom_ops.py ln 64 :

cmd = 'nvcc --std=c++11 -DNDEBUG ' + opts.strip()

为什么同时使用--std 和-DNDEBUG?

刚刚 --std=c++11给了我以下错误:

RuntimeError: NVCC returned an error. See below for full command line and output log:

nvcc --std=c++11 "/usr/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so" --compiler-options '-fPIC -D_GLIBCXX_USE_CXX11_ABI=0' --gpu-architecture=sm_75 --use_fast_math --disable-warnings --include-path "/usr/lib/python3.6/site-packages/tensorflow/include" --include-path "/usr/lib/python3.6/site-packages/tensorflow/include/external/protobuf_archive/src" --include-path "/usr/lib/python3.6/site-packages/tensorflow/include/external/com_google_absl" --include-path "/usr/lib/python3.6/site-packages/tensorflow/include/external/eigen_archive" 2>&1 "/home/username/stylegan2/dnnlib/tflib/ops/fused_bias_act.cu" --shared -o "/tmp/tmp8nryqyhs/fused_bias_act_tmp.so" --keep --keep-dir "/tmp/tmp8nryqyhs"

/usr/lib/python3.6/site-packages/tensorflow/include/absl/strings/string_view.h(495): error: constexpr function return is non-constant

1 error detected in the compilation of "/tmp/tmp8nryqyhs/fused_bias_act.cpp1.ii".



这是通过使用标志 -DNDEBUG 来阻止的, as explained in this git thread .

解决方案很丑,作者通过提供更多输入选项或其他东西(或解释如何做)来解决这个问题会很酷。但就目前而言,它会做到。

我的环境:
Python 3.6.9 
tensorflow.__version__
'1.14.0'

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sat_Aug_25_21:08:01_CDT_2018
Cuda compilation tools, release 10.0, V10.0.130

g++ (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

关于c++ - tensorflow 错误此文件需要编译器和库支持 ISO C++ 2011 标准,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59342888/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com