From 46a286d1c4bfa4fff232e2a0df0d54cb2e3fa681 Mon Sep 17 00:00:00 2001 From: GokayGulsoy Date: Thu, 2 Nov 2023 18:11:12 +0300 Subject: [PATCH 1/3] uncompatible string types (conversion to string object) --- ECR/ECR/batchedECR.cu | 2 +- ECR/ECR/time_vgg/batchedECR.cu | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ECR/ECR/batchedECR.cu b/ECR/ECR/batchedECR.cu index b8d0ec0..aa94b8a 100644 --- a/ECR/ECR/batchedECR.cu +++ b/ECR/ECR/batchedECR.cu @@ -234,7 +234,7 @@ int main(int argc, char *argv[]) } open_kernel.close(); - ofstream time_file(string("ECR/ECR/time_vgg/batchsize") + argv[1] + string(".txt")); + ofstream time_file("ECR/ECR/time_vgg/batchsize" + std::to_string(atoi(argv[1])) + string(".txt")); // resnet is 32, vgg is 16, sp is 9, resnet is 49 for (int i = 1; i < 16; i++) { diff --git a/ECR/ECR/time_vgg/batchedECR.cu b/ECR/ECR/time_vgg/batchedECR.cu index 30d7929..6a8b1c8 100644 --- a/ECR/ECR/time_vgg/batchedECR.cu +++ b/ECR/ECR/time_vgg/batchedECR.cu @@ -234,7 +234,7 @@ int main(int argc, char *argv[]) } open_kernel.close(); - ofstream time_file("ECR/ECR/time_vgg/batchsize" + argv[1] + string(".txt")); + ofstream time_file("ECR/ECR/time_vgg/batchsize" + std::to_string(atoi(argv[1])) + string(".txt")); // resnet is 32, vgg is 16, sp is 9, resnet is 49 for (int i = 0; i < 16; i++) { From 402abe68c0d1303183400193da0785fec3993e94 Mon Sep 17 00:00:00 2001 From: GokayGulsoy Date: Thu, 2 Nov 2023 18:20:25 +0300 Subject: [PATCH 2/3] return type of LoadKernel function should be float and for loop paranthesis are closed correctly --- PECR/cudnn/time_vgg/cudnn_half.cu | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/PECR/cudnn/time_vgg/cudnn_half.cu b/PECR/cudnn/time_vgg/cudnn_half.cu index 224adc1..a106967 100644 --- a/PECR/cudnn/time_vgg/cudnn_half.cu +++ b/PECR/cudnn/time_vgg/cudnn_half.cu @@ -53,8 +53,11 @@ half *LoadvggKernel(string name, int *&kernel_width, int *&kernel_height, int ba return kernel; } -half *LoadKernel(string name, int *&kernel_width, int *&kernel_height, int batch_size, int index) +// half return type should be replaced with float + +float *LoadKernel(string name, int *&kernel_width, int *&kernel_height, int batch_size, int index) { + float temp; // ifstream kernel_shape("/home/syt/conv_pool/conv_pool/dataset/kernel/kernel_shape/" + name); // for (int i = 0; i < 2; i++) // { @@ -70,10 +73,11 @@ half *LoadKernel(string name, int *&kernel_width, int *&kernel_height, int batch for (int i = 0; i < batch_size; i++) { ifstream kernel_data("/home/syt/conv_pool/conv_pool/dataset/resnetdataset_all/kernel/" + name); - for (int j = i * (*kernel_width * *kernel_height); j < (i + 1) * (*kernel_width * *kernel_height); j++) + for (int j = i * (*kernel_width * *kernel_height); j < (i + 1) * (*kernel_width * *kernel_height); j++) { kernel_data >> temp; kernel[j]=__float2half(temp); - kernel_data.close(); + } + kernel_data.close(); } return kernel; @@ -138,8 +142,9 @@ float *LoadConvWeight(int *&fea_width, int *&fea_height, int batch_size, int ind for (int i = 0; i < batch_size; i++) { ifstream fea_data("/home/syt/conv_pool/conv_pool/dataset/resnetdataset_all/feature/" + name[index]); - for (int j = i * (*fea_width * *fea_height); j < (i + 1) * (*fea_width * *fea_height); j++) + for (int j = i * (*fea_width * *fea_height); j < (i + 1) * (*fea_width * *fea_height); j++) { fea_data >> feature[j]; + } fea_data.close(); } From 4bf6a66f9d4703911cc2fe448c00269200795dca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eymen=20=C3=9Cnay?= Date: Thu, 18 Jan 2024 10:20:13 +0300 Subject: [PATCH 3/3] Clang-formatted the change --- ECR/ECR/batchedECR.cu | 3 ++- ECR/ECR/time_vgg/batchedECR.cu | 3 ++- PECR/cudnn/time_vgg/cudnn_half.cu | 16 +++++++++------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/ECR/ECR/batchedECR.cu b/ECR/ECR/batchedECR.cu index aa94b8a..7a86f4e 100644 --- a/ECR/ECR/batchedECR.cu +++ b/ECR/ECR/batchedECR.cu @@ -234,7 +234,8 @@ int main(int argc, char *argv[]) } open_kernel.close(); - ofstream time_file("ECR/ECR/time_vgg/batchsize" + std::to_string(atoi(argv[1])) + string(".txt")); + ofstream time_file("ECR/ECR/time_vgg/batchsize" + + std::to_string(atoi(argv[1])) + string(".txt")); // resnet is 32, vgg is 16, sp is 9, resnet is 49 for (int i = 1; i < 16; i++) { diff --git a/ECR/ECR/time_vgg/batchedECR.cu b/ECR/ECR/time_vgg/batchedECR.cu index 6a8b1c8..dc09c0d 100644 --- a/ECR/ECR/time_vgg/batchedECR.cu +++ b/ECR/ECR/time_vgg/batchedECR.cu @@ -234,7 +234,8 @@ int main(int argc, char *argv[]) } open_kernel.close(); - ofstream time_file("ECR/ECR/time_vgg/batchsize" + std::to_string(atoi(argv[1])) + string(".txt")); + ofstream time_file("ECR/ECR/time_vgg/batchsize" + + std::to_string(atoi(argv[1])) + string(".txt")); // resnet is 32, vgg is 16, sp is 9, resnet is 49 for (int i = 0; i < 16; i++) { diff --git a/PECR/cudnn/time_vgg/cudnn_half.cu b/PECR/cudnn/time_vgg/cudnn_half.cu index a106967..b92634f 100644 --- a/PECR/cudnn/time_vgg/cudnn_half.cu +++ b/PECR/cudnn/time_vgg/cudnn_half.cu @@ -55,8 +55,8 @@ half *LoadvggKernel(string name, int *&kernel_width, int *&kernel_height, int ba // half return type should be replaced with float -float *LoadKernel(string name, int *&kernel_width, int *&kernel_height, int batch_size, int index) -{ +float *LoadKernel(string name, int *&kernel_width, int *&kernel_height, + int batch_size, int index) { float temp; // ifstream kernel_shape("/home/syt/conv_pool/conv_pool/dataset/kernel/kernel_shape/" + name); // for (int i = 0; i < 2; i++) @@ -73,11 +73,12 @@ float *LoadKernel(string name, int *&kernel_width, int *&kernel_height, int batc for (int i = 0; i < batch_size; i++) { ifstream kernel_data("/home/syt/conv_pool/conv_pool/dataset/resnetdataset_all/kernel/" + name); - for (int j = i * (*kernel_width * *kernel_height); j < (i + 1) * (*kernel_width * *kernel_height); j++) { + for (int j = i * (*kernel_width * *kernel_height); + j < (i + 1) * (*kernel_width * *kernel_height); j++) { kernel_data >> temp; kernel[j]=__float2half(temp); - } - kernel_data.close(); + } + kernel_data.close(); } return kernel; @@ -142,9 +143,10 @@ float *LoadConvWeight(int *&fea_width, int *&fea_height, int batch_size, int ind for (int i = 0; i < batch_size; i++) { ifstream fea_data("/home/syt/conv_pool/conv_pool/dataset/resnetdataset_all/feature/" + name[index]); - for (int j = i * (*fea_width * *fea_height); j < (i + 1) * (*fea_width * *fea_height); j++) { + for (int j = i * (*fea_width * *fea_height); + j < (i + 1) * (*fea_width * *fea_height); j++) { fea_data >> feature[j]; - } + } fea_data.close(); }