chundoong-lab-ta/APWS23/project/util.h

31 lines
1.2 KiB
C
Raw Normal View History

2023-02-01 22:30:00 +09:00
#pragma once
#include <cstdio>
#include <cstdlib>
#include <unistd.h>
#include <time.h>
/* Useful macros */
#define EXIT(status) \
do { \
exit(status); \
} while (0)
#define CHECK_ERROR(cond, fmt, ...) \
do { \
if (!(cond)) {\
printf(fmt "\n", ##__VA_ARGS__); \
EXIT(EXIT_FAILURE); \
} \
} while (false)
void print_usage_exit(int argc, char **argv);
void check_and_parse_args(int argc, char **argv);
double get_time();
2023-02-06 15:07:20 +09:00
void read_binary(void* dst, const char *filename, size_t *size);
2023-02-01 22:30:00 +09:00
void *read_binary(const char *filename, size_t *size);
2023-02-06 15:07:20 +09:00
void write_binary(void* dst, const char *filename, size_t size);
2023-02-03 01:25:19 +09:00
void print_first_few_result(float *output, int print_max, double elapsed_time);
2023-02-06 01:38:42 +09:00
void print_model();