Memcheck

After updating to Visual Studios 2015, I have run into many problems with my CUDA code that had worked previously with older versions. One problem that wasn’t present before seems to be a memory issue with one of my arrays. After running memcheck, I have narrowed down the problem to a specific line:

========= CUDA-MEMCHECK
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (31,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (30,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (29,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (28,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (27,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (26,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (25,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (24,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (23,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (22,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (21,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (20,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (19,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (18,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (17,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (16,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (15,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (14,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (13,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (12,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (11,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (10,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (9,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (8,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (7,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (6,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (5,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (4,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (3,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (2,6,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (31,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (30,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (29,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (28,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (27,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (26,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (25,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (24,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (23,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (22,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (21,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (20,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (19,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (18,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (17,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (16,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (15,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (14,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (13,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (12,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (11,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (10,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (9,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (8,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (7,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (6,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (5,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (4,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (3,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (2,3,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (31,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (30,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (29,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (28,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (27,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (26,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (25,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (24,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (23,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (22,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (21,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (20,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (19,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (18,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (17,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (16,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (15,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (14,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (13,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (12,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (11,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (10,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (9,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (8,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (7,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (6,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (5,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (4,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (3,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds
=========
========= Invalid __global__ read of size 2
=========     at 0x00000cd8 in C:/Users/rben.KECK-CENTER/Documents/GitHub/NeuroGPU/VS/Mainen8/NeuroGPU6/CudaStuff.cu:193:BeforeLU(HMat, double*, double*, unsigned short)
=========     by thread (2,2,0) in block (0,0,0)
=========     Address 0x40702280 is out of bounds

Here’s the code block and related declarations in particular:

__constant__ MYFTYPE cCm[NSEG];
__constant__ MYSECONDFTYPE cE[NSEG];
__constant__ MYSECONDFTYPE cF[NSEG];
__constant__ MYDTYPE cFIdxs[NSEG*LOG_N_DEPTH];
__constant__ MYDTYPE cKs[NSEG];
__constant__ MYDTYPE cSegToComp[NSEG];
__constant__ MYDTYPE cBoolModel[NSEG * N_MODELS];//One day change this to bool
__constant__ MYDTYPE cRelStarts[N_FATHERS];//nFathers
__constant__ MYDTYPE cRelEnds[N_FATHERS];//nFathers
__constant__ MYDTYPE cFathers[N_FATHERS];//nFathers
__constant__ MYDTYPE cRelVec[N_CALL_FOR_FATHER];//nCallForFather
__constant__ MYDTYPE cSegStartI[N_CALL_FOR_FATHER+1];//nCallForFather
__constant__ MYDTYPE cSegEndI[N_CALL_FOR_FATHER+1];//nCallForFather

__constant__ MYDTYPE cCompByLevel32[COMP_DEPTH*WARPSIZE];//CompDepth
__constant__ MYDTYPE cCompByFLevel32[COMP_DEPTH*WARPSIZE];//CompFDepth
__constant__ MYDTYPE cLRelStarts[N_L_REL];//nLRel
__constant__ MYDTYPE cLRelEnds[N_L_REL];//nLRel
__constant__ MYDTYPE cFLRelStarts[N_F_L_REL];//nFLRel
__constant__ MYDTYPE cFLRelEnds[N_F_L_REL];//nFLRel
__constant__ MYDTYPE cSonNoVec[NSEG];//InMat.N 

__device__ void BeforeLU(HMat InMat, MYSECONDFTYPE* uHP, MYSECONDFTYPE* bHP, MYDTYPE Depth)
{
	printf("In NeuroGPUKernel y1 ");
	MYDTYPE PIdx=threadIdx.x;
	MYDTYPE i,j,CurJ,CurB,t, CurLevel,LRelIndex;
	MYDTYPE JumctionI;
	LRelIndex=cLRelStarts[CurLevel];
	LRelIndex=LRelIndex+cLRelEnds[CurLevel];
	for(CurLevel=0;CurLevel<=Depth;CurLevel++) {
		printf("In NeuroGPUKernel y2 ");
		for(LRelIndex=cLRelStarts[CurLevel];LRelIndex<=cLRelEnds[CurLevel];LRelIndex++){ 
		//for(LRelIndex=cLRelStarts[CurLevel];LRelIndex<=InMat.LRelEnds[CurLevel];LRelIndex++){ 
			printf("In NeuroGPUKernel y2a ");
			JumctionI=cCompByLevel32[LRelIndex*WARPSIZE+PIdx]-1;
			printf("In NeuroGPUKernel y2b ");
			for(i=cSegStartI[JumctionI]-1;i<cSegEndI[JumctionI];i++) {
				MYSECONDFTYPE uHPm1=uHP[i-1];
				printf("In NeuroGPUKernel y2c ");
				uHP[i]=uHP[i]-cF[i-1]*(cE[i-1]/uHPm1); // So far same as paper parallel
				printf("In NeuroGPUKernel y2ca ");
				uHPm1=uHP[i-1];
				printf("In NeuroGPUKernel y2d ");
				MYSECONDFTYPE bHPm1=bHP[i-1];
				bHP[i]=bHP[i]-bHPm1*cE[i-1]/uHPm1; // bH is y
				printf("In NeuroGPUKernel y2e ");
			}
		}
		printf("In NeuroGPUKernel y3 ");
		if(CurLevel<Depth) {
			for(LRelIndex=cFLRelStarts[CurLevel];LRelIndex<=cFLRelEnds[CurLevel];LRelIndex++){ 
				CurB=cCompByFLevel32[(LRelIndex)*WARPSIZE+PIdx]-1;//RB i inserted another  -1 into the index RB 2 i removed the-1 from the curlevel 
				CurJ=cFathers[CurB]-1;
				printf("In NeuroGPUKernel y4 ");
				MYDTYPE St=cRelStarts[CurB];
				MYDTYPE En=cRelEnds[CurB];
				for(j=St;j<=En;j++) {
					printf("In NeuroGPUKernel y5 ");
					t=cRelVec[j-1]-1;
					MYSECONDFTYPE uHPm1=uHP[t-1];
					uHP[CurJ]-=cF[t-1]*(cE[t-1]/uHPm1); 
					uHPm1=uHP[t-1];
					printf("In NeuroGPUKernel y6 ");
					MYSECONDFTYPE bHPm1=bHP[t-1];
					bHP[CurJ]-=bHPm1*cE[t-1]/uHPm1; 
					printf("In NeuroGPUKernel y7 ");
				}
			}
		}	
	}
}

And here’s the offending line of code on line 38 above:

for(i=cSegStartI[JumctionI]-1;i<cSegEndI[JumctionI];i++) {

It’s clearly an issue with the array, but I’m puzzled since the code worked with previous versions. Can someone help me with this problem?

When you say the code “worked” do you mean “works by design” or “happened to work by chance”? Is it in fact the exact same code that worked before? Might there have been modifications (check revision control)?

I have never seen cuda-memcheck give false positives when it comes to out-of-bounds accesses, so when it complains, it is a defect one would want to fix.

As to how to resolve this: Apply standard debugging techniques used for any kind of program (CUDA or not), e.g. code bisection, use of the CUDA debugger, printf() calls in device code, to track down the root cause of the out-of-bounds accesses.

Is MYDTYPE a 2-byte type such as short?

Assuming line 38 in your posting here does actually correspond to the offending line 193 indicated by cuda-memcheck, that suggests to me that JumctionI is an out-of-range index for either the cSegStartI array or the cSegEndI array.

If it were my code, immediately before that line of code, I would put a printf something like this:

if ((JumctionI < 0) || (JumctionI > N_CALL_FOR_FATHER)) printf("oops!  JumctionI = %d\n", JumctionI);

Then, if you see the oops printout on running your code normally (without cuda-memcheck) then work backwards. Insert printfs where JumctionI is loaded, and see what loaded. Then work backwards to find the source of the out-of-range value for JumctionI.

I would call this pretty basic (unsophisticated) debugging. There are certainly more sophisticated methods, such as what njuffa mentioned, and if you’re more comfortable using a debugger, have at it. The approach would be similar in my view. Grab the tiger by the tail and work backwards.