Hi,
I have two versions of the same code: one uses global memory and the other uses shared memory for optimizations.
The shared memory version when compiled with sm_20 outputs wrong results. However, its sm_10 output is correct.
It seems there is a problem with the thread scheduler but I don’t see any race condition in my code.
I have reduced the code size to minimal and attached the code with the necessary input file.
Thanks in advance.
Didi
Some more explanations:
The main computation is the following: It is very simple.
_sh_block_data[_idy][_idx] = data[indexdata];
if (_idy == 3) {
_sh_block_data[_idy - 2][_idx] = data[indexdata - widthdata * 2];
_sh_block_data[_idy - 1][_idx] = data[indexdata - widthdata];
_sh_block_data[_idy - 3][_idx] = data[indexdata - widthdata * 3];
}
__syncthreads();
float dz = _sh_block_data[_idy-2][_idx];
cornerness[indexcornerness] = dz * w[0];
In the both versions of the code, if I replace the last statement with
cornerness[indexcornerness] = w[0];
or
cornerness[indexcornerness] = dz;
then, the results match but the multiplication of them doesn’t.
Specs for the device
Device 0: “Tesla C2050”
Major revision number: 2
Minor revision number: 0
Total amount of global memory: 2817720320 bytes
Number of multiprocessors: 14
Number of cores: 112
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 49152 bytes
Total number of registers available per block: 32768
Warp size: 32
Maximum number of threads per block: 1024
Maximum sizes of each dimension of a block: 1024 x 1024 x 64
Maximum sizes of each dimension of a grid: 65535 x 65535 x 65535
Maximum memory pitch: 2147483647 bytes
Texture alignment: 512 bytes
Clock rate: 1.15 GHz
Concurrent copy and execution: Yes
sharedmem-fermi-bug.tar.gz (4.28 MB)