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

Fixed memory leaks

parent 6b15ec66
No related branches found
No related tags found
No related merge requests found
......@@ -36,18 +36,19 @@ double compute_next_chunk_elems(struct dispatch_context *dc, struct futhark_cont
struct futhark_i8_1d *fut_next_chunk_elems;
futhark_entry_next_chunk_elems(fc, &fut_next_chunk_elems, fut_chunk_with_envelope);
futhark_context_sync(fc);
futhark_free_i8_1d(fc, fut_next_chunk_elems);
double start = MPI_Wtime();
for (int i = 0; i < N_ITERATIONS; ++i) {
futhark_entry_next_chunk_elems(fc, &fut_next_chunk_elems, fut_chunk_with_envelope);
futhark_context_sync(fc);
futhark_free_i8_1d(fc, fut_next_chunk_elems);
}
futhark_values_i8_1d(fc, fut_next_chunk_elems, ci->data);
futhark_context_sync(fc);
double finish = MPI_Wtime();
futhark_free_i8_1d(fc, fut_chunk_with_envelope);
futhark_free_i8_1d(fc, fut_next_chunk_elems);
return finish - start;
}
......
......@@ -33,18 +33,26 @@ void init_chunk_board(chunk_info_t *ci) {
}
}
void compute_next_chunk_board(struct dispatch_context *dc, struct futhark_context *fc, chunk_info_t *ci) {
double compute_next_chunk_board(struct dispatch_context *dc, struct futhark_context *fc, chunk_info_t *ci) {
struct futhark_i8_2d *fut_chunk_with_envelope = get_chunk_with_envelope(dc, fc, 1, futhark_new_i8_2d);
struct futhark_i8_2d *fut_next_chunk_board;
futhark_entry_next_chunk_board(fc, &fut_next_chunk_board, fut_chunk_with_envelope);
futhark_context_sync(fc);
futhark_free_i8_2d(fc, fut_next_chunk_board);
double start = MPI_Wtime();
for (int i = 0; i < N_ITERATIONS; ++i) {
futhark_entry_next_chunk_board(fc, &fut_next_chunk_board, fut_chunk_with_envelope);
futhark_context_sync(fc);
futhark_free_i8_2d(fc, fut_next_chunk_board);
}
futhark_values_i8_2d(fc, fut_next_chunk_board, ci->data);
futhark_context_sync(fc);
double finish = MPI_Wtime();
futhark_free_i8_2d(fc, fut_chunk_with_envelope);
futhark_free_i8_2d(fc, fut_next_chunk_board);
return finish - start;
}
int main(int argc, char *argv[]) {
......@@ -79,13 +87,9 @@ int main(int argc, char *argv[]) {
init_chunk_board(&ci);
for (int i = 0; i < N_MEASURES; ++i) {
double start = MPI_Wtime();
for (int j = 0; j < N_ITERATIONS; ++j) {
compute_next_chunk_board(disp_context, fut_context, &ci);
}
double finish = MPI_Wtime();
double time = compute_next_chunk_board(disp_context, fut_context, &ci);
if (my_rank == ROOT_RANK) {
printf("%d;%d;%d;%d;%f\n", world_size, nb_devices, board_n, board_m, finish - start);
printf("%d;%d;%d;%d;%f\n", world_size, nb_devices, board_n, board_m, time);
}
}
......
......@@ -48,18 +48,19 @@ double compute_next_lbm(struct dispatch_context *dc, struct futhark_context *fc,
// Warmup
futhark_entry_next_chunk_lbm(fc, &fut_next_chunk_lbm, fut_chunk_with_envelope);
futhark_context_sync(fc);
futhark_free_f32_4d(fc, fut_next_chunk_lbm);
double start = MPI_Wtime();
for (int i = 0; i < N_ITERATIONS; ++i) {
futhark_entry_next_chunk_lbm(fc, &fut_next_chunk_lbm, fut_chunk_with_envelope);
futhark_context_sync(fc);
futhark_free_f32_4d(fc, fut_next_chunk_lbm);
}
futhark_values_f32_4d(fc, fut_next_chunk_lbm, ci->data);
futhark_context_sync(fc);
double finish = MPI_Wtime();
futhark_free_f32_4d(fc, fut_chunk_with_envelope);
futhark_free_f32_4d(fc, fut_next_chunk_lbm);
return finish - start;
}
......
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