Cuda atomicAdd_block is undefined

Hello In cmake build I have error

atomicAdd_block is undefined

I had found in stack overflow that one should set CMAKE_CUDA_ARCHITECTURES to at least 70 to avoid this problem, but in my case it still do not work

gpu atomics - CUDA atomicAdd_block is undefined - Stack Overflow

my cmake

cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
project(hello LANGUAGES CXX CUDA)
enable_language(CUDA)
set(CMAKE_CUDA_ARCHITECTURES 70)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -lineinfo -lcudadevrt")
add_executable(hello hello.cu  )
include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
target_link_libraries(${PROJECT_NAME} ${CUDA_LIBRARIES})

I have just one file hello.cu
I use CUDA 11.6

Try moving the:

before:

Thanks @Robert_Crovella for response yet problem persist

my includes

#include <cuda.h>
#include <cuda_runtime.h>
#include <cstdint>
#include <cooperative_groups.h>
#include <vector>
#include <cooperative_groups/reduce.h>
#include <cooperative_groups/memcpy_async.h>
#include <cmath>
#include <iostream>
#include <cmath>
#include <cstdint>
#include <assert.h>
#include "device_launch_parameters.h"

code causing problem (was working as visual studio project)

count = atomicAdd_block(&fpFnLocCounter[0], count);

cmake

cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
set(CMAKE_CUDA_ARCHITECTURES 70)
project(hello LANGUAGES CXX CUDA)
enable_language(CUDA)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -lineinfo -lcudadevrt")
add_executable(hello hello.cu  )
include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
target_link_libraries(${PROJECT_NAME} ${CUDA_LIBRARIES})

full repository for reference

https://github.com/jakubMitura14/HousdorffHDF5cMake

thanks for help !

Here is how I would try to resolve this.

(1) Get the code to compile with a simple sequence of command-line invocations of toolchain components. This could be as simple as a single invocation of nvcc with necessary command-line arguments.

(2) Dump the verbose details of the toolchain component invocation(s) produced by cmake. Identify all differences to the manual, working, build method.

(3) Identify where in cmake these differences originate. This part may require a lot of patience. You may want to ask cmake experts for help, rather than CUDA experts.

cmake and various IDEs have a tendency to construct command-line elements for the invocation of toolchain components in non-obvious and non-intuitive ways, which can lead to a lot of frustration when the programmer has a clear idea of what the commandline(s) should look like but needs to wrangle cmake into producing those commandlines. Basically the problem is the additional level of indirection. IMHO, a simple and straightforward alternative are classical makefiles.

1 Like

thanks for help it was sth related to my configuration, now I am trying to do this in the docker container