cuda unified memory acess violation

0

error at line 19 when printing out. everywhere in the net is same example how to use unified memory. but i get that error. searched everywhere. feel like i missed something about cuda setup and need something to change in settings but dont know what.

windows 7 x64

visual studio 2013

cuda 7

gtx 970

#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>

__global__ void run(unsigned int *a)
{
   a[threadIdx.x] = 1;
}

int main()
{
    unsigned int* arr;
    cudaMallocManaged((void**)&arr, sizeof(unsigned int) * 10);

    run << <1, 10 >> >(arr);
    cudaDeviceSynchronize();

    for (int i = 0; i < 10; i++)
        printf("result = %d", arr[i]);

    cudaFree(arr);

    return 0;
}


1>------ Build started: Project: cudaTest, Configuration: Debug Win32 ------

1>  Compiling CUDA source file kernel.cu...

1>  

1>  C:\Users\Max\documents\visual studio 2013\Projects\cudaTest\cudaTest>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.0\bin\nvcc.exe" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env --cl-version 2013 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin"  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.0\include"  -G   --keep-dir Debug -maxrregcount=0  --machine 32 --compile -cudart static  -g   -DWIN32 -D_DEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Zi /RTC1 /MDd  " -o Debug\kernel.cu.obj "C:\Users\Max\documents\visual studio 2013\Projects\cudaTest\cudaTest\kernel.cu" 

1>  kernel.cu

1>  cudaTest.vcxproj -> C:\Users\Max\documents\visual studio 2013\Projects\cudaTest\Debug\cudaTest.exe

1>  copy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.0\bin\cudart*.dll" "C:\Users\Max\documents\visual studio 2013\Projects\cudaTest\Debug\"

1>  C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.0\bin\cudart32_70.dll

1>  C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.0\bin\cudart64_70.dll

1>  Скопировано файлов:         2.
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========



Unhandled exception at 0x00F1149E in cudaTest.exe: 0xC0000005: Access violation reading location 0x00000000.

First-chance exception at 0x00F1149E in cudaTest.exe: 0xC0000005: Access violation reading location 0x00000000.
Unhandled exception at 0x00F1149E in cudaTest.exe: 0xC0000005: Access violation reading location 0x00000000.

The program '[7104] cudaTest.exe' has exited with code -1073741510 (0xc000013a).
c++
cuda
access-violation
asked on Stack Overflow Apr 25, 2015 by user3769205 • edited Apr 25, 2015 by Wesley

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0