How do I add options to my nvcc using nsight eclipse. I tried to modify the command option Under Project->Properties->Build->Settings->Tool Settings-> NVCC Compiler. I changed it from "nvcc" to "nvcc --someoption". However when it compiles I see this output "/usr/local/cuda-7.0/bin/nvcc -O3 -ccbin gcc-4.9 -std=c++11 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_52,code=sm_52 -odir "." -M -o "binomial.d" "../binomial.cu"
Notice that --someoption in not in it. How can I add an option in eclipse? I also noticed that I can change the command from nvcc to some gibberish and it still compiles so I think that option does not affect anything. If so how can I add compiler options which eclipse does not include in its gui.
I would recommend using the -optf switch that is selectable under Project Settings... Build ... Settings...Tool Settings...Miscellaneous and add your own file to the project that contains whatever compiler switches you want to add.
I think most compiler switches are already covered in the GUI, however.
Related
I have been using cmake for a QNX 6.5 build which uses a qcc compiler. When I run make to build the project it does not show any errors (original project without the cmake did). This form was almost what I needed, but not quite. I tried to add the code below to my QNX_Toochian.cmake, but nothing happens. I suspect that it is because the qcc compiler needs a different flag then -Wall.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
I also found this website which talks about setting the warning levels, but I still don't understand how to format this for my QNX_Toolchain.cmake.
One other resource that I found that does configure a QNX_Toochain.cmake is here. They also are setting flags for there build, but I don't know how to simply what they have done.
SET(CMAKE_CXX_FLAGS "-Vgcc_ntoarmv7le -lang-c++ -fstack-protector -fstack-protector-all -Wno-psabi -Wall -W -D_REENTRANT" CACHE STRING "Playbook QCC C++ Flags" FORCE)
So if anyone has an idea of how to get a QNX qcc cmake project to display errors that is what I am looking for.
I am using Eclipse Luna in a Windows environment to write programs in C++. I compile with MinGW. I am also using OpenCV and libxml2.
My programs get compiled with these include paths:
g++ "-IC:\\MinGW\\include\\libxml2" ...
However, I need include paths for libxml, so what I want is:
g++ "-IC:\\MinGW\\include\\ibxml2" "-IC:\\opencv\\build\\include"
I tried to set this up under "project | Propterities | Tool Settings | GCC C++ Compiler" in the project properties:
-I"C:\opencv\build\include" -I"C:\MinGW\include\libxml2" -O0 -g3 -Wall -c -fmessage-length=0 -v
However, it only puts the first one in the actual compile command, according to the console.
It does work sometimes, though:
If I "Clean" the project and the build it, it will build without errors and even run from Windows Explorer or a prompt.
If I try to Run or Debug it from Eclipse, it will fail and have the problems described above.
If I "Clean" it and Run or Debug it, it will run fine in the Debug perspective, but will terminate without warning.
I try to create a new project with Eclipse Nsight but when I build the project I get:
nvcc fatal : Unsupported gpu architecture 'compute_21'.
In build setting i use Generate GPU code 2.1. The command build that Eclipse launches is:
Building file: ../src/prova.cu
Invoking: NVCC Compiler
/usr/local/cuda-5.5/bin/nvcc -G -g -O0 -gencode arch=compute_20,code=sm_20 -gencode arch=compute_20,code=sm_21 -odir "src" -M -o "src/prova.d" "../src/prova.cu"
/usr/local/cuda-5.5/bin/nvcc --compile -G -O0 -g -gencode arch=compute_20,code=compute_20 -gencode arch=compute_20,code=compute_21 -gencode arch=compute_20,code=sm_20 -x cu -o "src/prova.o" "../src/prova.cu"
If i change code=compute_21 with code=compute_20 I don't have any errors. How can I change this in Eclipse Nsight?
The arch command specifies a virtual architecture that will be used to generate the intermediate ptx.
The code command specifies the real architecture for which the code will be generated, either real executable code or PTX real-architecture-specific code.
compute_21 doesn't exist as a virtual architecture in both of them. If you want code for the real 21 architecture use arch=compute_20,code=sm_21
So it's a configuration problem; try with the Nsight import wizard for CUDA samples (source: https://devtalk.nvidia.com/default/topic/490324/issue-with-gencode-and-compute_21-results-in-unsupported-gpu-architecture/) and see if the problem persists.
I installed the latest CUDA toolkit available for Fedora 19 (cuda_5.5.22_linux_64.run) and experienced the same issue.
I think the problem was that I had changed the default install location. After reinstalling the CUDA toolkit in the default location (/usr/local/cuda-5.5) and deleting the cuda-workspace directory to let Eclipse Nsight recreate it, the problem has gone.
I'm trying to change the settings of g++ from the Code::Blocks IDE. I went to the Settings tab, clicked Compiler... and checked various options for the compiler to use, like
Enable all warnings (-Wall)
Have g++ follow the C++11 ISO C++ language standard (-std=c++11)
......
These are just two of many others; when I compile on the command line, here is what comes up:
g++ -o example example.cpp
# warning: initializer lists only available with -std=c++11 ...
Notice how there's no warning either - I have an unused variable in my program. It only works if I give the options manually:
g++ -Wall -std=c++11 -o example example.cpp
Do you think I might have done something wrong when setting up the compiler? Why aren't the options taking affect?
Invoking the compiler from the ide is completely independent from doing it in a command line shell. There's no reason for the setting and usage of one to have any effect on the other.
When linking my project in the release mode I am getting the following warning:
myProject-libs/release/libboost_regex-mt-s-1.50.0.a(cpp_regex_traits.o): duplicate section `.data$_ZZN5boost16cpp_regex_traitsIcE21get_catalog_name_instEvE6s_name[boost::cpp_regex_traits<char>::get_catalog_name_inst()::s_name]' has different size
I suspect that the cause could be that the boost library is compiled with different options than I use for my project, but I don't know how to find the difference (boost didn't output these options during the build).
In order to compile the boost for win32 on Ubuntu 12.04 I used this procedure:
tar jxf boost_1_50_0.tar.bz2
cd boost_1_50_0
./bootstrap.sh
echo "using gcc : 4.6 : i686-w64-mingw32-g++ : <rc>i686-w64-mingw32-windres <archiver>i686-w64-mingw32-ar ;" > user-config.jam
./bjam toolset=gcc target-os=windows --address-model=32 variant=release threading=multi threadapi=win32 link=static runtime-link=static --prefix=/opt/boost_1_50_0-release-static-windows-32 --user-config=user-config.jam -j 10 --without-mpi --without-python -sNO_BZIP2=1 -sNO_ZLIB=1 --layout=tagged install
In order to compile files in my project I use something like
i686-w64-mingw32-g++ -march=corei7 -mfpmath=sse -m32 -Wall -fmessage-length=0 -I"/opt/boost_1_50_0-release-static-windows-32/include" -std=c++0x -O3 -g0 -DNDEBUG -I"myProject/src/cpp" -c -o myProject/build/release/src/cpp/myproject.o myproject/src/cpp/myproject.cpp
The tests I have indicate that the regexps run fine but still I would like to resolve the warning.
EDIT
I found that additional options to the boost compiler can be added using a cxxflags= argument of bjam.
Example:
bjam cxxflags='-fPIC' ....
Maybe making sure to pass the same arguments as I do to the project could resolve the problem (particularly the arguments related to optimizations as suggested in the linked question).
Your compilers were compiled with different options :) Compiling the library on Linux and the program on Windows result in a situation where there is an identically named .data segment, but they aren't the same size. That could theoretically be interesting, inasmuch as a data segment is writable, but in practice, it shouldn't matter. Unless there is evidence to suggest this causes a problem of which I'm not aware, you can safely suppress that warning; I don't know how you'd make it go away, though.
I recently encountered this problem (i.e. linker warning "duplicate section has different size") when trying to compile boost for Windows using mingw.
The issue I had was that I compiled my application with -std=c++14 but when compiling boost I didn't specifically provide a dialect flag (which defaulted to -std=c++98 for g++ 5.3.0). Adding the dialect flag -std=c++14 when compiling boost solved the problem for me. See this answer for an explaination on how to set cxxflags when compiling boost.
I believe my solution might have worked for you (your application was compiled with -std=c++0x but boost was not provided any dialect flag). Although I am 6 years too late, I'll leave my answer here for others who happen to stumble-upon this issue.