Skip to content
Snippets Groups Projects
Verified Commit 9cebc10b authored by baptiste.coudray's avatar baptiste.coudray
Browse files

Updated benchmark for GPU

parent 10394433
No related branches found
No related tags found
No related merge requests found
......@@ -45,6 +45,6 @@ entry next_chunk_elems [n] (chunk_elems :[n]i8) (envelope: envelope_1d_i8) :[n]i
let west = neighbours.0
let east = neighbours.1
let symbol = (west << 2) | (cell << 1) | east
in if symbol >= 1 && symbol <= 4 then 1 else 0
in i8.bool (symbol >= 1 && symbol <= 4)
) augmented_elems neighbours
in next_elems[1:n+1] :> [n]i8
......@@ -42,10 +42,6 @@ void compute_next_chunk_elems(struct dispatch_context *dc, struct futhark_contex
futhark_values_i8_1d(fc, fut_next_chunk_elems, ci->data);
futhark_context_sync(fc);
// for (int i = 0; i < ci->dimensions[1]; ++i) {
// printf("%d ", ((int8_t *)ci->data)[i]);
// }
// printf("\n");
futhark_free_i8_1d(fc, fut_next_chunk_elems);
futhark_free_i8_1d(fc, fut_chunk_elems);
......@@ -81,7 +77,7 @@ int main(int argc, char *argv[]) {
/* GFX Initialization */
struct gfx_context_t *gfx_context =
my_rank == ROOT_RANK ? gfx_create("Cellular Automate", (uint) elems_dimensions[0], (uint) history_lines)
my_rank == ROOT_RANK ? gfx_create("Simple Cellular Automaton", (uint) elems_dimensions[0], (uint) history_lines)
: NULL;
if (my_rank == ROOT_RANK && !gfx_context) {
fprintf(stderr, "Graphic mode initialization failed!\n");
......@@ -123,7 +119,8 @@ int main(int argc, char *argv[]) {
MPI_Bcast(&exit, 1, MPI_C_BOOL, ROOT_RANK, MPI_COMM_WORLD);
usleep(1000000 / FPS);
i = (i + 1) % history_lines;
if (my_rank == ROOT_RANK && i == 0){
if (my_rank == ROOT_RANK && i == 0) {
sleep(10000);
memset(history, 0, (size_t) history_lines * (size_t) elems_n * sizeof(int8_t));
}
}
......
......@@ -71,9 +71,8 @@ entry next_chunk_board [n][m] (chunk_board :[n][m]i8) (envelope: envelope_2d_i8)
let neighbours = count_neighbours augmented_board
let next_board = map2 (\augmented_board_r neighbours_r ->
map2(\cell nb_alive_cells ->
if (cell == 1 && (nb_alive_cells == 2 || nb_alive_cells == 3)) || (cell == 0 && nb_alive_cells == 3)
then 1
else 0)
i8.bool ((cell == 1 && (nb_alive_cells == 2 || nb_alive_cells == 3)) || (cell == 0 && nb_alive_cells == 3))
)
augmented_board_r neighbours_r)
augmented_board neighbours
in next_board[1:n+1, 1:m+1] :> [n][m]i8
......@@ -68,7 +68,7 @@ int main(int argc, char *argv[]) {
int lbm_dimensions[3] = {atoi(argv[1]), atoi(argv[2]), atoi(argv[3])};
struct dispatch_context *disp_context = dispatch_context_new(lbm_dimensions, MPI_INT, 3);
struct dispatch_context *disp_context = dispatch_context_new(lbm_dimensions, MPI_FLOAT, 3);
chunk_info_t ci = get_chunk_info(disp_context);
init_chunk_lbm(&ci);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment