'cudafe++' died with status 0xC0000005 (ACCESS_VIOLATION)

I’m trying to compile this program:

global void cuda_hello(){

printf("Hello World from GPU!\n");

}

int main() {

cuda_hello<<<1,1>>>();

return 0;

}’
But I’m getting the following error:
cudafe++’ died with status 0xC0000005 (ACCESS_VIOLATION)

GPU: gtx 1650
OS : Win 11
CUDA : v11.6

This is unlikely to be a latent issue in CUDA. My guess would be that the problem is some sort of installation problem - e.g. out of disk space, not having permissions for various directories (for example compiling code in a directory structure you don’t have write access to), incorrect install location, etc. There’s not enough information here to diagnose the problem, and I wouldn’t be able to give you a recipe of all the things to check. There may also be some sort of unexpected project setting. Are you able to compile successfully one of the CUDA sample projects using the supplied project file?

A few things I noticed are:

  • you don’t have a #include <cstdio> statement or similar, which is needed for printf, but you may have that in your actual test case, and I think in windows it may be included automatically.

  • You have a single quote at the end of your posted code: ’

  • Your code is not formatted properly (see here for typical instructions

I don’t think any of those statement are related to the cudafe++ issue.

Historically, the most common reason for this particular kind of error in this particular toolchain component has been the mixing of a toolchain from one CUDA version with the header files from a different CUDA version.

Hello!
I ran this on visual studio and got a more detailed error along with the access violation error:

Severity Code Description Project File Line Suppression State
Error MSB3722 The command C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\bin\nvcc.exe -gencode=arch=compute_52,code=\sm_52,compute_52\ --use-local-env -ccbin D:\Program Files\vs\VC\Tools\MSVC\14.31.31103\bin\HostX64\x64 -x cu -IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\include -IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\include -G --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -g -DWIN32 -DWIN64 -D_DEBUG -D_CONSOLE -D_MBCS -Xcompiler /EHsc /W3 /nologo /Od /Fdx64\Debug\vc143.pdb /FS /Zi /RTC1 /MDd -o D:\notes\pcap\cuda\proj\CudaRuntime1\CudaRuntime1\x64\Debug\kernel.cu.obj D:\notes\pcap\cuda\proj\CudaRuntime1\CudaRuntime1\kernel.cu exited with code 5. Please verify that you have sufficient rights to run this command. CudaRuntime1 D:\Program Files\vs\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 11.6.targets 790

Please help me if u can

Hello, thanks for the reply! Do you know how I can solve this issue, or diagnose it?

If you don’t want to answer the questions I ask, I won’t be able to help you. Perhaps someone else will know what to do.

I am not able to compile the sample code as well

My hypothesis is that you either have an incomplete or corrupted installation of CUDA, or a configuration issue (e.g. environment variables) that cause mixing of components from multiple installed CUDA versions.

If you only ever installed one CUDA version, that would eliminate the possibility of the latter scenario. De-installing and wiping the current CUDA installation, then re-installing CUDA would address the former scenario. When doing so, make sure there is sufficient disk space (in the partition you are installing in) and your user account has the necessary operating system permissions for installing software.

1 Like

I reinstalled and installed cuda 11.6 multiple times and it still gives me the error. I also tried installing cuda 10.2 after uninstalling 11 but gave me the same error. Cuurently i have only 11.6 version

Multiple CUDA versions reporting an access violation in cudafe++is a very strange scenario. I would suggest double checking available disk space and file permissions. I have no additional ideas. It is difficult to diagnose these issues over the internet.

Thank you any way, :(