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

Fixed bugs

parent 7573d74e
No related branches found
No related tags found
No related merge requests found
...@@ -1419,7 +1419,7 @@ static envelope_t get_outer_envelope_3d(struct dispatch_context *dc, int thickne ...@@ -1419,7 +1419,7 @@ static envelope_t get_outer_envelope_3d(struct dispatch_context *dc, int thickne
{ {
// Surface // Surface
{ {
int dest_source_y = (coordinate_y + 1) % dc->network_dimensions[1]; int dest_source_y = (coordinate_y + 1) % dc->network_dimensions[0];
int dest_source = INDEX_3D_TO_1D(dest_source_y, coordinate_x, coordinate_z, dc->network_dimensions[1], int dest_source = INDEX_3D_TO_1D(dest_source_y, coordinate_x, coordinate_z, dc->network_dimensions[1],
dc->network_dimensions[2]); dc->network_dimensions[2]);
...@@ -1804,7 +1804,7 @@ static envelope_t get_outer_envelope_3d(struct dispatch_context *dc, int thickne ...@@ -1804,7 +1804,7 @@ static envelope_t get_outer_envelope_3d(struct dispatch_context *dc, int thickne
{ {
// Surface // Surface
{ {
int dest_source_y = (coordinate_y - 1) >= 0 ? (coordinate_y - 1) : dc->network_dimensions[1] - 1; int dest_source_y = (coordinate_y - 1) >= 0 ? (coordinate_y - 1) : dc->network_dimensions[0] - 1;
int dest_source = INDEX_3D_TO_1D(dest_source_y, coordinate_x, coordinate_z, dc->network_dimensions[1], int dest_source = INDEX_3D_TO_1D(dest_source_y, coordinate_x, coordinate_z, dc->network_dimensions[1],
dc->network_dimensions[2]); dc->network_dimensions[2]);
...@@ -2051,7 +2051,6 @@ static envelope_t get_outer_envelope_3d(struct dispatch_context *dc, int thickne ...@@ -2051,7 +2051,6 @@ static envelope_t get_outer_envelope_3d(struct dispatch_context *dc, int thickne
} }
MPI_Waitall(i_request, requests, MPI_STATUSES_IGNORE); MPI_Waitall(i_request, requests, MPI_STATUSES_IGNORE);
chunk_info_print(outer_envelope.front->north);
return outer_envelope; return outer_envelope;
} }
......
...@@ -167,13 +167,13 @@ void tests_1_process(struct futhark_context *fc) { ...@@ -167,13 +167,13 @@ void tests_1_process(struct futhark_context *fc) {
envelope_t inner_envelope = get_inner_envelope(dc, fc, 1); envelope_t inner_envelope = get_inner_envelope(dc, fc, 1);
envelope_init_accessors(&inner_envelope); envelope_init_accessors(&inner_envelope);
int expected_north[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; int expected_north[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14};
int expected_east[] = {14, 15, 16, 17, 18, 19, 20, 21, 22, 23}; int expected_east[] = {14, 15, 16, 17, 18, 19, 20, 21, 22, 23};
int expected_south[] = {9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23}; int expected_south[] = {9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23};
int expected_west[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; int expected_west[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
int expected_nw[] = {0}; int expected_nw[] = {0};
int expected_ne[] = {14}; int expected_ne[] = {14};
int expected_se[] = {23}; int expected_se[] = {23};
int expected_sw[] = {9}; int expected_sw[] = {9};
assert(memcmp(expected_north, inner_envelope.front->north->data, sizeof(expected_north)) == 0); assert(memcmp(expected_north, inner_envelope.front->north->data, sizeof(expected_north)) == 0);
assert(memcmp(expected_east, inner_envelope.front->east->data, sizeof(expected_east)) == 0); assert(memcmp(expected_east, inner_envelope.front->east->data, sizeof(expected_east)) == 0);
...@@ -306,7 +306,7 @@ void tests_2_processes(int my_rank, struct futhark_context *fc) { ...@@ -306,7 +306,7 @@ void tests_2_processes(int my_rank, struct futhark_context *fc) {
printf("\tTesting get_outer_envelope. Thickness = 9...\n"); printf("\tTesting get_outer_envelope. Thickness = 9...\n");
{ {
envelope_t outer_envelope = get_outer_envelope(dc, fc, 9); envelope_t outer_envelope = get_outer_envelope(dc, fc, 9);
if(my_rank == 0) { if (my_rank == 0) {
int expected_west[] = {0, 1, 2, 3, 4, 5, 6}; int expected_west[] = {0, 1, 2, 3, 4, 5, 6};
int expected_east[] = {0, 1, 2, 3, 4, 5, 6}; int expected_east[] = {0, 1, 2, 3, 4, 5, 6};
...@@ -410,7 +410,6 @@ void tests_2_processes(int my_rank, struct futhark_context *fc) { ...@@ -410,7 +410,6 @@ void tests_2_processes(int my_rank, struct futhark_context *fc) {
envelope_t outer_envelope = get_outer_envelope(dc, fc, 4); envelope_t outer_envelope = get_outer_envelope(dc, fc, 4);
envelope_free(&outer_envelope); envelope_free(&outer_envelope);
} }
...@@ -609,7 +608,8 @@ void tests_6_processes(int my_rank, struct futhark_context *fc) { ...@@ -609,7 +608,8 @@ void tests_6_processes(int my_rank, struct futhark_context *fc) {
envelope_free(&outer_envelope); envelope_free(&outer_envelope);
dispatch_context_free(dc); dispatch_context_free(dc);
} }
printf("Testing dispatch_context_new with 4 processes. Dimensions = 21x42...\n");
printf("Testing dispatch_context_new with 6 processes. Dimensions = 21x42...\n");
{ {
int dimensions[2] = {21, 42}; int dimensions[2] = {21, 42};
struct dispatch_context *dc = dispatch_context_new(dimensions, MPI_INT, 2); struct dispatch_context *dc = dispatch_context_new(dimensions, MPI_INT, 2);
...@@ -660,6 +660,23 @@ void tests_6_processes(int my_rank, struct futhark_context *fc) { ...@@ -660,6 +660,23 @@ void tests_6_processes(int my_rank, struct futhark_context *fc) {
} }
} }
void tests_12_processes(int my_rank, struct futhark_context *fc) {
printf("Testing dispatch_context_new with 12 processes. Dimensions = 2x2x2...\n");
{
int dimensions[3] = {10, 10, 3};
struct dispatch_context *dc = dispatch_context_new(dimensions, MPI_INT, 3);
chunk_info_t ci = get_chunk_info(dc);
dispatch_context_print(dc);
chunk_info_print(&ci);
envelope_t inner_envelope = get_inner_envelope(dc, fc, 1);
envelope_free(&inner_envelope);
envelope_t outer_envelope = get_outer_envelope(dc, fc, 1);
envelope_free(&outer_envelope);
dispatch_context_free(dc);
}
}
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
MPI_Init(&argc, &argv); MPI_Init(&argc, &argv);
struct futhark_context_config *fcc = futhark_context_config_new(); struct futhark_context_config *fcc = futhark_context_config_new();
...@@ -687,6 +704,9 @@ int main(int argc, char *argv[]) { ...@@ -687,6 +704,9 @@ int main(int argc, char *argv[]) {
case 6: case 6:
tests_6_processes(my_rank, fc); tests_6_processes(my_rank, fc);
break; break;
case 12:
tests_12_processes(my_rank, fc);
break;
default: default:
break; break;
} }
......
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