Configuration.setPrintMem(print_mem);
Kernel known_good_item = creator.create();
Kernel testing_item = creator.create();
ThreadConfig thread_config = creator.getThreadConfig();
Stopwatch watch = new Stopwatch();
watch.start();
Context context = rootbeer.createDefaultContext();
context.setKernel(testing_item);
context.setThreadConfig(thread_config);
context.buildState();
context.run();
context.close();
m_passed = true;
watch.stop();
m_gpuTime = watch.elapsedTimeMillis();
watch.start();
RootbeerGpu.setBlockDimx(thread_config.getThreadCountX());
RootbeerGpu.setBlockDimy(thread_config.getThreadCountY());
RootbeerGpu.setBlockDimz(thread_config.getThreadCountZ());
RootbeerGpu.setGridDimx(thread_config.getBlockCountX());
RootbeerGpu.setGridDimy(thread_config.getBlockCountY());
for(int blockx = 0; blockx < thread_config.getBlockCountX(); ++blockx){
RootbeerGpu.setBlockIdxx(blockx);
for(int blocky = 0; blocky < thread_config.getBlockCountY(); ++blocky){
RootbeerGpu.setBlockIdxy(blocky);
for(int threadx = 0; threadx < thread_config.getThreadCountX(); ++threadx){
RootbeerGpu.setThreadIdxx(threadx);
for(int thready = 0; thready < thread_config.getThreadCountY(); ++thready){
RootbeerGpu.setThreadIdxy(thready);
for(int threadz = 0; threadz < thread_config.getThreadCountZ(); ++threadz){
RootbeerGpu.setThreadIdxz(threadz);
known_good_item.gpuMethod();
}
}
}
}
}
watch.stop();
m_cpuTime = watch.elapsedTimeMillis();
if(!creator.compare(known_good_item, testing_item)){
m_message = "Compare failed at: "+i;
m_passed = false;
return;
}