我有一個簡單的應用程序(現在)模擬大數組中的糾錯。對於大型陣列,RootBeer會靜默失敗?
該位生成數據並將16字節的Reed-Solomon奇偶校驗添加到每個255字節的塊中。
ReedSolomonEncoder encoder = new ReedSolomonEncoder(QR_CODE_FIELD_256);
int[][] data = new int[params.getNumBlocks()][255];
int[][] original = new int[params.getNumBlocks()][];
int value = 0;
for (int i = 0; i < params.getNumBlocks(); i++) {
int[] block = data[i];
for (int j = 0; j < 239; j++) {
value = (value + 1) % 256;
block[j] = value;
}
encoder.encode(block, 16);
original[i] = Arrays.copyOf(block, block.length);
// Corrupt a byte
block[50] += 1;
}
這是我的內核:
public class RsKernel implements Kernel {
private final int[] block;
public RsKernel(int[] block) {
this.block = block;
}
@Override
public void gpuMethod() {
block[50] -= 1;
}
}
它只是手動還原每個塊(它沒有做實際的Reed-Solomon糾錯)損壞的字節。
我運行下面的代碼的內核:
ArrayList<Kernel> kernels = new ArrayList<>(params.getNumBlocks());
for (int[] block : data) {
kernels.add(new RsKernel(block));
}
new Rootbeer().run(kernels);
我驗證與解碼JUnit
的assertArrayEquals
:
Assert.assertArrayEquals(original, data);
好奇的一點是,如果我運行此代碼最多8192(可疑方便的號碼)塊(內核),數據被報告已被正確解碼;對於8193塊以上,這是不正確解碼:
Exception in thread "main" arrays first differed at element [8192][50]; expected:<51> but was:<52>
at org.junit.Assert.internalArrayEquals(Assert.java:437)
at org.junit.Assert.internalArrayEquals(Assert.java:428)
at org.junit.Assert.assertArrayEquals(Assert.java:167)
at org.junit.Assert.assertArrayEquals(Assert.java:184)
at com.amphinicy.blink.rootbeer.RootBeerDemo.main(Jasmin)
什麼會導致這種行爲?
這裏是java -jar rootbeer-1.1.14.jar -printdeviceinfo
輸出:
device count: 1
device: GeForce GT 525M
compute_capability: 2.1
total_global_memory: 1073414144 bytes
num_multiprocessors: 2
max_threads_per_multiprocessor: 1536
clock_rate: 1200000 Hz
我有同樣的問題。請注意,我的GTX 760的硬件限制爲12288.而這只是併發線程的數量。應該可以將2^32-1線程發送到設備。 – mxmlnkn 2016-02-14 02:46:20