Cmake generate a valid Visual studio solution, but the GUI produces cmake error

Hi, I am try to set up a cmake script to make a library that add Cuda support to a library.

I managed to make script that generate the visual solution 2017 solution.
after ton of error and internet search found a set con cmake statement tha create a project that compile and runs a cuda kernel.
but there is one problem that seem no open knwo how to solve.

when I clear Generate in CMake, I get this error.

CMake Error in sdk/dExtensions/dCuda/CMakeLists.txt:
CUDA_ARCHITECTURES is empty for target “ndSolverCuda”.

but the VS solution does get generated and runs.
the question is what I am support to enter in CMake to fix that error,
and what doe sit mean, it does no seem that any body really knows what that is because all recommendations I found produce bigger errors that stop cmake for making the solution.

I am using cmake 3.9.0
and the relevant cmake instruction that make it generate a solution are theses.

cmake_minimum_required(VERSION 3.9.0 FATAL_ERROR)

set (projectName “ndSolverCuda”)
message (${projectName})

project(cmake_and_cuda LANGUAGES CXX CUDA)

alright by trial and erro I figure it out,
in case anyone has similar problem, the solution is

It seems I am not allow to ask more than more than one question, so I will post the next question here.

I have a problem complining the simplest of all lambda function.
here is the code sniped.

void ndDynamicsUpdateCuda::TestCudaKernel()
	int *aaa;
	int *bbb;
	int *ccc;

	int size = 100;
	cudaError_t cudaStatus;
	cudaStatus = cudaMalloc((void**)&aaa, size * sizeof(int));
	if (cudaStatus != cudaSuccess) 
		fprintf(stderr, "cudaMalloc failed!");

	cudaStatus = cudaMalloc((void**)&bbb, size * sizeof(int));
	if (cudaStatus != cudaSuccess)
		fprintf(stderr, "cudaMalloc failed!");

	cudaStatus = cudaMalloc((void**)&ccc, size * sizeof(int));
	if (cudaStatus != cudaSuccess)
		fprintf(stderr, "cudaMalloc failed!");

	auto addValue = [] __device__ (int a, int b){return a + b;};
	//addKernel <<<1, 1>>> (aaa, bbb, ccc, affValue);

and I get this error. error : The enclosing parent function (“TestCudaKernel”) for an extended device lambda cannot have private or protected access within its class

I can’t find information about that error anywhere, this is copied almost verbatim from one of the tutorials.
I found that information about lambdas with Cuda, is very sparse even in the official SDK and samples code, in fact every piece of information I found, has turned out to just being plain not useful.

in c++ that is a not brainer

auto addValue1 = [] (int a, int b) { return a + b; };
int x = addValue1(1, 2);

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.