odstranene debug funkcie.
pridany Code::Blocks projektovy subor
This commit is contained in:
parent
13cd00a59a
commit
97fc3465cb
@ -54,12 +54,8 @@ bool cmp16(float *a, float *b)
|
||||
|
||||
void AsynchronousModel::run(CellSpace *pattern, int which, int iteration)
|
||||
{
|
||||
cl_mem debug = parent->createBuffer(CL_MEM_READ_WRITE, sizeof(float)*16*16*16);//debugovacie data
|
||||
float *fdebug1 = new float[16*16*16];
|
||||
|
||||
cl_int err_code;
|
||||
err_code = clSetKernelArg(kernel, 0, sizeof(cl_mem), pattern->getSpace());
|
||||
err_code = clSetKernelArg(kernel, 3, sizeof(cl_mem), &debug);
|
||||
err_code |= clSetKernelArg(intermediate_kernel, 0, sizeof(cl_mem), pattern->getSpace());
|
||||
Variant f = pattern->getValue("current_time");
|
||||
if(err_code){ cerr << "Nepodarilo sa nastavit argumenty kernela "; clGetError(err_code); }
|
||||
@ -73,22 +69,12 @@ void AsynchronousModel::run(CellSpace *pattern, int which, int iteration)
|
||||
parent->run(kernel, pattern->getWidth(), pattern->getHeight());
|
||||
parent->finish();
|
||||
//vypisem dubug informacie
|
||||
parent->copy(debug, fdebug1, 16*16*sizeof(float)*16);
|
||||
parent->run(intermediate_kernel, pattern->getWidth(), pattern->getHeight());
|
||||
parent->finish();
|
||||
}
|
||||
pattern->setValue("current_time", f);
|
||||
//parent->copy(gpu_copy, *pattern->getSpace(), 16*16*getCellSize());
|
||||
|
||||
for(int i=0;i<16*16;i++)
|
||||
{
|
||||
for(int o=0;o<16;o++)cout << fdebug1[i*16+o] << " ";
|
||||
cout << endl;
|
||||
}
|
||||
clReleaseMemObject(debug);
|
||||
cout << "######" << endl;
|
||||
cerr << "######" << endl;
|
||||
}
|
||||
|
||||
/**
|
||||
inicializuje data
|
||||
@param pattern
|
||||
|
161
cellula.cbp
Normal file
161
cellula.cbp
Normal file
@ -0,0 +1,161 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6" />
|
||||
<Project>
|
||||
<Option title="cellula" />
|
||||
<Option pch_mode="2" />
|
||||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="Debug">
|
||||
<Option output="cellula_d" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Debug/" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-g" />
|
||||
</Compiler>
|
||||
</Target>
|
||||
<Target title="Release">
|
||||
<Option output="cellula" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Release/" />
|
||||
<Option type="0" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-O2" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-s" />
|
||||
</Linker>
|
||||
</Target>
|
||||
<Target title="qt4">
|
||||
<Option output="cellula" prefix_auto="1" extension_auto="1" />
|
||||
<Option type="0" />
|
||||
<Option compiler="gcc" />
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add option="-Wall" />
|
||||
<Add directory="/usr/include/qt4" />
|
||||
<Add directory="/usr/include/qt4/QtGui" />
|
||||
<Add directory="/usr/include/qt4/QtCore" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add library="QtCore" />
|
||||
<Add library="QtGui" />
|
||||
<Add library="OpenCL" />
|
||||
<Add library="QtOpenGL" />
|
||||
<Add directory="/usr/lib" />
|
||||
<Add directory="/home/nou/Plocha/ati-stream-sdk-v2.0/lib/x86" />
|
||||
</Linker>
|
||||
<Unit filename="asynchronousmodel.cpp">
|
||||
<Option target="Debug" />
|
||||
<Option target="Release" />
|
||||
</Unit>
|
||||
<Unit filename="cellspace.cpp">
|
||||
<Option target="Debug" />
|
||||
<Option target="Release" />
|
||||
</Unit>
|
||||
<Unit filename="cellspace.h">
|
||||
<Option target="Debug" />
|
||||
<Option target="Release" />
|
||||
</Unit>
|
||||
<Unit filename="cellulamainwindow.cpp">
|
||||
<Option target="Debug" />
|
||||
<Option target="Release" />
|
||||
</Unit>
|
||||
<Unit filename="cellulamainwindow.h">
|
||||
<Option compile="1" />
|
||||
<Option compiler="gcc" use="1" buildCommand="moc cellulamainwindow.h -o moc_cellulamainwindow.cpp" />
|
||||
<Option target="qt4" />
|
||||
</Unit>
|
||||
<Unit filename="clutility.cpp">
|
||||
<Option target="Debug" />
|
||||
<Option target="Release" />
|
||||
</Unit>
|
||||
<Unit filename="clutility.h">
|
||||
<Option target="Debug" />
|
||||
<Option target="Release" />
|
||||
</Unit>
|
||||
<Unit filename="glwidget.cpp">
|
||||
<Option target="Debug" />
|
||||
<Option target="Release" />
|
||||
</Unit>
|
||||
<Unit filename="glwidget.h">
|
||||
<Option compile="1" />
|
||||
<Option compiler="gcc" use="1" buildCommand="moc glwidget.h -o moc_glwidget.cpp" />
|
||||
<Option target="qt4" />
|
||||
</Unit>
|
||||
<Unit filename="kernel.cl">
|
||||
<Option target="Debug" />
|
||||
<Option target="Release" />
|
||||
</Unit>
|
||||
<Unit filename="kernels/asyn.cl">
|
||||
<Option target="Debug" />
|
||||
<Option target="Release" />
|
||||
</Unit>
|
||||
<Unit filename="kernels/asynchr.cl">
|
||||
<Option target="Debug" />
|
||||
<Option target="Release" />
|
||||
</Unit>
|
||||
<Unit filename="kernels/functions.cl">
|
||||
<Option target="Debug" />
|
||||
<Option target="Release" />
|
||||
</Unit>
|
||||
<Unit filename="kernels/synchr.cl">
|
||||
<Option target="Debug" />
|
||||
<Option target="Release" />
|
||||
</Unit>
|
||||
<Unit filename="kernels/types.cl">
|
||||
<Option target="Debug" />
|
||||
<Option target="Release" />
|
||||
</Unit>
|
||||
<Unit filename="machine.cpp">
|
||||
<Option target="Debug" />
|
||||
<Option target="Release" />
|
||||
</Unit>
|
||||
<Unit filename="machine.h">
|
||||
<Option target="Debug" />
|
||||
<Option target="Release" />
|
||||
</Unit>
|
||||
<Unit filename="main.cpp">
|
||||
<Option target="Debug" />
|
||||
<Option target="Release" />
|
||||
</Unit>
|
||||
<Unit filename="moc_cellulamainwindow.cpp">
|
||||
<Option target="Debug" />
|
||||
<Option target="Release" />
|
||||
</Unit>
|
||||
<Unit filename="moc_glwidget.cpp">
|
||||
<Option target="Debug" />
|
||||
<Option target="Release" />
|
||||
</Unit>
|
||||
<Unit filename="model.cpp">
|
||||
<Option target="Debug" />
|
||||
<Option target="Release" />
|
||||
</Unit>
|
||||
<Unit filename="model.h">
|
||||
<Option target="Debug" />
|
||||
<Option target="Release" />
|
||||
</Unit>
|
||||
<Unit filename="options.cpp">
|
||||
<Option target="Debug" />
|
||||
<Option target="Release" />
|
||||
</Unit>
|
||||
<Unit filename="options.h">
|
||||
<Option target="Debug" />
|
||||
<Option target="Release" />
|
||||
</Unit>
|
||||
<Unit filename="res.cpp">
|
||||
<Option target="Debug" />
|
||||
<Option target="Release" />
|
||||
</Unit>
|
||||
<Unit filename="synchronousmodel.cpp">
|
||||
<Option target="Debug" />
|
||||
<Option target="Release" />
|
||||
</Unit>
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<debugger />
|
||||
</Extensions>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
@ -128,7 +128,7 @@ bool event_cmp(_event a, _event b)
|
||||
return a.y == b.y;
|
||||
}
|
||||
|
||||
__kernel void takeStep(__global _cell *cells, _time start_time, _time time_window, __global float16 *debug)
|
||||
__kernel void takeStep(__global _cell *cells, _time start_time, _time time_window)
|
||||
{
|
||||
_event event_vector[NEIGHBOR];
|
||||
int2 size = (int2)(get_global_size(0), get_global_size(1));
|
||||
@ -138,12 +138,6 @@ __kernel void takeStep(__global _cell *cells, _time start_time, _time time_windo
|
||||
int current_index[NEIGHBOR];
|
||||
int2 new_index = (int2)(cells[COORD(position)].end);//indexy fronty fronty novych uddalosti
|
||||
|
||||
debug[COORD(position)] = (float16)0;
|
||||
debug[COORD(position)].s0 = position.x;
|
||||
debug[COORD(position)].s1 = position.y;
|
||||
debug[COORD(position)].s23 = (float2)(new_index.x, new_index.y);
|
||||
|
||||
|
||||
//vytvorime absolutne koordinaty a startovne indexy
|
||||
for(int i=0;i<NEIGHBOR;i++)
|
||||
{
|
||||
@ -151,10 +145,7 @@ __kernel void takeStep(__global _cell *cells, _time start_time, _time time_windo
|
||||
coord[i] = wrap2(position+n, size);
|
||||
current_index[i] = cells[COORD(coord[i])].start;
|
||||
}
|
||||
float8 ci = (float8)(current_index[0], current_index[1], current_index[2], current_index[3], current_index[4], current_index[5], current_index[6], current_index[7]);
|
||||
ci *= 2;
|
||||
//printf("%d %d in %d %d %d %d %d %d %d %d\n", position.x, position.y, current_index[0], current_index[1], current_index[2],
|
||||
// current_index[3], current_index[4], current_index[5], current_index[6], current_index[7]);
|
||||
|
||||
_event new_event;
|
||||
_time current_time = start_time,old_time = NON;
|
||||
_event current_state = cells[COORD(position)].state;
|
||||
@ -162,15 +153,9 @@ __kernel void takeStep(__global _cell *cells, _time start_time, _time time_windo
|
||||
while(1)
|
||||
{
|
||||
current_time = advance_in_queues(cells, coord, current_index, current_time);
|
||||
debug[COORD(position)].sC = current_time;
|
||||
//if(position.x==0 && position.y ==0)printf("new event %f %f\n", current_time, old_time);
|
||||
|
||||
if(current_time < start_time || current_time >= time_window || old_time == current_time)break;
|
||||
debug[COORD(position)].sD = 1;
|
||||
create_event_vector(cells, event_vector, coord, current_index);//vytvorim stavovy vektor
|
||||
/*debug[COORD(position)].s456789AB = (float8)(event_vector[LOC_COORD(0)].y, event_vector[LOC_COORD(1)].y, event_vector[LOC_COORD(2)].y,
|
||||
event_vector[LOC_COORD(3)].y, event_vector[LOC_COORD(4)].y, event_vector[LOC_COORD(5)].y, event_vector[LOC_COORD(6)].y, event_vector[LOC_COORD(7)].y);*/
|
||||
debug[COORD(position)].s456789AB = (float8)(COORD(coord[0]), COORD(coord[1]), COORD(coord[2]), COORD(coord[3]), COORD(coord[4])
|
||||
, COORD(coord[5]), COORD(coord[6]), COORD(coord[7]));
|
||||
|
||||
old_time = current_time;
|
||||
new_event = transfer_func(current_state, event_vector);//zavolamprechodovu funkciu
|
||||
@ -179,10 +164,7 @@ __kernel void takeStep(__global _cell *cells, _time start_time, _time time_windo
|
||||
//if(current_state.y != new_event.y)//ulozim novu udalost do fronty iba ak je ina ako terajsia
|
||||
{
|
||||
new_index.y = push(cells+COORD(position), new_index.y, new_event);
|
||||
debug[COORD(position)].sEF = (float2)(current_state.y, new_event.y);
|
||||
debug[COORD(position)].s2 = truecount(event_vector);
|
||||
current_state = new_event;
|
||||
//printf("pos %d %d %f\n", position.x, position.y, new_event.y);
|
||||
}
|
||||
}
|
||||
cells[COORD(position)].state.y = current_state.y;//zapisem novy stav bunky
|
||||
|
Loading…
x
Reference in New Issue
Block a user