int main(int argc, char *argv[]) {

    log_open("./core_log.txt"); //或许写成参数更好,懒得写了

    atexit(output_result);  //退出程序时的回调函数,用于输出判题结果

    //为了构建沙盒,必须要有root权限
    if (geteuid() != 0) {
        FM_LOG_FATAL("You must run this program as root.");
        exit(JUDGE_CONF::EXIT_UNPRIVILEGED);
    }

    parse_arguments(argc, argv);

    JUDGE_CONF::JUDGE_TIME_LIMIT += PROBLEM::time_limit;

    if (EXIT_SUCCESS != malarm(ITIMER_REAL, JUDGE_CONF::JUDGE_TIME_LIMIT)) {
        FM_LOG_WARNING("Set the alarm for this judge program failed, %d: %s", errno, strerror(errno));
        exit(JUDGE_CONF::EXIT_VERY_FIRST);
    }
    signal(SIGALRM, timeout);

    compiler_source_code();

    judge();

    if (PROBLEM::spj) {
        run_spj();
    } else {
        if (PROBLEM::result == JUDGE_CONF::SE)
            PROBLEM::result = compare_output(PROBLEM::output_file, PROBLEM::exec_output);
    }

    return 0;
}
/**
 * Test case for radiation setup/fault injection
 * test_x is where the images are located
 * test_y is the output
 * test_size is how much images
 */
void ConvNet::test(vec2d_t test_x, vec_host test_y,
		std::vector<std::pair<size_t, bool>> gold_list, //gold for radiation test
		size_t iterations, bool save_layer, int sample_count) {
	test_x_ = test_x;
	test_y_ = test_y;
	test_size_ = sample_count;

	Timer compare_timer;

#ifdef GPU
	std::cout << "Testing with GPU " << std::endl;
#else
	std::cout << "Testing with CPU " << std::endl;
#endif // GPU

	//load all layers of the test
	std::vector<LayersGold> gold_layer_array(test_size_);
	if (save_layer) {
		for (size_t i = 0; i < test_size_; i++) {
			gold_layer_array[i] = load_gold_layers(i, this->layers.size());
		}
	}
	this->layers_output.resize(layers.size());

	for (size_t i = 0; i < iterations; i++) {
		this->mark.start();
		for (size_t iter = 0; iter < test_size_; iter++) {
			auto gold_out = gold_list[iter];

			//test under radiation
			start_iteration_app();
			auto result = test_once_pair(iter);
			end_iteration_app();

			std::cout << "Small iteration " << iter << "\n";

			//compare output
			compare_timer.start();
			auto cmp = compare_output(gold_out, result, iter);
			//log the result
			if (!cmp && save_layer) {
				compare_and_save_layers(gold_layer_array[iter],
						this->layers_output, i, iter);

			}
			compare_timer.stop();
			//-------------
		}

		this->mark.stop();
		std::cout << "Iteration: " << i << ". Time spent testing "
				<< this->test_size_ << " samples: " << this->mark << std::endl;
	}

}