nvcc fatal : Value 'sm_13' is not defined for option 'gpu-architecture' - c++

I am writing, because I have a problem with the installation of lama and therein the compilation of CUDA. I followed the tutorial on this page
http://libama.sourceforge.net/doc/d5/de9/page_linuxinstallation.html
and the command "make" gives me the following error:
[Kraut#Wzmbx001 build44]$ make
Scanning dependencies of target log4lama
[ 0%] Building CXX object logging/CMakeFiles/log4lama.dir/GenLogger.cpp.o
[ 1%] Building CXX object logging/CMakeFiles/log4lama.dir/GenLoggerCreator.cpp.o
[ 1%] Building CXX object logging/CMakeFiles/log4lama.dir/Level.cpp.o
[ 2%] Building CXX object logging/CMakeFiles/log4lama.dir/Logger.cpp.o
[ 2%] Building CXX object logging/CMakeFiles/log4lama.dir/LoggerProvider.cpp.o
[ 3%] Building CXX object logging/CMakeFiles/log4lama.dir/SourceLocation.cpp.o
Linking CXX shared library liblog4lama.so
[ 3%] Built target log4lama
[ 3%] Building NVCC (Device) object lama/cuda/CMakeFiles/cuda_compile.dir//./cuda_compile_generated_CUDACOOUtils.cu.o
nvcc fatal : Value 'sm_13' is not defined for option 'gpu-architecture'
CMake Error at cuda_compile_generated_CUDACOOUtils.cu.o.cmake:202 (message):
Error generating
/opt/OpenFOAM/lama/build44/lama/cuda/CMakeFiles/cuda_compile.dir//./cuda_compile_generated_CUDACOOUtils.cu.o
make[2]: *** [lama/cuda/CMakeFiles/cuda_compile.dir/./cuda_compile_generated_CUDACOOUtils.cu.o] Error 1
make[1]: *** [lama/cuda/CMakeFiles/amacuda.dir/all] Error 2
make: *** [all] Error 2
I looked for solutions to this problem and found these three answers, which seem to be closest to my problem:
https://devtalk.nvidia.com/default/topic/762051/jetson-tk1/compile-issues/?offset=4#4786865
How can i tell PyCUDA which GPU to use?
http://sourceforge.net/p/viennacl/mailman/message/34316211/
In these threads it is mentioned, that one should change or comment out the "-arch=sm_13"-option in a "Makefile" or a file "~.cmake". However I have no idea where to find this file, where I can modify this option. Can anybody help and guide me to where this file is located?
The problem appears to be quite common, since this option refers to the gpu-architecture supported by CUDA. I have CUDA-7.5 on my system, so from searching for a solution to this issue I understand, that sm_13 is not supported anymore. So I hope changing this will solve this problem - Just need to know where!

It would appear that the supported architectures are defined here in CompilerFlags.cmake :
### choosing the right compute capability
### we just start from version 1.3 ( 1.0 - 1.2 is not supported )
LIST ( APPEND CC_CHOICES "13" "20" "21" "30" "35" )
set ( CUDA_COMPUTE_CAPABILITY "13" CACHE STRING "CUDA compute capability (supported up from 13)" )
set ( CACHE CUDA_COMPUTE_CAPABILITY PROPERTY STRINGS ${CC_CHOICES} )
checkValue( ${CUDA_COMPUTE_CAPABILITY} "${CC_CHOICES}" )
mark_as_advanced ( CUDA_COMPUTE_CAPABILITY )
modify those as required

Related

cmake error when i have tried to build a compilining?

i have tried to compline a repository via "https://github.com/giglio0/DRAGON-G4-LaBr3.git" but while the compiling, i have taken a error. I don't Know why it is? i am not a coder. Just i want to build this repository and run the simulation with changing some parameters. The error output is;
Scanning dependencies of target LaBr3_v4
[ 9%] Building CXX object CMakeFiles/LaBr3_v4.dir/LaBr3_v4.cc.o
[ 18%] Building CXX object CMakeFiles/LaBr3_v4.dir/src/DetectorConstruction.cc.o
[ 27%] Building CXX object CMakeFiles/LaBr3_v4.dir/src/DetectorMessenger.cc.o
[ 36%] Building CXX object CMakeFiles/LaBr3_v4.dir/src/EventAction.cc.o
[ 45%] Building CXX object CMakeFiles/LaBr3_v4.dir/src/HistoManager.cc.o
/home/cancan/Gatev9/example_Geant4/LaBr/LaBr3/src/HistoManager.cc:29:10: fatal error: TH1D.h: No such file or directory
29 | #include <TH1D.h>
| ^~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/LaBr3_v4.dir/build.make:134: CMakeFiles/LaBr3_v4.dir/src/HistoManager.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/LaBr3_v4.dir/all] Error 2
make: *** [Makefile:149: all] Error 2
can anybody help me?
Apparently you need to install the ROOT library, see: https://root.cern.ch/doc/master/classTH1.html
BTW, the READ.me of the application you want to compile, DRAGON-G4-LaBr3, is awful.
After your advice, i install root-6.22.06 again with use this command;
cmake -DCMAKE_INSTALL_PREFIX=/home/cancan/Gatev9/root-6.22.06-install /home/cancan/Gatev9/root-6.22.06 -Dall=ON
i learned from somewhere if i use "-Dall=ON", i can install all libraries of root but it has not still worked.

Cannot find lpublic library

Trying to compile my project on Centos 8.2 using cmake 3.12, im facing with the following error:
cannot find -lpublic
here is full log:
[ 20%] Building CXX object CMakeFiles/ .cpp.o
[ 40%] Building CXX object CMakeFiles/ .cpp.o
[ 60%] Linking CXX shared library .so
[ 60%] Built target myproj
Scanning dependencies of target nist01
[ 80%] Building CXX object CMakeFiles/ .cpp.o
[100%] Linking CXX executable
/usr/bin/ld: cannot find -lpublic
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/nist01.dir/build.make:85: ...] Error 1
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/...] Error 2
make: *** [Makefile:84: all] Error 2
Tried to find something on the internet, but nothing shown up.
Thanks for your help.
That seems like you try to link against the target "public", which is a suspicious target name. It might be target_link_libraries command with lowercase public instead of uppercase one, like target_link_libraryies(nist01 public something) instead of target_link_libraries(nist01 PUBLIC something).

Zephyr build error when trying to switch board target

I am trying to build zephyr sample code that is meant for board A for board B (i.e. build was written for code A but I need to change it so that it works with board B). I keep coming across this error and I am not sure how to get past it. I have replaced the /board, /soc, and /dts subfolders with appropriate files for my board. I changed the Makefile to target my board and it is successfully finding it.
This is the error:
cmake -B build -DBOARD=my_project_name ./
-- Using out-of-tree SOC definition
-- Zephyr version: 2.2.0
-- Found PythonInterp: /opt/homebrew/bin/python3.6 (found suitable version "3.6.2", minimum required is "3.6")
-- git describe failed: fatal: Not a git repository (or any of the parent directories): .git;
BUILD_VERSION is left undefined
-- Selected BOARD my_project_name
-- Found west: /usr/local/bin/west (found suitable version "0.7.2", minimum required is "0.6.0")
-- Loading /Users/my_name/file_dir/Firmware/projects/my_project_name/boards/arm/my_project_name/my_project_name.dts as base
Devicetree header saved to '/Users/my_name/file_dir/Firmware/projects/my_project_name/build/zephyr/include/generated/devicetree_unfixed.h'
Parsing /Users/my_name/third-party/zephyr/zephyr_rtos/v2.2.0/zephyr/Kconfig
Loaded configuration '/Users/my_name/file_dir/Firmware/projects/my_project_name/boards/arm/my_project_name/my_project_name_defconfig'
Merged configuration '/Users/my_name/file_dir/Firmware/projects/my_project_name/prj.conf'
Configuration saved to '/Users/my_name/file_dir/Firmware/projects/my_project_name/build/zephyr/.config'
Kconfig header saved to '/Users/my_name/file_dir/Firmware/projects/my_project_name/build/zephyr/include/generated/autoconf.h'
-- The C compiler identification is GNU 8.2.1
-- The CXX compiler identification is GNU 8.2.1
-- The ASM compiler identification is GNU
-- Found assembler: /Users/my_name/file_dir/third-party/toolchains/gcc-arm-none-eabi-8-2018/arm-gcc-macos/bin/arm-none-eabi-gcc
-- Cache files will be written to: /Users/my_name/Library/Caches/zephyr
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/my_name/file_dir/Firmware/projects/my_project_name/build
make -C build
Scanning dependencies of target driver_validation_h_target
[ 1%] Generating include/generated/driver-validation.h
[ 1%] Built target driver_validation_h_target
Scanning dependencies of target kobj_types_h_target
[ 2%] Generating include/generated/kobj-types-enum.h, include/generated/otype-to-str.h
[ 2%] Built target kobj_types_h_target
Scanning dependencies of target syscall_list_h_target
[ 2%] Generating misc/generated/syscalls.json
[ 3%] Generating include/generated/syscall_dispatch.c, include/generated/syscall_list.h
[ 5%] Built target syscall_list_h_target
Scanning dependencies of target offsets
[ 6%] Building C object zephyr/CMakeFiles/offsets.dir/arch/arm/core/offsets/offsets.c.obj
In file included from /Users/my_name/file_dir/third-party/zephyr/zephyr_rtos/v2.2.0/zephyr/arch/arm/include/aarch32/cortex_m/stack.h:23,
from /Users/my_name/file_dir/third-party/zephyr/zephyr_rtos/v2.2.0/zephyr/arch/arm/include/kernel_arch_data.h:33,
from /Users/my_name/file_dir/third-party/zephyr/zephyr_rtos/v2.2.0/zephyr/arch/arm/core/offsets/offsets_aarch32.c:26,
from /Users/my_name/file_dir/third-party/zephyr/zephyr_rtos/v2.2.0/zephyr/arch/arm/core/offsets/offsets.c:12:
/Users/my_name/file_dir/third-party/zephyr/zephyr_rtos/v2.2.0/zephyr/include/arch/arm/aarch32/cortex_m/cmsis.h:92:2: error: #error "DT_NUM_IRQ_PRIO_BITS and __NVIC_PRIO_BITS are not set to the same value."
#error "DT_NUM_IRQ_PRIO_BITS and __NVIC_PRIO_BITS are not set to the same value."
^~~~~
make[3]: *** [zephyr/CMakeFiles/offsets.dir/arch/arm/core/offsets/offsets.c.obj] Error 1
make[2]: *** [zephyr/CMakeFiles/offsets.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [zephyr_project] Error 2
I have already checked to make sure that soc.h has #include <devicetree.h>. I'm not sure what else I can try now so any help is appreciated. Thanks!
Found the solution: I had to add dts_fixup.h to the bottom of my soc folder.

"Conversion to non-scalar type is requested" error on linux terminal using cmake

I faced an issue when i try to generate CodeLite using CMake. I encountered it during 'make -j4' step. it shows "Conversion to non-scalar type is requested".
'''
[ 68%] Built target codelitephp
[ 68%] Built target codelite-make
[ 69%] Built target codelite-terminal
[ 83%] Built target wxCrafter
[ 83%] [ 83%] [ 83%] Building CXX object LiteEditor/CMakeFiles/codelite.dir/CompilerMainPage.cpp.o
Building CXX object LiteEditor/CMakeFiles/codelite.dir/CompilersFoundDlgBase.cpp.o
Building CXX object LiteEditor/CMakeFiles/codelite.dir/CompilersFoundDlg.cpp.o
[ 83%] Building CXX object LiteEditor/CMakeFiles/codelite.dir/CompilersFoundDlg_liteeditor_bitmaps.cpp.o
[ 83%] Building CXX object LiteEditor/CMakeFiles/codelite.dir/CompilersModifiedDlg.cpp.o
/home/osboxes/Desktop/codelite-13.0/LiteEditor/CompilerMainPage.cpp: In member function ‘void CompilerMainPage::InitializeTools()’:
/home/osboxes/Desktop/codelite-13.0/LiteEditor/CompilerMainPage.cpp:543:76: error: conversion from ‘wxPGIterator<wxPGProperty,wxPropertyGridPageState>’ to non-scalar type ‘wxPGIterator<const wxPGProperty,const wxPropertyGridPageState>’ requested
wxPropertyGridConstIterator iter = m_pgMgrTools->GetGrid()->GetIterator();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
[ 83%] Building CXX object LiteEditor/CMakeFiles/codelite.dir/ConfigManagerBaseDlg.cpp.o
make[2]: *** [LiteEditor/CMakeFiles/codelite.dir/CompilerMainPage.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [LiteEditor/CMakeFiles/codelite.dir/all] Error 2
make: *** [all] Error 2
'''
Anyone can help me resolve the issue? I followed this GitHub link. It seems like there might be something wrong with the 'cmake' step. Greatly appreciate it if anyone can help me solve it!
This problem doesn't seem to be related to CMAKE rather than to the actual compilation.
I don't know the library personally but as far as I can tell from the wiki page you shared, it seems maybe those instructions might be outdated because it's dated from 2018 but there's recent changes in the library.
I would check the dependencies versions to see if they match with the one that the maintainer specifies in the README.md
I had similar problem when trying to compile CodeLite 13 on CentOS 7.6 clone OS. Manage to solve it by replacing following code string on line 543 of CompilerMainPage.cpp file,
located in "LiteEditor" subfolder:
wxPropertyGridConstIterator iter = m_pgMgrTools->GetGrid()->GetIterator();
by following code statement:
const wxPropertyGrid* pgrid = m_pgMgrTools->GetGrid();
wxPropertyGridConstIterator iter = pgrid->GetIterator();
Save that file and repeat compilation. In my case issue was solved and I could use now CodeLite 13 for my development projects (unfortunately CodeLite not available in rpm format for CentOS 7.x)

dynamic library creation when installing with Cmake

I've been trying to install a package called DAKOTA, which employs BOOST and Trilinos libraries which I'm already using in another program. For compiling and linking I'm using cmake, but I have not been able to pass the make step. It would be very helpful perhaps if you could point me out into some direction. Please find below the cmake command script I'm using to compile and link the libraries, and the process when it stops...
As far as I have understood is the following. I'm using Boost and Trilinos library files used to build the other program to built the project DAKOTA. But I get an error when creating the library file liboptpp.so from Teuchos_BLAS.cpp.o, because it-s being used by libteuchosnumerics.a. I'm not sure if I'm understanding it correctly, but what I got from this is that I need to create a shared library and recompile the Teuchos_BLAS.cpp.o again using -fPIC.
I tried including -fPIC in CMAKE_CXX_FLAGS as you may see below, and also -shared in CMAKE_SHARED_LINKER_FLAGS but this doesn't seem to work. In the past I also tried adding -fPIC in all flags from the CMakeCache.txt but also did not work.
Please let me know your understanding and suggestions.
Thank you very much in advance,
CMAKE COMMAND
! /bin/bash
cmake \
-D CMAKE_INSTALL_PREFIX=/home/pablo/BuildDakota/build \
-D MPI_BASE_DIR:PATH="/usr/lib/openmpi/" \
-D CMAKE_CXX_FLAGS:STRING="-O0 -std=c++11 -pedantic -ftrapv -Wall -fPIC -Wno-long-long" \
-D BOOST_ROOT:PATH=/home/pablo/BuildPeridigm/ \
-D Boost_NO_BOOST_CMAKE:BOOL=TRUE \
-D Boost_NO_SYSTEM_PATHS:BOOL=TRUE \
-D Trilinos_DIR:PATH=/home/pablo/BuildPeridigm/lib/cmake/Trilinos/ \
-D CMAKE_SHARED_LINKER_FLAGS:STRING="-shared" \
/home/pablo/BuildDakota/dakota-6.7.0.src
PROCESS
[ 9%] Building C object packages/external/OPTPP/src/CMakeFiles/optpp.dir/PDS/sort.c.o
[ 9%] Building C object packages/external/OPTPP/src/CMakeFiles/optpp.dir/PDS/writes.c.o
[ 10%] Building CXX object packages/external/OPTPP/src/CMakeFiles/optpp.dir/Utils/BoolVector.C.o
[ 10%] Building C object packages/external/OPTPP/src/CMakeFiles/optpp.dir/Utils/file_cutils.c.o
[ 10%] Building CXX object packages/external/OPTPP/src/CMakeFiles/optpp.dir/Utils/ioformat.C.o
[ 10%] Building CXX object packages/external/OPTPP/src/CMakeFiles/optpp.dir/Utils/mcholesky.C.o
[ 10%] Building CXX object packages/external/OPTPP/src/CMakeFiles/optpp.dir/Utils/OptppExceptions.C.o
[ 10%] Building CXX object packages/external/OPTPP/src/CMakeFiles/optpp.dir/Utils/OptppFatalError.C.o
[ 10%] Building CXX object packages/external/OPTPP/src/CMakeFiles/optpp.dir/Utils/print.C.o
[ 10%] Building C object packages/external/OPTPP/src/CMakeFiles/optpp.dir/Utils/timers.c.o
[ 10%] Linking CXX shared library ../lib/liboptpp.so
/usr/bin/ld: /home/pablo/BuildPeridigm/lib/libteuchosnumerics.a(Teuchos_BLAS.cpp.o): relocation R_X86_64_32S against `_ZN7Teuchos11ETranspCharE' can not be used when making a shared object; recompile with -fPIC
/home/pablo/BuildPeridigm/lib/libteuchosnumerics.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
packages/external/OPTPP/src/CMakeFiles/optpp.dir/build.make:2264: recipe for target 'packages/external/OPTPP/lib/liboptpp.so' failed
make[2]: *** [packages/external/OPTPP/lib/liboptpp.so] Error 1
CMakeFiles/Makefile2:1409: recipe for target 'packages/external/OPTPP/src/CMakeFiles/optpp.dir/all' failed
make[1]: *** [packages/external/OPTPP/src/CMakeFiles/optpp.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
I tried including -fPIC in CMAKE_CXX_FLAGS as you may see below, and
also -shared in CMAKE_SHARED_LINKER_FLAGS but this doesn't seem to
work.
Don't do this. Adding low-level compiler flags manually is almost always a bad idea in CMake.
The general approach to request a project to build as a dynamic library is to set the BUILD_SHARED_LIBS option of the project:
cmake -DBUILD_SHARED_LIBS=ON [...]
If this doesn't work right away, it usually means that the project was not intended to be built as a dynamic library, in which case there is no easy solution.
Dakota, for instance, claims to support this option properly.
If this doesn't work, you can try playing around with options like CMAKE_POSITION_INDEPENDENT_CODE, but your chances of success will not be very high. You should probably contact the library maintainer for advice in this case.