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

Fixed compilation

parent 4305576a
No related branches found
No related tags found
No related merge requests found
#ifndef _DISPATCH_H_
#define _DISPATCH_H_
//#include "../game_of_life/gol.h"
#include "../lattice_boltzmann/lbm.h"
#include "chunk_info.h"
#include "envelope.h"
//#include "envelope.h"
#define FUTHARK_I8 " i8"
#define FUTHARK_U8 " i8"
......
......@@ -15,7 +15,7 @@ include_directories(${MPI_C_INCLUDE_PATH})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GCC_COMPILE_FLAGS}")
add_custom_command(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/lbm_seq.h ${CMAKE_CURRENT_SOURCE_DIR}/lbm_seq.c
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/lbm.h ${CMAKE_CURRENT_SOURCE_DIR}/lbm.c
COMMAND futhark c ${CMAKE_CURRENT_SOURCE_DIR}/lbm.fut --library
DEPENDS lbm.fut
)
......@@ -43,7 +43,7 @@ add_custom_command(
add_custom_target(futhark_lbm_multicore DEPENDS lbm_mc.h lbm_mc.c)
########## Lattice-Boltzmann ##########
add_executable(lattice_boltzmann_opencl main.c gfx.h gfx.c lbm.h lbm.c ../futhark_mpi/dispatch.h ../futhark_mpi/dispatch.c ../futhark_mpi/chunk_info.c ../futhark_mpi/chunk_info.h)
add_executable(lattice_boltzmann_opencl main.c lbm.h lbm.c ../futhark_mpi/dispatch.h ../futhark_mpi/dispatch.c ../futhark_mpi/chunk_info.c ../futhark_mpi/chunk_info.h)
add_dependencies(lattice_boltzmann_opencl futhark_lbm_opencl)
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
......
......@@ -18,12 +18,12 @@ type~ side_envelope_3d_i32 = {
}
type~ envelope_3d_i32 = {
back: side_envelope_3d_t,
bottom: side_envelope_3d_t,
front: side_envelope_3d_t,
left: side_envelope_3d_t,
right: side_envelope_3d_t,
top: side_envelope_3d_t
back: side_envelope_3d_i32,
bottom: side_envelope_3d_i32,
front: side_envelope_3d_i32,
left: side_envelope_3d_i32,
right: side_envelope_3d_i32,
top: side_envelope_3d_i32
}
entry get_envelope_1d [n] (xs: [n]u8) (thickness: i64) : envelope_1d_t [thickness] =
......@@ -43,7 +43,7 @@ let augment_lbm [n][m][l] (chunk_lbm:[n][m][l]i32) (envelope: envelope_3d_i32) :
let n_aug = n+2
let m_aug = m+2
let l_aug = l+2
tabulate_3d (n_aug) (m_aug) (l_aug) (\i j k ->
in tabulate_3d (n_aug) (m_aug) (l_aug) (\i j k ->
-- Top-South-West
if (i == 0 && j == 0 && k == 0) then envelope.top.south_west[i,j,k]
-- Top-West
......@@ -75,7 +75,7 @@ let augment_lbm [n][m][l] (chunk_lbm:[n][m][l]i32) (envelope: envelope_3d_i32) :
-- Back East
else if (i >= 1 && i <= n_aug-2 && j == m_aug-1 && k == l_aug-1) then envelope.back.west[i-1,0,0]
-- Bottom-South-West
if (i == n_aug-1 && j == 0 && k == 0) then envelope.bottom.south_west[0,j,k]
else if (i == n_aug-1 && j == 0 && k == 0) then envelope.bottom.south_west[0,j,k]
-- Bottom-West
else if (i == n_aug-1 && j == 0 && k >= 1 && k <= l_aug-2) then envelope.bottom.west[0,j,k-1]
-- Bottom-North-West
......@@ -95,7 +95,8 @@ let augment_lbm [n][m][l] (chunk_lbm:[n][m][l]i32) (envelope: envelope_3d_i32) :
else chunk_lbm[i-1, j-1, l-1]
)
entry next_lbm [n][m][l] (chunk_lbm :[n][m][l]i32) (envelope: envelope_3d_i32) :[n][m][l]i32 =
entry next_chunk_lbm [n][m][l] (chunk_lbm :[n][m][l]i32) (envelope: envelope_3d_i32) :[n][m][l]i32 =
let augmented_lbm = augment_lbm chunk_lbm envelope
-- TODO: Here, compute next lbm
in next_lbm[1:n+1, 1:m+1][1:l+1] :> [n][m][l]i32
in augmented_lbm[1:n+1, 1:m+1, 1:l+1] :> [n][m][l]i32
-- in next_lbm[1:n+1, 1:m+1, 1:l+1] :> [n][m][l]i32
......@@ -6,13 +6,9 @@
*/
#include <stdio.h>
#include <stdint.h>
#include "stdlib.h"
#include <stdbool.h>
#include <mpi.h>
#include <unistd.h>
#include "gol.h"
#include "gfx.h"
#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)))
......@@ -43,7 +39,7 @@ void compute_next_lbm(struct dispatch_context *dc, struct futhark_context *fc, c
struct futhark_i32_3d *fut_next_chunk_lbm;
futhark_context_sync(fc);
futhark_entry_next_next_chunk_lbm(fc, &fut_next_chunk_lbm, fut_chunk_lbm, fut_outer_envelope);
futhark_entry_next_chunk_lbm(fc, &fut_next_chunk_lbm, fut_chunk_lbm, fut_outer_envelope);
futhark_context_sync(fc);
futhark_values_i32_3d(fc, fut_next_chunk_lbm, ci->data);
......@@ -77,7 +73,7 @@ int main(int argc, char *argv[]) {
init_chunk_lbm(&ci);
for (int i = 0; i < N_ITERATIONS; ++i) {
compute_next_lbm(dc, fc, ci);
compute_next_lbm(disp_context, fut_context, &ci);
}
dispatch_context_free(disp_context);
......
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