cuda-memcheck.exe caused an illegal memory access error.

I was testing my CUDA code, using ‘cuda-memcheck.exe’. ‘cuda-memcheck.exe’ caused an illegal memory access if I set ‘–tools synccheck’ option to its command.
This error does not occur by thw following case.

  • CUDA program runs without cuda-memcheck.exe
  • ‘cuda-memcheck.exe’ run without ‘–tools synccheck’ option.

We can reproduce this problem by the following procedure.

  1. Test environment.
    OS : Windows 7 Professional, 64 bit edition
    Compiler : VisualStudio 2010 Professional Version 10.0.40219.1 SP1
    GPU : Tesla k20c
    DisplayDriver: 358.87-desktop-win8-win7-winvista-64bit-international-whql
    CUDA : CUDA 7.5

  2. A Test code ‘’ as below.

#include <assert.h>

#include <cuda.h>
#include <cuda_runtime.h>

using namespace std;

global void cudaTestSync()

void gpuSyncTest()
dim3 thds(64, 1, 1);
dim3 blks(2000, 1, 1);


cudaError_t err;

err = cudaThreadSynchronize();
if(err != cudaSuccess) {
  printf("cudaThreadSynchronize: %s\n", cudaGetErrorString(err));
err = cudaGetLastError();
if(err != cudaSuccess) {
  printf("cudaGetLastError: %s\n", cudaGetErrorString(err)); 


int main()

  1. Compile test code.
    C:> nvcc.exe -gencode=arch=compute_35,code=“sm_35,compute_35” --cl-version 2010 ^
    -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64” ^
    -I"C:\Program Files\NVIDIA GPU ComputingToolkit\CUDA\v7.5\include" ^
    -o test.exe

  2. Run program.
    a) Test program, using cuda-memcheck.exe.
    cuda-memcheck.exe returns correct result.

    C:> cuda-memcheck.exe ./test.exe
    ========= CUDA-MEMCHECK
    ========= ERROR SUMMARY: 0 errors

b) Test program, using cuda-memcheck.exe with ‘–tools synccheck’ option.
A test program caused an illegal memory access error.

 C:\> cuda-memcheck.exe --tool synccheck ./test.exe
 ========= CUDA-MEMCHECK
 cudaThreadSynchronize: an illegal memory access was encountered
 cudaGetLastError: an illegal memory access was encountered
 ========= ERROR SUMMARY: 0 errors

Why cuda-memcheck.exe caused the error ?

best regards