From 241aa3d2c44cfc7eded40aa20b41610b797dbabe Mon Sep 17 00:00:00 2001 From: "baptiste.coudray" <baptiste.coudray@etu.hesge.ch> Date: Mon, 7 Jun 2021 11:41:41 +0200 Subject: [PATCH] Fixed order --- futhark_mpi/dispatch.c | 4 ++-- futhark_mpi/envelope.fut | 22 +++++++++++++++++++--- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/futhark_mpi/dispatch.c b/futhark_mpi/dispatch.c index e5300bd..0cc2396 100644 --- a/futhark_mpi/dispatch.c +++ b/futhark_mpi/dispatch.c @@ -231,8 +231,8 @@ static envelope_t get_inner_envelope_2d(struct dispatch_context *dc, struct futh int thickness_x = min(thickness, dc->chunk_info->dimensions[1]); futhark_context_sync(fc); - futhark_entry_get_envelope_2d(fc, &fut_north, &fut_north_east, &fut_east, &fut_south_east, &fut_south, - &fut_south_west, &fut_west, &fut_north_west, fut_chunk_data, thickness_y, + futhark_entry_get_envelope_2d(fc, &fut_north_west, &fut_north, &fut_north_east, &fut_west, &fut_east, + &fut_south_west, &fut_south, &fut_south_east, fut_chunk_data, thickness_y, thickness_x * dc->type); futhark_context_sync(fc); futhark_free_u8_2d(fc, fut_chunk_data); diff --git a/futhark_mpi/envelope.fut b/futhark_mpi/envelope.fut index d02aa95..be9c774 100644 --- a/futhark_mpi/envelope.fut +++ b/futhark_mpi/envelope.fut @@ -1,9 +1,25 @@ -let get_envelope_1d [n] (xs: [n]u8) (thickness: i64) : ([]u8, []u8) = +-- type envelope_1d_t [n] = { +-- west: [n]u8, +-- east: [n]u8 +-- } +-- +-- type envelope_2d_t [n][m][ty][tx] = { +-- north_west: [ty][tx]u8, +-- north: [ty][m]u8, +-- north_east: [ty][tx]u8, +-- west: [n][tx]u8, +-- east: [n][tx]u8, +-- south_west: [ty][tx]u8, +-- south: [ty][m]u8, +-- south_east: [ty][tx]u8 +-- } + +entry get_envelope_1d [n] (xs: [n]u8) (thickness: i64) : ([]u8, []u8) = let west = xs[0:thickness] :> [thickness]u8 let east = xs[n - thickness:] :> [thickness]u8 in (west, east) -let get_envelope_2d [n][m] (matrix: [n][m]u8) (thickness_y: i64) (thickness_x: i64): ([][]u8, [][]u8, [][]u8, [][]u8, [][]u8, [][]u8, [][]u8, [][]u8) = +entry get_envelope_2d [n][m] (matrix: [n][m]u8) (thickness_y: i64) (thickness_x: i64): ([][]u8, [][]u8, [][]u8, [][]u8, [][]u8, [][]u8, [][]u8, [][]u8) = let north = matrix[0:thickness_y] :> [thickness_y][m]u8 let north_west = matrix[0:thickness_y,0:thickness_x] :> [thickness_y][thickness_x]u8 @@ -17,4 +33,4 @@ let get_envelope_2d [n][m] (matrix: [n][m]u8) (thickness_y: i64) (thickness_x: i let east = matrix[:,m - (thickness_x):] :> [n][thickness_x]u8 let west = matrix[:,0:thickness_x] :> [n][thickness_x]u8 - in (north, north_east, east, south_east, south, south_west, west, north_west) + in (north_west, north, north_east, west, east, south_west, south, south_east) -- GitLab