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

Fixed overflow

parent 15ad62d0
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,7 @@
#include "lbm.h"
#include "../futhark_mpi/dispatch.h"
#define INDEX_3D_TO_1D(y, x, z, nb_columns, nb_depths) ((x) + (nb_columns) * ((y) + (nb_depths) * (z)))
#define INDEX_3D_TO_1D(y, x, z, nb_columns, nb_depths) x + HEIGHT* (y + WIDTH* z)
#define N_ITERATIONS 200
#define NB_VALUES 27
......@@ -23,14 +23,9 @@ typedef struct lbm_values {
void init_chunk_lbm(chunk_info_t *ci) {
lbm_values_t *data32 = ci->data;
for (int i = 0; i < ci->dimensions[0]; ++i) {
for (int j = 0; j < ci->dimensions[1]; ++j) {
for (int k = 0; k < ci->dimensions[2]; ++k) {
int idx = INDEX_3D_TO_1D(i, j, k, ci->dimensions[1], ci->dimensions[2]);
for (int l = 0; l < NB_VALUES; ++l) {
data32[idx].values[l] = ((float) rand() / (float) rand());
}
}
for (size_t i = 0; i < ci->count; ++i) {
for (int l = 0; l < NB_VALUES; ++l) {
data32[i].values[l] = ((float) rand() / (float) rand());
}
}
}
......@@ -87,6 +82,7 @@ int main(int argc, char *argv[]) {
struct dispatch_context *disp_context = dispatch_context_new(lbm_dimensions, my_mpi_type, 3);
chunk_info_t ci = get_chunk_info(disp_context);
chunk_info_print(&ci);
init_chunk_lbm(&ci);
for (int i = 0; i < N_ITERATIONS; ++i) {
......
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