2023-02-01 22:30:00 +09:00
|
|
|
#include <cstdio>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2023-02-02 19:02:36 +09:00
|
|
|
#include "uNet.h"
|
2023-02-01 22:30:00 +09:00
|
|
|
#include "util.h"
|
|
|
|
|
|
|
|
// Global variables
|
|
|
|
int N = 1;
|
|
|
|
int random_seed = 1;
|
|
|
|
int print_max = 8;
|
|
|
|
int MAX_LEN = 10;
|
|
|
|
char *parameter_fname;
|
|
|
|
char *output_fname;
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
|
|
|
|
check_and_parse_args(argc, argv);
|
|
|
|
|
|
|
|
// Initialize model
|
2023-02-02 23:37:40 +09:00
|
|
|
uNet_initialize(N, random_seed, parameter_fname);
|
2023-02-01 22:30:00 +09:00
|
|
|
|
2023-02-03 01:25:19 +09:00
|
|
|
float *input = (float*)malloc(N * sizeof(float));
|
|
|
|
float *output = (float*)malloc(N * sizeof(float));
|
|
|
|
|
|
|
|
printf("running %d images...", N);
|
2023-02-01 22:30:00 +09:00
|
|
|
fflush(stdout);
|
|
|
|
|
2023-02-03 01:25:19 +09:00
|
|
|
// run uNet and measure time
|
2023-02-02 23:37:40 +09:00
|
|
|
double uNet_st = get_time();
|
2023-02-01 22:30:00 +09:00
|
|
|
|
2023-02-03 01:25:19 +09:00
|
|
|
uNet(input, output);
|
2023-02-01 22:30:00 +09:00
|
|
|
|
2023-02-02 23:37:40 +09:00
|
|
|
double uNet_en = get_time();
|
2023-02-01 22:30:00 +09:00
|
|
|
|
2023-02-02 23:37:40 +09:00
|
|
|
double elapsed_time = uNet_en - uNet_st;
|
2023-02-01 22:30:00 +09:00
|
|
|
printf("Done!\n");
|
|
|
|
|
|
|
|
// Print first few result
|
|
|
|
print_first_few_result(output, print_max, elapsed_time);
|
|
|
|
|
|
|
|
// Finalize program
|
2023-02-02 23:37:40 +09:00
|
|
|
uNet_finalize();
|
2023-02-01 22:30:00 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|