I have a set of 200 vectors each of length 361. I am allocating global memory as a linear memory of size 200 * 100 * sizeof(float).

Now I want to fill in the vectors with values 0 to 360 in each of 200 vectors. I did following:

```
int sampleId = threadIdx.x + blockIdx.x * blockDim.x; //where sapleId range from 0 to 199
for(i = 0; i < 19; i++)
{
for(j = 0; j < 19; j++)
{
k = j + 19*i;
d_SampleData[threadIdx.x * SAMPLE_LEN + k] = k;
}
}
//transfer data from device to host etc ..
```

The result for first vector , I get , is correct as

h_SampleData[0][0] = 0

h_SampleData[0][0] = 1

.

.

h_SampleData[0][360] = 0

Problem starts from second vector and onwards as

h_SampleData[1][0] = 19

h_SampleData[0][0] = 20

…

h_SampleData[0][285] = 0

h_SampleData[0][360] = <som non zero value but in range [0,360]>

I am not able to understand what is wrong with the code.

I checked the values of threadIdx.x and is confirmed to be in range [0,199]

The execution configuration I use is func<<<1, NumSamples>>>(…)

where NumSamples = 200 i.e total vectors.

I expected results as :

```
h_SampleData[0][0] = 0
.
.
h_SampleData[0][360] =360
for second vector
h_SampleData[1][0] = 0
.
.
h_SampleData[1][360] = 360
thrid vector as
h_SampleData[2][0] = 0
.
.
h_SampleData[2][360] = 360
and so till vector number 199
i.e
h_SampleData[199][0] = 0
.
.
h_SampleData[199][360] = 360
```

Kindly help.