diff --git a/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt b/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt index 24c200f5e81e6776f940d639232a5e7a815c069e..805848d63001850ccfabba4cfff406d8d4e7e95c 100644 --- a/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt +++ b/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt @@ -94,7 +94,7 @@ add_tensor_runtime(tensor_runtime_online -DONLINE_PROFILING=true -DFP16_tuning=f add_dependencies(tensor_runtime_online tensor_runtime) # Adding rule for the debugging source -add_executable(unit_tests dnn_sources/src/unit_tests.cc) +add_executable(unit_tests dnn_sources/src/unit_tests.cc) target_link_libraries(unit_tests tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) # -- Compile tensor_runtime.ll if possible @@ -133,63 +133,55 @@ endif() #**************** FP32 TensorRT Source Builds *********** -add_executable(lenet_mnist_fp32 dnn_sources/src/fp32/lenet_mnist.cc) -target_link_libraries(lenet_mnist_fp32 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) +add_executable(lenet_mnist_fp32 dnn_sources/src/fp32/lenet_mnist.cc) +target_link_libraries(lenet_mnist_fp32 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) -add_executable(alexnet_cifar10_fp32 dnn_sources/src/fp32/alexnet_cifar10.cc) -target_link_libraries(alexnet_cifar10_fp32 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) +add_executable(alexnet_cifar10_fp32 dnn_sources/src/fp32/alexnet_cifar10.cc) +target_link_libraries(alexnet_cifar10_fp32 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) -add_executable(alexnet2_cifar10_fp32 dnn_sources/src/fp32/alexnet2_cifar10.cc) -target_link_libraries(alexnet2_cifar10_fp32 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) +add_executable(alexnet2_cifar10_fp32 dnn_sources/src/fp32/alexnet2_cifar10.cc) +target_link_libraries(alexnet2_cifar10_fp32 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) -add_executable(vgg16_cifar10_fp32 dnn_sources/src/fp32/vgg16_cifar10.cc) -target_link_libraries(vgg16_cifar10_fp32 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) +add_executable(vgg16_cifar10_fp32 dnn_sources/src/fp32/vgg16_cifar10.cc) +target_link_libraries(vgg16_cifar10_fp32 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) -add_executable(resnet18_cifar10_fp32 dnn_sources/src/fp32/resnet18_cifar10.cc) -target_link_libraries(resnet18_cifar10_fp32 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) +add_executable(resnet18_cifar10_fp32 dnn_sources/src/fp32/resnet18_cifar10.cc) +target_link_libraries(resnet18_cifar10_fp32 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) -add_executable(vgg16_cifar100_fp32 dnn_sources/src/fp32/vgg16_cifar100.cc) -target_link_libraries(vgg16_cifar100_fp32 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) +add_executable(vgg16_cifar100_fp32 dnn_sources/src/fp32/vgg16_cifar100.cc) +target_link_libraries(vgg16_cifar100_fp32 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) -add_executable(mobilenet_cifar10_fp32 dnn_sources/src/fp32/mobilenet.cc) -target_link_libraries(mobilenet_cifar10_fp32 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) +add_executable(mobilenet_cifar10_fp32 dnn_sources/src/fp32/mobilenet.cc) +target_link_libraries(mobilenet_cifar10_fp32 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) -add_executable(alexnet_imagenet_fp32 dnn_sources/src/fp32/alexnet_imagenet.cc) -target_link_libraries(alexnet_imagenet_fp32 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) +add_executable(alexnet_imagenet_fp32 dnn_sources/src/fp32/alexnet_imagenet.cc) +target_link_libraries(alexnet_imagenet_fp32 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) -add_executable(vgg16_imagenet_fp32 dnn_sources/src/fp32/vgg16_imagenet.cc) -target_link_libraries(vgg16_imagenet_fp32 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) +add_executable(vgg16_imagenet_fp32 dnn_sources/src/fp32/vgg16_imagenet.cc) +target_link_libraries(vgg16_imagenet_fp32 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) -add_executable(resnet50_imagenet_fp32 dnn_sources/src/fp32/resnet50_imagenet.cc) -target_link_libraries(resnet50_imagenet_fp32 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) +add_executable(resnet50_imagenet_fp32 dnn_sources/src/fp32/resnet50_imagenet.cc) +target_link_libraries(resnet50_imagenet_fp32 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) #********* FP16 TensorRT Source Builds ****** -add_executable(lenet_mnist_fp16 dnn_sources/src/fp16/lenet_mnist_half.cc) -target_link_libraries(lenet_mnist_fp16 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) +add_executable(lenet_mnist_fp16 dnn_sources/src/fp16/lenet_mnist_half.cc) +target_link_libraries(lenet_mnist_fp16 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) -add_executable(alexnet_cifar10_fp16 dnn_sources/src/fp16/alexnet_cifar10_half.cc) -target_link_libraries(alexnet_cifar10_fp16 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) +add_executable(alexnet_cifar10_fp16 dnn_sources/src/fp16/alexnet_cifar10_half.cc) +target_link_libraries(alexnet_cifar10_fp16 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) -add_executable(alexnet2_cifar10_fp16 dnn_sources/src/fp16/alexnet2_cifar10_half.cc) -target_link_libraries(alexnet2_cifar10_fp16 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) +add_executable(alexnet2_cifar10_fp16 dnn_sources/src/fp16/alexnet2_cifar10_half.cc) +target_link_libraries(alexnet2_cifar10_fp16 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) -add_executable(resnet18_cifar10_fp16 dnn_sources/src/fp16/resnet18_cifar10_half.cc) -target_link_libraries(resnet18_cifar10_fp16 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) +add_executable(resnet18_cifar10_fp16 dnn_sources/src/fp16/resnet18_cifar10_half.cc) +target_link_libraries(resnet18_cifar10_fp16 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) -add_executable(vgg16_cifar10_fp16 dnn_sources/src/fp16/vgg16_cifar10_half.cc) -target_link_libraries(vgg16_cifar10_fp16 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) +add_executable(vgg16_cifar10_fp16 dnn_sources/src/fp16/vgg16_cifar10_half.cc) +target_link_libraries(vgg16_cifar10_fp16 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) -add_executable(vgg16_cifar100_fp16 dnn_sources/src/fp16/vgg16_cifar100_half.cc) -target_link_libraries(vgg16_cifar100_fp16 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) +add_executable(vgg16_cifar100_fp16 dnn_sources/src/fp16/vgg16_cifar100_half.cc) +target_link_libraries(vgg16_cifar100_fp16 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) -add_executable(mobilenet_cifar10_fp16 dnn_sources/src/fp16/mobilenet_half.cc) -target_link_libraries(mobilenet_cifar10_fp16 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) - - -file(GLOB files "dnn_sources/src/dynamic/*.cpp") -foreach(file ${files}) - get_filename_component(stem ${file} NAME_WE) - add_executable(${stem} ${file}) - target_link_libraries(${stem} tensor_runtime ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) -endforeach() +add_executable(mobilenet_cifar10_fp16 dnn_sources/src/fp16/mobilenet_half.cc) +target_link_libraries(mobilenet_cifar10_fp16 tensor_runtime_online ${GPU_PROFILER_LIB} ${SOC_SIMULATOR_LIB}) diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/include/op_overheads.h b/hpvm/projects/hpvm-tensor-rt/dnn_sources/include/op_overheads.h deleted file mode 100644 index 8a97fbf3d31917391c5269d185fd7f72116076bd..0000000000000000000000000000000000000000 --- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/include/op_overheads.h +++ /dev/null @@ -1,129 +0,0 @@ - - -#ifndef OP_OVERHEADS_HEADER -#define OP_OVERHEADS_HEADER - -#include <sstream> -#include "../../tensor_runtime/include/tensor.h" -#include "types.h" - -float scale_down_factor = 10000.0; -float error_factor = 0.1; -std::string result_str = ""; - -// TODO: Every routine needs testing - -// private function -static float getScaledComps(double total_comps, int error_scale) { - - total_comps = total_comps / scale_down_factor; - float comp_scale = 1.0 + (error_factor * error_scale); - total_comps = total_comps / comp_scale; - - return total_comps; -} - -static void addNormToResult(float comps) { - - std::ostringstream ss; - ss << std::fixed << comps; - - result_str.append(std::string(ss.str())); - result_str.append("\t"); -} - -static void addCompsToResult(float comps) { - - std::ostringstream ss; - ss << std::fixed << comps; - - result_str.append(std::string(ss.str())); - result_str.append("\n"); -} - -void add_conv_overheads(void *input_ptr, void *filter_ptr, int strideA, - int strideB, int error_scale) { - - Tensor *input = (Tensor *)input_ptr; - Tensor *filter = (Tensor *)filter_ptr; -} - -void add_gemm_overheads(void *lhs_ptr, void *rhs_ptr, int error_scale) { - - Tensor *lhs = (Tensor *)lhs_ptr; - Tensor *rhs = (Tensor *)rhs_ptr; - - int m = lhs->dims.dim_sizes[0]; - // The rhs last dimension must contain the neurons - int n = rhs->dims.dim_sizes[rhs->dims.num_dims - 1]; // output neurons - int k = 1; - - // Flattening the dimensions after the batch dimension - for (int j = 1; j < lhs->dims.num_dims; j++) { - k = k * lhs->dims.dim_sizes[j]; // input neurons - } - - int rhs_k = rhs->dims.dim_sizes[rhs->dims.num_dims - 2]; - // Dimension-note: Check if k is same across the two tensors - printf("m = %d, n = %d, k = %d \n", m, n, k); - - if (rhs_k != k) { - printf("rhs=%d and lhs=%d columns/rows don't match", rhs_k, k); - abort(); - } - - double total_comps = m * n * rhs_k * 1.0; - float scaled_comps = getScaledComps(total_comps, error_scale); - - printf("error_scale = %d, total_comps = %f, scaled_comps = %f \n", - error_scale, total_comps, scaled_comps); - - addCompsToResult(scaled_comps); -} - -void add_bias_overheads(void *input_ptr, int error_scale) { - - Tensor *input = (Tensor *)input_ptr; - - double total_comps = input->num_elems; - float scaled_comps = getScaledComps(total_comps, error_scale); - - printf("error_scale = %d, total_comps = %f, scaled_comps = %f \n", - error_scale, total_comps, scaled_comps); - - addCompsToResult(scaled_comps); -} - -void add_relu_overheads(void *input_ptr, int error_scale) { - - Tensor *input = (Tensor *)input_ptr; - - double total_comps = input->num_elems; - float scaled_comps = getScaledComps(total_comps, error_scale); - - printf("error_scale = %d, total_comps = %f, scaled_comps = %f \n", - error_scale, total_comps, scaled_comps); - - addCompsToResult(scaled_comps); -} - -float add_pool_overheads(void *input_ptr, int kernel_size, int stride_size, - int error_scale) {} - -void add_norms(void *norms_ptr) { - - Norm_t *norms = (Norm_t *)norms_ptr; - - addNormToResult(norms->l1_norm); - addNormToResult(norms->l2_norm); - addNormToResult(norms->inf_norm); -} - -void dump_result(char *file_name) { - - FILE *fp = fopen(file_name, "w+"); - fwrite(result_str.c_str(), 1, result_str.length(), fp); - fclose(fp); -} - -#endif diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/include/types.h b/hpvm/projects/hpvm-tensor-rt/dnn_sources/include/types.h deleted file mode 100644 index cafd37f703f4424b778f9d44afdb4b16f2ed1e80..0000000000000000000000000000000000000000 --- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/include/types.h +++ /dev/null @@ -1,39 +0,0 @@ - -#ifndef TYPES_HEADER -#define TYPES_HEADER - -/* -struct Dimension_t{ - int num_dims; - size_t* dim_sizes; -}; - - -struct Tensor_t{ - int tensor_id; // used for indexing (in the tensor runtime) - int data_type; // {float_type, double_type, half_type, int_type} - int data_format; // {nchw, nhwc} - void* host_data; - size_t num_elems; // Total elements - size_t size_in_bytes; // Total size in bytes - struct Dimension_t dims; -}; - - - -enum Tensor_type_t{ - float_type, - double_type, - half_type, - int_type -}; - - -// NOTE: Currently only NCHW is supported due to limited cuDNN support -enum Tensor_format_t{ - nchw, - nhwc -}; -*/ - -#endif diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/include/utils.h b/hpvm/projects/hpvm-tensor-rt/dnn_sources/include/utils.h index 43d4975749c7f69e7026043656a47c2cb4c6a79b..7bcfda70080688387e9bb74e8d25a1174a3e7337 100644 --- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/include/utils.h +++ b/hpvm/projects/hpvm-tensor-rt/dnn_sources/include/utils.h @@ -18,20 +18,6 @@ std::vector<float> run_accuracies; std::string model_params_path = "../../../build/model_params/"; -void printTensorInfo(void *tensor_ptr) { - - struct Tensor *tensor = (struct Tensor *)tensor_ptr; - - if (tensor->gpu_data != NULL) { - printf("Successful cudaMalloc \n"); - } - - printf("tensor dims = %d \n", tensor->dims.num_dims); - printf("dim1_size = %lu \n", tensor->dims.dim_sizes[0]); - printf("dim2_size = %lu \n", tensor->dims.dim_sizes[1]); - printf("num_elems = %lu \n", tensor->num_elems); -} - // FIXIT: Move this to debug.h and include in all files void dumpWeightsToFile(const char *file_name, void *weights_ptr) { @@ -121,18 +107,6 @@ void fillTensorWithNegOnes(void *tensor_ptr) { } } -void fillTensorVals(void *tensor_ptr) { - - struct Tensor *tensor = (struct Tensor *)tensor_ptr; - // initialization is specific to the floating point type - if (tensor->data_type == CUDNN_DATA_FLOAT) { - float *data_arr = (float *)tensor->host_data; - for (unsigned int i = 0; i < tensor->num_elems; i++) { - data_arr[i] = i + 1; - } - } -} - void printTensorValues(void *tensor_ptr) { struct Tensor *tensor = (struct Tensor *)tensor_ptr; @@ -163,107 +137,6 @@ void printTensorDims(void *tensor_ptr) { } } -void compareTensors(void *tensor1_ptr, void *tensor2_ptr) { - - struct Tensor *tensor1 = (struct Tensor *)tensor1_ptr; - struct Tensor *tensor2 = (struct Tensor *)tensor2_ptr; - - hpvm_request_tensor(tensor1, 0); - hpvm_request_tensor(tensor2, 0); - - float *tensor_data1 = (float *)tensor1->host_data; - float *tensor_data2 = (float *)tensor2->host_data; - - for (unsigned int i = 0; i < tensor1->num_elems; i++) { - if (tensor_data1[i] != tensor_data2[i]) { - printf("Tensor data mismatch at index %d \n", i); - abort(); - } - } -} - -void compareValues(void *tensor_ptr, float *data, size_t num_elems) { - - struct Tensor *tensor = (struct Tensor *)tensor_ptr; - - hpvm_request_tensor(tensor, 0); - - float *tensor_data = (float *)tensor->host_data; - for (unsigned int i = 0; i < num_elems; i++) { - if (tensor_data[i] != data[i]) { - printf("Tensor data mismatch"); - abort(); - } - } -} - -void *readInputTensor(const char *file_name, int data_type, int dim1_size, - int dim2_size, int dim3_size, int dim4_size) { - - size_t type_size = 4; // NOTE: Assuming floating point tensors - size_t num_elems = dim1_size * dim2_size * dim3_size * dim4_size; - size_t size_in_bytes = type_size * num_elems; - uint8_t *file_data = (uint8_t *)malloc(sizeof(char) * num_elems); - float *tensor_data = (float *)malloc(sizeof(float) * num_elems); - size_t file_header_size = 16; - - FILE *file = fopen(file_name, "rb"); - if (file == NULL) { - printf("Data file %s is not found. Aborting... \n", file_name); - abort(); - } - - fseek(file, file_header_size, SEEK_CUR); // Skipping the file header - fread(file_data, 1, sizeof(uint8_t) * num_elems, file); - fclose(file); - - for (size_t i = 0; i < num_elems; ++i) { - tensor_data[i] = (float)file_data[i] / 255.0f; - } - - // NOTE: Using NCHW format - struct Tensor *input = (struct Tensor *)create4DTensor( - data_type, nchw, dim1_size, dim2_size, dim3_size, dim4_size); - - initTensorData(input, tensor_data, size_in_bytes); - // compareValues(input, tensor_data, num_elems); - - return input; -} - -//*** FIXIT: Move this to CPU-only -struct Tensor *readTrainedWeightsCPU(const char *file_name, int data_type, - int dim1_size, int dim2_size, - int dim3_size, int dim4_size) { - - // FIXIT: Don't assume floating point types - int type_size = 4; // NOTE: Assuming floating point tensors - long int num_elems = dim1_size * dim2_size * dim3_size * dim4_size; - long int size_in_bytes = - type_size * dim1_size * dim2_size * dim3_size * dim4_size; - float *tensor_data = (float *)malloc(sizeof(float) * num_elems); - int file_header_size = 0; - - FILE *file = fopen(file_name, "rb"); - if (file == NULL) { - printf("Data file %s is not found. Aborting... \n", file_name); - abort(); - } - - fseek(file, file_header_size, SEEK_CUR); // Skipping the file header - fread(tensor_data, 1, size_in_bytes, file); - fclose(file); - - struct Tensor *weights = (struct Tensor *)create4DTensor( - data_type, nchw, dim1_size, dim2_size, dim3_size, dim4_size); - - initTensorData(weights, tensor_data, size_in_bytes); - // compareValues(weights, tensor_data, num_elems); - free(tensor_data); - - return weights; -} - struct Tensor *readTrainedWeights(const char *file_name, int data_type, long int dim1_size, long int dim2_size, long int dim3_size, long int dim4_size) { @@ -331,72 +204,6 @@ struct Tensor *readInputBatch(const char *file_name, int data_type, return weights; } -void *copyInputBatch(const char *file_name, int start, int end, - long int dim2_size, long int dim3_size, long int dim4_size, - void *inputTensor_ptr) { - - struct Tensor *inputTensor = (struct Tensor *)inputTensor_ptr; - - long int dim1_size = end - start; - // FIXIT: Don't assume floating point types - int type_size = 4; // NOTE: Assuming floating point tensors - long int num_elems = dim1_size * dim2_size * dim3_size * dim4_size; - long int size_in_bytes = - type_size * dim1_size * dim2_size * dim3_size * dim4_size; - float *tensor_data = (float *)malloc(sizeof(float) * num_elems); - int file_header_size = type_size * start * dim2_size * dim3_size * dim4_size; - - FILE *file = fopen(file_name, "rb"); - if (file == NULL) { - printf("Data file %s is not found. Aborting... \n", file_name); - abort(); - } - - fseek(file, file_header_size, SEEK_SET); // Skipping the file header - fread(tensor_data, 1, size_in_bytes, file); - fclose(file); - - initTensorData(inputTensor, tensor_data, size_in_bytes); - free(tensor_data); - - printf("******NOTE: tensor Dims = %d \n", inputTensor->dims.num_dims); - if (inputTensor->host_data == NULL || inputTensor->gpu_data == NULL) - printf("ERROR: NULL data pointers \n"); - - // Chaning Tensor Placement to HOST - changeTensorPlacement(inputTensor, HOST); - - return inputTensor; -} - -uint8_t *readLabels(const char *labels_file, int num_labels) { - - uint8_t *labels = (uint8_t *)malloc(sizeof(uint8_t) * num_labels); - FILE *file = fopen(labels_file, "rb"); - if (file == NULL) { - printf("Data file %s is not found. Aborting...\n", labels_file); - abort(); - } - fread(labels, 1, sizeof(uint8_t) * num_labels, file); - fclose(file); - - return labels; -} - -uint32_t *readLabels3(const char *labels_file, int num_labels) { - - uint32_t *labels = (uint32_t *)malloc(sizeof(uint32_t) * num_labels); - FILE *file = fopen(labels_file, "rb"); - if (file == NULL) { - printf("Data file %s is not found. Aborting...\n", labels_file); - abort(); - } - fread(labels, 1, sizeof(uint32_t) * num_labels, file); - fclose(file); - - return labels; -} - uint8_t *readLabelsBatch(const char *labels_file, int start, int end) { int num_labels = end - start; @@ -436,44 +243,6 @@ uint32_t *readLabelsBatch3(const char *labels_file, int start, int end) { return labels; } -void computeAccuracy(const char *labels_file, int num_labels, - void *result_ptr) { - - struct Tensor *result = (struct Tensor *)result_ptr; - - uint8_t *labels = readLabels(labels_file, num_labels); - size_t batch_dim = result->dims.dim_sizes[0]; - size_t channels = result->dims.dim_sizes[1]; - float *data = (float *)result->host_data; - int num_errors = 0; - - for (size_t i = 0; i < batch_dim; i++) { - int chosen = 0; - for (int id = 1; id < 10; ++id) { - if (data[i * channels + chosen] < data[i * channels + id]) - chosen = id; - } - - // printf("chosen = %d, label = %d \n", chosen, labels[i]); - if (chosen != labels[i]) - num_errors++; - } - - float accuracy = ((batch_dim - num_errors) * 1.0 / batch_dim * 1.0) * 100.0; - printf("****** Accuracy = %f \n\n", accuracy); - - FILE *fp = fopen("final_accuracy", "w+"); - if (fp != NULL) { - - std::ostringstream ss; - ss << std::fixed << accuracy; - std::string print_str = ss.str(); - - fwrite(print_str.c_str(), 1, print_str.length(), fp); - fclose(fp); - } -} - // NOTE: batch_size and num_classes are Unused arguments float computeAccuracy2(uint8_t *labels, int batch_size, void *result_ptr, size_t num_classes = 10) { @@ -558,68 +327,6 @@ float computeAccuracy3(uint32_t *labels, void *result_ptr) { return accuracy; } -struct ClassProb { - float prob; - int index; -}; - -bool descendFloatComp(ClassProb obj1, ClassProb obj2) { - return obj1.prob > obj2.prob; -} - -float computeTop5Accuracy(uint8_t *labels, int num_labels, void *result_ptr, - unsigned num_classes = 10) { - - struct Tensor *result = (struct Tensor *)result_ptr; - - size_t batch_dim = result->dims.dim_sizes[0]; - size_t channels = result->dims.dim_sizes[1]; - float *data = (float *)result->host_data; - int num_errors = 0; - - printf("batch_dim = %lu, channels = %lu \n", batch_dim, channels); - - for (int i = 0; i < num_labels; i++) { - - std::vector<ClassProb> elem_probs; - for (size_t id = 0; id < num_classes; ++id) { - ClassProb cProb; - cProb.prob = data[i * channels + id]; - cProb.index = id; - elem_probs.push_back(cProb); - } - - std::sort(elem_probs.begin(), elem_probs.end(), descendFloatComp); - // Check if any of top-5 predictions matches - bool matched = false; - for (int j = 0; j < 5; j++) { - ClassProb cProb = elem_probs[j]; - if (cProb.index == labels[i]) - matched = true; - } - - if (!matched) - num_errors += 1; - } - - float accuracy = ((batch_dim - num_errors) * 1.0 / batch_dim * 1.0) * 100.0; - printf("****** Accuracy = %f \n\n", accuracy); - - FILE *fp = fopen("final_accuracy", "w+"); - if (fp != NULL) { - - std::ostringstream ss; - ss << std::fixed << accuracy; - std::string print_str = ss.str(); - - fwrite(print_str.c_str(), 1, print_str.length(), fp); - } - - fclose(fp); - - return accuracy; -} - void dumpFinalAccuracy(float accuracy) { printf("\n\n **** Final Accuracy = %f \n", accuracy); @@ -638,32 +345,6 @@ void dumpFinalAccuracy(float accuracy) { run_accuracies.push_back(accuracy); } -void dumpAvgPSNR(float avg_psnr) { - - FILE *fp = fopen("avg_psnr", "w+"); - if (fp != NULL) { - std::ostringstream ss; - ss << std::fixed << avg_psnr; - std::string print_str = ss.str(); - fwrite(print_str.c_str(), 1, print_str.length(), fp); - } - - fclose(fp); -} - -void dumpPSNRStd(float psnr_std) { - - FILE *fp = fopen("psnr_std.txt", "w+"); - if (fp != NULL) { - std::ostringstream ss; - ss << std::fixed << psnr_std; - std::string print_str = ss.str(); - fwrite(print_str.c_str(), 1, print_str.length(), fp); - } - - fclose(fp); -} - void dumpExecutionAccuracies() { FILE *fp = fopen("run_accuracies.txt", "w+"); @@ -680,207 +361,4 @@ void dumpExecutionAccuracies() { fclose(fp); } - -float readPSNRFromFile(const char *file_name) { - - float psnr; - FILE *pFile = fopen(file_name, "r"); - if (pFile == NULL) { - printf("ERROR: psnr.txt not found! \n"); - abort(); - } - - fscanf(pFile, "%f", &psnr); - printf("**** PSNR read = %f \n\n", psnr); - return psnr; -} - -float computePSNRViolation(void *gold_ptr, void *approx_ptr, - float PSNR_threshold) { - - PSNR_threshold = readPSNRFromFile("psnr.txt"); - std::vector<float> psnr_list; - - struct Tensor *gold_tensor = (struct Tensor *)gold_ptr; - struct Tensor *approx_tensor = (struct Tensor *)approx_ptr; - - size_t *dim_sizes = gold_tensor->dims.dim_sizes; - size_t batch_dim = dim_sizes[0]; - size_t image_size = dim_sizes[1] * dim_sizes[2] * dim_sizes[3]; - - printf("batch_dim = %lu, image_size = %lu \n", batch_dim, image_size); - - float *gold_data = (float *)gold_tensor->host_data; - float *approx_data = (float *)approx_tensor->host_data; - - FILE *fp = fopen("img_psnr.txt", "w+"); - - float sum_psnr = 0.0; - int num_errors = 0; - for (size_t i = 0; i < batch_dim; i++) { - float mse_sum = 0.0; - float max_val = -999999; - size_t offset = i * image_size; - - for (size_t j = 0; j < image_size; j++) { - float diff = gold_data[offset + j] - approx_data[offset + j]; - float diff_square = diff * diff; - mse_sum += diff_square; - - if (max_val < gold_data[offset + j]) { - max_val = gold_data[offset + j]; - } - } - - mse_sum = mse_sum / image_size; - float psnr = 20 * log10(255 / sqrt(mse_sum)); - - sum_psnr += psnr; - if (psnr < PSNR_threshold) - num_errors += 1; - - printf("PSNR value = %f \n", psnr); - psnr_list.push_back(psnr); - - std::ostringstream ss; - ss << std::fixed << psnr; - std::string print_str = ss.str(); - fwrite(print_str.c_str(), 1, print_str.length(), fp); - fwrite("\n", 1, 1, fp); - } - - float violation_rate = (num_errors * 1.0) / batch_dim * 100.0; - printf("*** violation_rate= %f \n\n", violation_rate); - - float avg_psnr = sum_psnr / batch_dim; - printf("*** avg_psnr = %f \n\n", avg_psnr); - dumpAvgPSNR(avg_psnr); - - float success_rate = 100.0 - violation_rate; - dumpFinalAccuracy(success_rate); - - fclose(fp); - - float var = 0.0; - for (size_t i = 0; i < batch_dim; i++) { - var = var + (psnr_list[i] - avg_psnr) * (psnr_list[i] - avg_psnr); - } - - var /= batch_dim; - float std = sqrt(var); - - dumpPSNRStd(std); - - return violation_rate; -} - -void dumpOutput(void *output_ptr, const char *file_name) { - - struct Tensor *out_tensor = (struct Tensor *)output_ptr; - size_t size_in_bytes = out_tensor->size_in_bytes; - printf("** Output size = %lu \n", size_in_bytes); - - float *host_data = (float *)out_tensor->host_data; - FILE *fd = fopen(file_name, "w+"); - fwrite(host_data, 1, size_in_bytes, fd); - fclose(fd); -} - -void copyClassConfsAndLabels(void *result_ptr, float *classConfs, - int *predictedLabels, int start, int end) { - - struct Tensor *result = (struct Tensor *)result_ptr; - - size_t num_classes = result->dims.dim_sizes[1]; - float *data = (float *)result->host_data; - - int it_count = end - start; - for (int i = 0; i < it_count; i++) { - - int chosen = 0; - for (size_t id = 1; id < num_classes; ++id) { - if (data[i * num_classes + chosen] < data[i * num_classes + id]) - chosen = id; - } - - predictedLabels[start + i] = chosen; - classConfs[start + i] = data[i * num_classes + chosen]; - } -} - -void dumpClassConfsAndLabels(float *classConfs, int *predictedLabels, - uint32_t *goldLabels, int test_input_size) { - - FILE *labels_fp = fopen("predicted_confs_labels.txt", "w+"); - - for (int i = 0; i < test_input_size; i++) { - - int label = predictedLabels[i]; - int gold_label = (int)goldLabels[i]; - float conf = classConfs[i]; - - std::ostringstream ss; - ss << std::fixed << conf; - std::string print_str = ss.str(); - fwrite(print_str.c_str(), 1, print_str.length(), labels_fp); - fwrite(" ", 1, 1, labels_fp); - - std::ostringstream label_ss; - label_ss << label; - std::string label_str = label_ss.str(); - fwrite(label_str.c_str(), 1, label_str.length(), labels_fp); - fwrite(" ", 1, 1, labels_fp); - - std::ostringstream gold_ss; - gold_ss << gold_label; - std::string gold_str = gold_ss.str(); - fwrite(gold_str.c_str(), 1, gold_str.length(), labels_fp); - fwrite("\n", 1, 1, labels_fp); - } - - fclose(labels_fp); -} - -/**** Routines for Handling Piped Execution ***/ -void stallOnOpenTunerSignal() { - - const char *myfifo = "/tmp/opentuner_fifo"; - int fd = open(myfifo, O_RDONLY); - if (fd == -1) { - printf("OpenTuner pipe could not be opened \n"); - abort(); - } - - int ret_val = fcntl(fd, F_GETFD); - if (ret_val == -1) { - printf("Invalid descriptor \n"); - abort(); - } - - char str[100]; - read(fd, str, 100); - readOpenTunerFlags("promise_flags"); - - if (strcmp(str, "stop_run") == 0) { - abort(); - } - - close(fd); -} - -void signalPipeToOpenTuner() { - - const char *myfifo = "/tmp/opentuner_fifo"; - int fd_out = open(myfifo, O_WRONLY); - int ret_val = fcntl(fd_out, F_GETFD); - if (ret_val == -1) { - printf("Invalid descriptor \n"); - abort(); - } - - const char *str = "completed***!\n\0"; - write(fd_out, str, 80); - close(fd_out); -} - #endif diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/include/utils_cpu.h b/hpvm/projects/hpvm-tensor-rt/dnn_sources/include/utils_cpu.h deleted file mode 100644 index ef4d1afda71dba0a851af796be524099e3ae524e..0000000000000000000000000000000000000000 --- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/include/utils_cpu.h +++ /dev/null @@ -1,440 +0,0 @@ - -// Header guards -#ifndef UTILS_HEADER -#define UTILS_HEADER - -#include <sstream> -#include <vector> -#include <bits/stdc++.h> -#include "../../tensor_runtime/include/tensor_cpu.h" -#include "../../tensor_runtime/include/tensor_cpu_runtime.h" -//#include "types.h" -#include <cmath> -#include <stdint.h> - -std::vector<float> run_accuracies; - -void printTensorInfo(void *tensor_ptr) { - - struct Tensor *tensor = (struct Tensor *)tensor_ptr; - - if (tensor->gpu_data != NULL) { - printf("Successful cudaMalloc \n"); - } - - printf("tensor dims = %d \n", tensor->dims.num_dims); - printf("dim1_size = %lu \n", tensor->dims.dim_sizes[0]); - printf("dim2_size = %lu \n", tensor->dims.dim_sizes[1]); - printf("num_elems = %lu \n", tensor->num_elems); -} - -void printTensorDims(void *tensor_ptr) { - - struct Tensor *tensor = (struct Tensor *)tensor_ptr; - - printf("Num_elems = %lu \n", tensor->num_elems); - for (int i = 0; i < tensor->dims.num_dims; i++) { - printf("dim[%d] = %lu \n", i, tensor->dims.dim_sizes[i]); - } -} - -void compareTensors(void *tensor1_ptr, void *tensor2_ptr) { - - struct Tensor *tensor1 = (struct Tensor *)tensor1_ptr; - struct Tensor *tensor2 = (struct Tensor *)tensor2_ptr; - - // hpvm_request_tensor(tensor1, 0); - // hpvm_request_tensor(tensor2, 0); - - float *tensor_data1 = (float *)tensor1->host_data; - float *tensor_data2 = (float *)tensor2->host_data; - - for (unsigned int i = 0; i < tensor1->num_elems; i++) { - if (tensor_data1[i] != tensor_data2[i]) { - printf("Tensor data mismatch at index %d \n", i); - abort(); - } - } -} - -//*** FIXIT: Move this to CPU-only -struct Tensor *readTrainedWeightsCPU(const char *file_name, int data_type, - int dim1_size, int dim2_size, - int dim3_size, int dim4_size) { - - // FIXIT: Don't assume floating point types - int type_size = 4; // NOTE: Assuming floating point tensors - long int num_elems = dim1_size * dim2_size * dim3_size * dim4_size; - long int size_in_bytes = - type_size * dim1_size * dim2_size * dim3_size * dim4_size; - float *tensor_data = (float *)malloc(sizeof(float) * num_elems); - int file_header_size = 0; - - FILE *file = fopen(file_name, "rb"); - if (file == NULL) { - printf("Data file %s is not found. Aborting... \n", file_name); - abort(); - } - - fseek(file, file_header_size, SEEK_CUR); // Skipping the file header - size_t bytes_read = fread(tensor_data, 1, size_in_bytes, file); - - printf("size in bytes = %lu, bytes read = %lu \n", size_in_bytes, bytes_read); - - fclose(file); - - struct Tensor *weights = (struct Tensor *)create4DTensor( - data_type, nchw, dim1_size, dim2_size, dim3_size, dim4_size); - - initTensorData(weights, tensor_data, size_in_bytes); - // compareValues(weights, tensor_data, num_elems); - free(tensor_data); - - return weights; -} - -struct Tensor *readTrainedWeights(const char *file_name, int data_type, - int dim1_size, int dim2_size, int dim3_size, - int dim4_size) { - - return readTrainedWeightsCPU(file_name, data_type, dim1_size, dim2_size, - dim3_size, dim4_size); -} - -uint8_t *readLabels(const char *labels_file, int num_labels) { - - uint8_t *labels = (uint8_t *)malloc(sizeof(uint8_t) * num_labels); - FILE *file = fopen(labels_file, "rb"); - if (file == NULL) { - printf("Data file %s is not found. Aborting...\n", labels_file); - abort(); - } - - size_t bytes_read = fread(labels, 1, sizeof(uint8_t) * num_labels, file); - - fclose(file); - - return labels; -} - -uint8_t *readLabelsBatch(const char *labels_file, int start, int end) { - - int num_labels = end - start; - int file_header_size = sizeof(uint8_t) * start; - - uint8_t *labels = (uint8_t *)malloc(sizeof(uint8_t) * num_labels); - FILE *file = fopen(labels_file, "rb"); - if (file == NULL) { - printf("Data file %s is not found. Aborting...\n", labels_file); - abort(); - } - - fseek(file, file_header_size, SEEK_SET); // Skipping the file header - - size_t bytes_read = fread(labels, 1, sizeof(uint8_t) * num_labels, file); - - fclose(file); - - return labels; -} - -void computeAccuracy(const char *labels_file, int num_labels, - void *result_ptr) { - - struct Tensor *result = (struct Tensor *)result_ptr; - - uint8_t *labels = readLabels(labels_file, num_labels); - size_t batch_dim = result->dims.dim_sizes[0]; - size_t channels = result->dims.dim_sizes[1]; - float *data = (float *)result->host_data; - int num_errors = 0; - - for (int i = 0; i < batch_dim; i++) { - int chosen = 0; - for (int id = 1; id < 10; ++id) { - if (data[i * channels + chosen] < data[i * channels + id]) - chosen = id; - } - - if (chosen != labels[i]) - num_errors++; - } - - float accuracy = ((batch_dim - num_errors) * 1.0 / batch_dim * 1.0) * 100.0; - printf("****** Accuracy = %f \n\n", accuracy); - - FILE *fp = fopen("final_accuracy", "w+"); - if (fp != NULL) { - fprintf(fp, "%f", accuracy); - fclose(fp); - } -} - -float computeAccuracy2(uint8_t *labels, int num_labels, void *result_ptr, - unsigned num_classes = 10) { - - unsigned num_zeros = 0; - - struct Tensor *result = (struct Tensor *)result_ptr; - - size_t batch_dim = result->dims.dim_sizes[0]; - size_t channels = result->dims.dim_sizes[1]; - float *data = (float *)result->host_data; - int num_errors = 0; - - printf("batch_dim = %lu, channels = %lu \n", batch_dim, channels); - - for (int i = 0; i < num_labels; i++) { - int chosen = 0; - for (int id = 1; id < num_classes; ++id) { - if (data[i * channels + chosen] < data[i * channels + id]) - chosen = id; - } - - if (labels[i] == 0) - num_zeros++; - - if (chosen != labels[i]) - num_errors++; - } - - float accuracy = ((batch_dim - num_errors) * 1.0 / batch_dim * 1.0) * 100.0; - printf("****** Accuracy = %f \n\n", accuracy); - - FILE *fp = fopen("final_accuracy", "w+"); - if (fp != NULL) { - fprintf(fp, "%f", accuracy); - } - - fclose(fp); - - return accuracy; -} - -struct ClassProb { - float prob; - int index; -}; - -bool descendFloatComp(ClassProb obj1, ClassProb obj2) { - return obj1.prob > obj2.prob; -} - -float computeTop5Accuracy(uint8_t *labels, int num_labels, void *result_ptr, - unsigned num_classes = 10) { - - struct Tensor *result = (struct Tensor *)result_ptr; - - size_t batch_dim = result->dims.dim_sizes[0]; - size_t channels = result->dims.dim_sizes[1]; - float *data = (float *)result->host_data; - int num_errors = 0; - - printf("batch_dim = %lu, channels = %lu \n", batch_dim, channels); - - for (int i = 0; i < num_labels; i++) { - - std::vector<ClassProb> elem_probs; - for (int id = 0; id < num_classes; ++id) { - ClassProb cProb; - cProb.prob = data[i * channels + id]; - cProb.index = id; - elem_probs.push_back(cProb); - } - - std: - sort(elem_probs.begin(), elem_probs.end(), descendFloatComp); - // Check if any of top-5 predictions matches - bool matched = false; - for (int j = 0; j < 5; j++) { - ClassProb cProb = elem_probs[j]; - if (cProb.index == labels[i]) - matched = true; - } - - if (!matched) - num_errors += 1; - } - - float accuracy = ((batch_dim - num_errors) * 1.0 / batch_dim * 1.0) * 100.0; - printf("****** Accuracy = %f \n\n", accuracy); - - FILE *fp = fopen("final_accuracy", "w+"); - if (fp != NULL) { - fprintf(fp, "%f", accuracy); - } - - fclose(fp); - - return accuracy; -} - -void dumpFinalAccuracy(float accuracy) { - - printf("\n\n **** Final Accuracy = %f \n", accuracy); - - FILE *fp = fopen("final_accuracy", "w+"); - if (fp != NULL) { - fprintf(fp, "%f", accuracy); - } - - fclose(fp); - - run_accuracies.push_back(accuracy); -} - -/*void dumpAvgPSNR(float avg_psnr){ - - FILE* fp = fopen("avg_psnr", "w+"); - if(fp != NULL){ - std::ostringstream ss; - ss << std::fixed << avg_psnr; - std::string print_str = ss.str(); - fwrite(print_str.c_str(), 1, print_str.length(), fp); - } - - fclose(fp); -} -*/ - -/*void dumpPSNRStd(float psnr_std){ - - FILE* fp = fopen("psnr_std.txt", "w+"); - if(fp != NULL){ - std::ostringstream ss; - ss << std::fixed << psnr_std; - std::string print_str = ss.str(); - fwrite(print_str.c_str(), 1, print_str.length(), fp); - } - - fclose(fp); -}*/ - -/* -void dumpExecutionAccuracies(){ - - FILE* fp = fopen("run_accuracies.txt", "w+"); - if(fp != NULL){ - for (int i = 0; i < run_accuracies.size(); i++){ - float accuracy = run_accuracies[i]; - std::ostringstream ss; - ss << std::fixed << accuracy; - std::string print_str = ss.str(); - fwrite(print_str.c_str(), 1, print_str.length(), fp); - fwrite("\n", 1, 1, fp); - } - - } - - fclose(fp); -} -*/ - -float readPSNRFromFile(const char *file_name) { - - float psnr; - FILE *pFile = fopen(file_name, "r"); - if (pFile == NULL) { - printf("ERROR: psnr.txt not found! \n"); - abort(); - } - - fscanf(pFile, "%f", &psnr); - printf("**** PSNR read = %f \n\n", psnr); - return psnr; -} - -/*float computePSNRViolation(void* gold_ptr, void* approx_ptr, float -PSNR_threshold){ - - - PSNR_threshold = readPSNRFromFile("psnr.txt"); - std::vector<float> psnr_list; - - struct Tensor* gold_tensor = (struct Tensor*) gold_ptr; - struct Tensor* approx_tensor = (struct Tensor*) approx_ptr; - - size_t* dim_sizes = gold_tensor->dims.dim_sizes; - size_t batch_dim = dim_sizes[0]; - size_t image_size = dim_sizes[1] * dim_sizes[2] * dim_sizes[3]; - - printf("batch_dim = %lu, image_size = %lu \n", batch_dim, image_size); - - float* gold_data = (float*) gold_tensor->host_data; - float* approx_data = (float*) approx_tensor->host_data; - - FILE* fp = fopen("img_psnr.txt", "w+"); - - float sum_psnr = 0.0; - int num_errors = 0; - for(size_t i = 0; i < batch_dim; i++){ - float mse_sum = 0.0; - float max_val = -999999; - size_t offset = i * image_size; - - for(size_t j = 0; j < image_size; j++){ - float diff = gold_data[offset + j] - approx_data[offset + j]; - float diff_square = diff * diff; - mse_sum += diff_square; - - if(max_val < gold_data[offset + j]){ - max_val = gold_data[offset + j]; - } - } - - mse_sum = mse_sum / image_size; - float psnr = 20 * log10(255 / sqrt(mse_sum)); - - sum_psnr += psnr; - if (psnr < PSNR_threshold) - num_errors += 1; - - printf("PSNR value = %f \n", psnr); - psnr_list.push_back(psnr); - - std::ostringstream ss; - ss << std::fixed << psnr; - std::string print_str = ss.str(); - fwrite(print_str.c_str(), 1, print_str.length(), fp); - fwrite("\n", 1, 1, fp); - } - - float violation_rate = (num_errors * 1.0) / batch_dim * 100.0; - printf("*** violation_rate= %f \n\n", violation_rate); - - float avg_psnr = sum_psnr / batch_dim; - printf("*** avg_psnr = %f \n\n", avg_psnr); - dumpAvgPSNR(avg_psnr); - - float success_rate = 100.0 - violation_rate; - dumpFinalAccuracy(success_rate); - - fclose(fp); - - - float var = 0.0; - for(size_t i = 0; i < batch_dim; i++){ - var = var + (psnr_list[i] - avg_psnr) * (psnr_list[i] - avg_psnr); - } - - var /= batch_dim; - float std = sqrt(var); - - //dumpPSNRStd(std); - - return violation_rate; -}*/ - -void dumpOutput(void *output_ptr, const char *file_name) { - - struct Tensor *out_tensor = (struct Tensor *)output_ptr; - size_t size_in_bytes = out_tensor->size_in_bytes; - printf("** Output size = %lu \n", size_in_bytes); - - float *host_data = (float *)out_tensor->host_data; - FILE *fd = fopen(file_name, "w+"); - fwrite(host_data, 1, size_in_bytes, fd); - fclose(fd); -} - -#endif diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/alexnet2_cifar10_half.cc b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/alexnet2_cifar10_half.cc index 846500ad355a5bc61b6a6385afa5a7ee36ea22c0..8133e86ef9735932607b5548cec5910a907f7b3c 100644 --- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/alexnet2_cifar10_half.cc +++ b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/alexnet2_cifar10_half.cc @@ -1,13 +1,5 @@ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> - #include "../../../tensor_runtime/include/tensor_runtime.h" #include "../../include/utils.h" diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/alexnet_cifar10_half.cc b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/alexnet_cifar10_half.cc index 2bde9d1eea174d6773a52cf2d007b524108c55dd..020ad6d578bea8acae8cce5373bdf37ec7df1fd9 100644 --- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/alexnet_cifar10_half.cc +++ b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/alexnet_cifar10_half.cc @@ -1,11 +1,5 @@ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> + #include "../../../tensor_runtime/include/tensor_runtime.h" #include "../../include/utils.h" diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/lenet_mnist_half.cc b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/lenet_mnist_half.cc index 037a3d7a3eda161bd341c55b8501d2ae608517d5..0fb39cbe84af998ad42c9c14915e272aa3dab88d 100644 --- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/lenet_mnist_half.cc +++ b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/lenet_mnist_half.cc @@ -1,13 +1,5 @@ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> - #include "tensor_runtime.h" #include "utils.h" diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/mobilenet_half.cc b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/mobilenet_half.cc index 8940aeb3f1df087aac1e359ccae3f9b4391d2798..7722447047aaac6dc679fb02c16e6b2c20c2c049 100644 --- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/mobilenet_half.cc +++ b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/mobilenet_half.cc @@ -1,10 +1,4 @@ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> + #include "../../../tensor_runtime/include/tensor_runtime.h" #include "../../include/utils.h" diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/resnet18_cifar10_half.cc b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/resnet18_cifar10_half.cc index d674591027a9451d51d7a8a4243e7180e8abd24d..db8081c6b06e3529d76b13d64f3d25691184024c 100644 --- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/resnet18_cifar10_half.cc +++ b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/resnet18_cifar10_half.cc @@ -1,11 +1,5 @@ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> + #include "../../../tensor_runtime/include/tensor_runtime.h" #include "../../include/utils.h" diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/vgg16_cifar100_half.cc b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/vgg16_cifar100_half.cc index fff901a330c334ec31b7da0709ae9acd5b39f634..1bd79c7fb71400edd900bceb42413cf4320005fe 100644 --- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/vgg16_cifar100_half.cc +++ b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/vgg16_cifar100_half.cc @@ -1,10 +1,4 @@ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> + #include "../../../tensor_runtime/include/tensor_runtime.h" #include "../../include/utils.h" diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/vgg16_cifar10_half.cc b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/vgg16_cifar10_half.cc index 3d6f0f3566914598279e2b0e070a7af287c388e5..22d2a3614cb668a668f60c7a3941e06d92ebf4de 100644 --- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/vgg16_cifar10_half.cc +++ b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/vgg16_cifar10_half.cc @@ -1,11 +1,5 @@ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> + #include "../../../tensor_runtime/include/tensor_runtime.h" #include "../../include/utils.h" diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/alexnet2_cifar10.cc b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/alexnet2_cifar10.cc index 20484a3a0bd67eeba88e44aeeffcae563512c349..7e2c4be6335e3de82b0719923554e17b74732b93 100644 --- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/alexnet2_cifar10.cc +++ b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/alexnet2_cifar10.cc @@ -1,13 +1,5 @@ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> - #include "../../tensor_runtime/include/tensor_runtime.h" #include "../include/utils.h" diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/alexnet_cifar10.cc b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/alexnet_cifar10.cc index 70d582d11cb47b8c51a52a72b1f9ca003cb0a305..1cee9b4fa5dd96bf74c4662d0d8edef34f8f2282 100644 --- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/alexnet_cifar10.cc +++ b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/alexnet_cifar10.cc @@ -1,11 +1,5 @@ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> + #include "../../tensor_runtime/include/tensor_runtime.h" #include "../include/utils.h" diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/alexnet_imagenet.cc b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/alexnet_imagenet.cc index 9d7e8fe2a27e1ef0eff9ab78c225659b6f2ab67f..0f8df1a4207502b345aa02835a4d77368a35aa92 100644 --- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/alexnet_imagenet.cc +++ b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/alexnet_imagenet.cc @@ -1,12 +1,5 @@ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> #include "tensor_runtime.h" #include "utils.h" diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/lenet_mnist.cc b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/lenet_mnist.cc index c32efad92feb55b3900d5d316110759504f0692c..cb6593f7d5cac872159c909c99fbde478729df29 100644 --- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/lenet_mnist.cc +++ b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/lenet_mnist.cc @@ -1,13 +1,5 @@ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> - #include "tensor_runtime.h" #include "utils.h" diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/mobilenet.cc b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/mobilenet.cc index 0820d4467a123644a1a1660adbefc5101c2c6206..44336b02e0297f0ecbc37d3dccea8b97e766a357 100644 --- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/mobilenet.cc +++ b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/mobilenet.cc @@ -1,12 +1,5 @@ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> #include "../../tensor_runtime/include/tensor_runtime.h" #include "../include/utils.h" diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/resnet18_cifar10.cc b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/resnet18_cifar10.cc index dc462f3943546fa6d924ed92ab16ba517320bf17..a7355fb063b37a90ab04d077d1c1b32f26613857 100644 --- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/resnet18_cifar10.cc +++ b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/resnet18_cifar10.cc @@ -1,11 +1,5 @@ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> + #include "../../tensor_runtime/include/tensor_runtime.h" #include "../include/utils.h" diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/resnet50_imagenet.cc b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/resnet50_imagenet.cc index 1329c0b9b880021f65d7307f37977cb76afad5fa..afa3f0bcc1b08fc4a89c694e8e07e813b352ccbf 100644 --- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/resnet50_imagenet.cc +++ b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/resnet50_imagenet.cc @@ -1,11 +1,5 @@ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> + #include "../../tensor_runtime/include/tensor_runtime.h" #include "../include/utils.h" diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/vgg16_cifar10.cc b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/vgg16_cifar10.cc index 7807cdced2f5472ff4dfe70c855e82da345f7953..034ddb0cf8d6b286544c669375a46746ad23d4d2 100644 --- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/vgg16_cifar10.cc +++ b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/vgg16_cifar10.cc @@ -1,11 +1,5 @@ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> + #include "../../tensor_runtime/include/tensor_runtime.h" #include "../include/utils.h" diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/vgg16_cifar100.cc b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/vgg16_cifar100.cc index 22afc20687f8d85b2033c01a375a9960a50e07d8..94ca77329bc2f31d251590df3916d3cb10673fda 100644 --- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/vgg16_cifar100.cc +++ b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/vgg16_cifar100.cc @@ -1,11 +1,5 @@ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> + #include "../../tensor_runtime/include/tensor_runtime.h" #include "../include/utils.h" diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/vgg16_imagenet.cc b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/vgg16_imagenet.cc index 0e0a1dfbbca765dd323d83227476650d2d14460f..c5da3faf7860df24e25293acaacc1c50bcdceb72 100644 --- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/vgg16_imagenet.cc +++ b/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/vgg16_imagenet.cc @@ -1,11 +1,5 @@ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> + #include "tensor_runtime.h" #include "utils.h"