简体   繁体   English

CUDA NSight c ++ 11(Ubuntu 14.04)

[英]CUDA NSight c++11 (Ubuntu 14.04)

I read the CUDA Programming Guide and have looked at a number of links here including the following: Eclipse/Nsight (7.0) and C++11 support 我阅读了CUDA编程指南并查看了许多链接,包括以下内容: Eclipse / Nsight(7.0)和C ++ 11支持

But can't get things to work. 但是无法让事情发挥作用。 I'm using CUDA 7.O and the doc (CUDA Programming Guide, p.187) says that -std=cc++11 is supported for gcc >=4.7 & clang. 我正在使用CUDA 7.O和doc(CUDA编程指南,第187页)说gcc> = 4.7&clang支持-std = cc ++ 11。 Running using using gcc 4.8.2 (OS: Ubuntu 14.04) and despite going to Project -> Properties -> NVCC Compiler ->Build Settings -> Preprocessor options (-Xcompiler) and adding -std=c++11 I'm getting all kinds of errors. 使用gcc 4.8.2(操作系统:Ubuntu 14.04)运行,尽管转到项目 - >属性 - > NVCC编译器 - >构建设置 - >预处理器选项(-Xcompiler)并添加-std = c ++ 11我得到了各种错误。 See patial output from console below (at very bottom see "nullptr" is undefined). 请参阅下面控制台的patial输出(在最底部,请参见“nullptr”未定义)。 I've spent +5hrs looking at and trying a number of suggested solutions and at links the nvidia dev forum and on stackoverflow and have yet to find a resolution. 我已经花了+ 5小时查看并尝试了一些建议的解决方案,并在链接nvidia dev论坛和stackoverflow并且尚未找到解决方案。 Where do I set the flag properly? 我在哪里正确设置旗帜?

Partial console output: 部分控制台输出:

 1. 15:29:39 **** Build of configuration Debug for project
    Test-Dynamic-Parallelism-ComputeCap5 **** make all Building file:
    ../src/cdpAdvancedQuicksort.cu Invoking: NVCC Compiler
    /usr/local/cuda-7.0/bin/nvcc
    -I"/usr/local/cuda-7.0/samples/6_Advanced" -I"/usr/local/cuda-7.0/samples/common/inc" -G -g -O0 -v -Xcompiler -fPIC -Xcompiler -std=c++11 -gencode arch=compute_50,code=sm_50 -odir "src" -M -o "src/cdpAdvancedQuicksort.d" "../src/cdpAdvancedQuicksort.cu"
    #$ _SPACE_=
    #$ _CUDART_=cudart
    #$ _HERE_=/usr/local/cuda-7.0/bin
    #$ _THERE_=/usr/local/cuda-7.0/bin
    #$ _TARGET_SIZE_=
    #$ _TARGET_DIR_=
    #$ _TARGET_DIR_=targets/x86_64-linux
    #$ TOP=/usr/local/cuda-7.0/bin/..
    #$ NVVMIR_LIBRARY_DIR=/usr/local/cuda-7.0/bin/../nvvm/libdevice
    #$ LD_LIBRARY_PATH=/usr/local/cuda-7.0/bin/../lib::/usr/local/cuda-7.0/bin/../lib:/usr/local/cuda-7.0/bin/../lib64
    #$ PATH=/usr/local/cuda-7.0/bin/../open64/bin:/usr/local/cuda-7.0/bin/../nvvm/bin:/usr/local/cuda-7.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/cuda-7.0/bin:/usr/local/lib:/usr/local/cuda-7.0/bin
    #$ INCLUDES="-I/usr/local/cuda-7.0/bin/../targets/x86_64-linux/include"
    #$ LIBRARIES= "-L/usr/local/cuda-7.0/bin/../targets/x86_64-linux/lib/stubs"
    "-L/usr/local/cuda-7.0/bin/../targets/x86_64-linux/lib"
    --no_remove_unneeded_entities --debug_mode --device-c --gen_c_file_name "/tmp/tmpxft_00001a46_00000000-4_cdpAdvancedQuicksort.cudafe1.c"
    --stub_file_name "/tmp/tmpxft_00001a46_00000000-4_cdpAdvancedQuicksort.cudafe1.stub.c"
    --gen_device_file_name "/tmp/tmpxft_00001a46_00000000-4_cdpAdvancedQuicksort.cudafe1.gpu"
    --nv_arch "compute_50" --gen_module_id_file --module_id_file_name "/tmp/tmpxft_00001a46_00000000-3_cdpAdvancedQuicksort.module_id"
    --include_file_name "tmpxft_00001a46_00000000-2_cdpAdvancedQuicksort.fatbin.c"
    "/tmp/tmpxft_00001a46_00000000-7_cdpAdvancedQuicksort.cpp1.ii"
    /usr/lib/gcc/x86_64-linux
-gnu/4.8/include/stddef.h(432): error: identifier "nullptr" is undefined 

This is wrong: 这是错的:

-Xcompiler -std=c++11

Just use this, as a switch to nvcc : 只需使用它,作为切换到nvcc

-std=c++11

nvcc will handle the necessary upstream switches needed for gcc / g++ . nvcc将处理gcc / g++所需的必要上游交换机。

You can do this "automagically" in the CUDA 7 version of nsight eclipse edition, by going through the following sequence: 您可以通过以下顺序在CSUD 7版本的nsight eclipse版本中“自动”执行此操作:

Project...Properties...Build (expand sub-menu)...Settings...Tool Settings...NVCC Compiler (expand sub-menu)...Code Generation 项目...属性...构建(展开子菜单)...设置...工具设置... NVCC编译器(展开子菜单)...代码生成

and selecting the "Enable C++11 Support" checkbox. 并选中“启用C ++ 11支持”复选框。 (There are other ways, as well, such as just going to the "NVCC Compiler" page and adding the switch manually on "All options") (还有其他方法,例如只需进入“NVCC编译器”页面并在“所有选项”上手动添加开关)

Here: 这里:

nsight EE项目属性页面

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM