Kernel Malloc sm_20


I am trying to compile a code that has a malloc function inside the kernel

and i get this error:

Error	5	error : calling a host function("malloc") from a __device__/__global__ function("bitapS") is not allowed	C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.0\C\src\str_bit\	36	1	str_bit

My command line is:

Error	6	error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe" -gencode=arch=compute_10,code=\"sm_10,compute_10\" -gencode=arch=compute_20,code=\"sm_20,compute_20\" --use-local-env --cl-version 2010 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64" -I"../../common/inc" -I"../../../shared/inc" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include"  -G0  --keep-dir "x64\Debug" -maxrregcount=0  --machine 64 --compile  -D_NEXUS_DEBUG -g    -Xcompiler "/EHsc /nologo /Od /Zi  /MTd " -o "x64/Debug/" "C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.0\C\src\str_bit\"" exited with code 2.	C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\CUDA 4.0.targets	357	10	str_bit

Any suggestions? I thought that with sm_20 enabled you could allocate… my card is a 460 GTX


In your command line you are also compiling the code for architecture 1.0. Maybe is it related with that?

Could you try compile only for architecture 2.0?

My 2 cents! :)

from the properties in visual studio i have removed the sm_10 and left only this: compute_20,sm_20 (in code generation choice)
Do you have any ideas of how to remove the inherited sm_10 arch?

ps. I am using CUDA 4 somewhere i read that you have to use new and delete in cuda 4 is this true?

You have to specify
also to your file!

Thanks anyway!