Skip to content

Commit

Permalink
grid: Print only one line per unittest sample
Browse files Browse the repository at this point in the history
  • Loading branch information
oschuett committed Jun 25, 2020
1 parent 5c68494 commit c4214a0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
5 changes: 4 additions & 1 deletion src/grid/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CFLAGS = -g -O3 -std=c99 -march=native -Wall -Wextra

all: grid_collocate_miniapp.x
all: grid_collocate_miniapp.x grid_collocate_unittest.x

grid_collocate_cpu.o: grid_prepare_pab.o
grid_collocate_replay.o: grid_collocate_cpu.o
Expand All @@ -11,6 +11,9 @@ grid_collocate_replay.o: grid_collocate_cpu.o
grid_collocate_miniapp.x: grid_collocate_miniapp.o grid_collocate_replay.o grid_collocate_cpu.o grid_prepare_pab.o
$(CC) $(CFLAGS) -o $@ $^ -lm

grid_collocate_unittest.x: grid_collocate_unittest.o grid_collocate_replay.o grid_collocate_cpu.o grid_prepare_pab.o
$(CC) $(CFLAGS) -o $@ $^ -lm

clean:
rm -fv grid_*.o grid_*.x

Expand Down
11 changes: 3 additions & 8 deletions src/grid/grid_collocate_replay.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ void grid_collocate_record(const bool orthorhombic,

// *****************************************************************************
double grid_collocate_replay(const char* filename, const int cycles){
printf("Task: %s\n", filename);
FILE *fp = fopen(filename, "r");
assert(fp != NULL && "Could not open task file.");

Expand Down Expand Up @@ -289,8 +288,6 @@ double grid_collocate_replay(const char* filename, const int cycles){
double* grid_test = malloc(sizeof_grid);
memset(grid_test, 0, sizeof_grid);

printf("Cycles: %e\n", (float)cycles);

struct timespec start_time;
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start_time);

Expand Down Expand Up @@ -325,6 +322,7 @@ double grid_collocate_replay(const char* filename, const int cycles){

struct timespec end_time;
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &end_time);
const double delta_sec = (end_time.tv_sec - start_time.tv_sec) + 1e-9 * (end_time.tv_nsec - start_time.tv_nsec);

double max_value = 0.0;
double max_diff = 0.0;
Expand All @@ -335,11 +333,8 @@ double grid_collocate_replay(const char* filename, const int cycles){
max_value = fmax(max_value, fabs(grid_test[i]));
}

printf("Max diff: %le\n", max_diff);
printf("Max value: %le\n", max_value);

const double delta_sec = (end_time.tv_sec - start_time.tv_sec) + 1e-9 * (end_time.tv_nsec - start_time.tv_nsec);
printf("Time: %le sec\n", delta_sec);
printf("Task: %-65s Cycles: %e Max value: %le Max diff: %le Time: %le sec\n",
filename, (float)cycles, max_value, max_diff, delta_sec);

free(grid_ref);
free(grid_test);
Expand Down
2 changes: 1 addition & 1 deletion src/grid/grid_collocate_unittest.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static int run_test(const char cp2k_root_dir[], const char task_file[]) {
printf("Max diff too high, test failed.\n");
return 1;
} else {
printf("Max diff looks good, test passed.\n\n");
//printf("Max diff looks good, test passed.\n\n");
return 0;
}
}
Expand Down

0 comments on commit c4214a0

Please sign in to comment.