• <i id='VhI3T'><tr id='VhI3T'><dt id='VhI3T'><q id='VhI3T'><span id='VhI3T'><b id='VhI3T'><form id='VhI3T'><ins id='VhI3T'></ins><ul id='VhI3T'></ul><sub id='VhI3T'></sub></form><legend id='VhI3T'></legend><bdo id='VhI3T'><pre id='VhI3T'><center id='VhI3T'></center></pre></bdo></b><th id='VhI3T'></th></span></q></dt></tr></i><div id='VhI3T'><tfoot id='VhI3T'></tfoot><dl id='VhI3T'><fieldset id='VhI3T'></fieldset></dl></div>
  • <small id='VhI3T'></small><noframes id='VhI3T'>

      <bdo id='VhI3T'></bdo><ul id='VhI3T'></ul>

    <legend id='VhI3T'><style id='VhI3T'><dir id='VhI3T'><q id='VhI3T'></q></dir></style></legend><tfoot id='VhI3T'></tfoot>

        为什么 nvcc 无法使用 boost::spirit 编译 CUDA 文件?

        时间:2023-07-20
          <tbody id='KUKnd'></tbody>

            <bdo id='KUKnd'></bdo><ul id='KUKnd'></ul>

          • <i id='KUKnd'><tr id='KUKnd'><dt id='KUKnd'><q id='KUKnd'><span id='KUKnd'><b id='KUKnd'><form id='KUKnd'><ins id='KUKnd'></ins><ul id='KUKnd'></ul><sub id='KUKnd'></sub></form><legend id='KUKnd'></legend><bdo id='KUKnd'><pre id='KUKnd'><center id='KUKnd'></center></pre></bdo></b><th id='KUKnd'></th></span></q></dt></tr></i><div id='KUKnd'><tfoot id='KUKnd'></tfoot><dl id='KUKnd'><fieldset id='KUKnd'></fieldset></dl></div>

              <small id='KUKnd'></small><noframes id='KUKnd'>

            1. <tfoot id='KUKnd'></tfoot>

              <legend id='KUKnd'><style id='KUKnd'><dir id='KUKnd'><q id='KUKnd'></q></dir></style></legend>

                • 本文介绍了为什么 nvcc 无法使用 boost::spirit 编译 CUDA 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试将 CUDA 集成到使用 boost::spirit 的现有应用程序中.

                  I'm trying to integrate CUDA to an existing aplication wich uses boost::spirit.

                  隔离问题,我发现以下代码不能与 nvcc copile:

                  Isolating the problem, I've found out that the following code does not copile with nvcc:

                  main.cu:

                  #include <boost/spirit/include/qi.hpp>
                  int main(){
                      exit(0);
                  }
                  

                  使用 nvcc -o cudaTest main.cu 编译我得到了很多可以看到的错误 这里.

                  Compiling with nvcc -o cudaTest main.cu I get a lot of errors that can be seen here.

                  但是如果我将文件名更改为 main.cpp,然后使用 nvcc 再次编译,它就可以工作了.这里发生了什么,我该如何解决?

                  But if I change the filename to main.cpp, and compile again using nvcc, it works. What is happening here and how can I fix it?

                  推荐答案

                  nvcc 有时在编译 Boost 等复杂模板代码时会遇到麻烦,即使该代码仅在 中使用__host__ 函数.

                  nvcc sometimes has trouble compiling complex template code such as is found in Boost, even if the code is only used in __host__ functions.

                  当文件的扩展名是 .cpp 时,nvcc 不会自行解析,而是将代码转发到主机编译器,这就是为什么您会观察到不同的行为,具体取决于文件扩展名.

                  When a file's extension is .cpp, nvcc performs no parsing itself and instead forwards the code to the host compiler, which is why you observe different behavior depending on the file extension.

                  如果可能,尝试将依赖于 Boost 的代码隔离到不需要被 nvcc 解析的 .cpp 文件中.

                  If possible, try to quarantine code which depends on Boost into .cpp files which needn't be parsed by nvcc.

                  我还要确保尝试使用最近的 nvcc">CUDA 4.1.nvcc 的模板支持随着每个版本的发布而改进.

                  I'd also make sure to try the nvcc which ships with the recent CUDA 4.1. nvcc's template support improves with each release.

                  这篇关于为什么 nvcc 无法使用 boost::spirit 编译 CUDA 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用 boost::iostreams::mapped_file_source 和 std::multimap 下一篇:是大括号可构造的类型特征

                  相关文章

                • <legend id='KLmk9'><style id='KLmk9'><dir id='KLmk9'><q id='KLmk9'></q></dir></style></legend>
                  <i id='KLmk9'><tr id='KLmk9'><dt id='KLmk9'><q id='KLmk9'><span id='KLmk9'><b id='KLmk9'><form id='KLmk9'><ins id='KLmk9'></ins><ul id='KLmk9'></ul><sub id='KLmk9'></sub></form><legend id='KLmk9'></legend><bdo id='KLmk9'><pre id='KLmk9'><center id='KLmk9'></center></pre></bdo></b><th id='KLmk9'></th></span></q></dt></tr></i><div id='KLmk9'><tfoot id='KLmk9'></tfoot><dl id='KLmk9'><fieldset id='KLmk9'></fieldset></dl></div>

                  • <bdo id='KLmk9'></bdo><ul id='KLmk9'></ul>

                  1. <small id='KLmk9'></small><noframes id='KLmk9'>

                    <tfoot id='KLmk9'></tfoot>