mirror of
https://github.com/Steffo99/unimore-hpc-assignments.git
synced 2024-11-21 23:54:25 +00:00
exercise_2 updated
This commit is contained in:
parent
7cbe5bad64
commit
9dc14ab0c7
2 changed files with 2 additions and 8 deletions
|
@ -21,9 +21,6 @@ void nearest_neighbor(int *out, const int *points,
|
|||
|
||||
int best_i = 0;
|
||||
int best_dist = INT_MAX;
|
||||
int s_point[NUM_DIMS];
|
||||
|
||||
memcpy(s_point, search_point, NUM_DIMS*sizeof(int));
|
||||
|
||||
// TODO: merge upper_loop and lower loop
|
||||
// TODO: insert pipeline directive
|
||||
|
@ -37,7 +34,7 @@ void nearest_neighbor(int *out, const int *points,
|
|||
|
||||
#pragma HLS LOOP_TRIPCOUNT max=num_dims min=num_dims
|
||||
|
||||
int dx = points[dim*p + c] - s_point[c];
|
||||
int dx = points[dim*p + c] - search_point[c];
|
||||
dist += dx * dx;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,9 +22,6 @@ void nearest_neighbor(int *out, const int *points,
|
|||
|
||||
int best_i = 0;
|
||||
int best_dist = INT_MAX;
|
||||
int s_point[NUM_DIMS];
|
||||
|
||||
memcpy(s_point, search_point, NUM_DIMS*sizeof(int));
|
||||
|
||||
int dist = 0;
|
||||
int iterations = len * dim;
|
||||
|
@ -34,7 +31,7 @@ void nearest_neighbor(int *out, const int *points,
|
|||
#pragma HLS PIPELINE
|
||||
#pragma HLS LOOP_TRIPCOUNT max=max_iterations min=max_iterations
|
||||
|
||||
int dx = points[dim * p + c] - s_point[c];
|
||||
int dx = points[dim * p + c] - search_point[c];
|
||||
dist += dx * dx;
|
||||
if (c == dim - 1) {
|
||||
if (dist < best_dist) {
|
||||
|
|
Loading…
Reference in a new issue