From d17b33131c14864bd1eae275f49a3f148e21cf29 Mon Sep 17 00:00:00 2001 From: Leo Chan Date: Thu, 22 Oct 2020 01:53:21 -0400 Subject: Squashed commit of the sb-vbs branch. Includes the SD-VBS benchmarks modified to: - Use libextra to loop as realtime jobs - Preallocate memory before starting their main computation - Accept input via stdin instead of via argc Does not include the SD-VBS matlab code. Fixes libextra execution in LITMUS^RT. --- SD-VBS/benchmarks/sift/src/c/script_sift.c | 83 ++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 SD-VBS/benchmarks/sift/src/c/script_sift.c (limited to 'SD-VBS/benchmarks/sift/src/c/script_sift.c') diff --git a/SD-VBS/benchmarks/sift/src/c/script_sift.c b/SD-VBS/benchmarks/sift/src/c/script_sift.c new file mode 100644 index 0000000..0b2f106 --- /dev/null +++ b/SD-VBS/benchmarks/sift/src/c/script_sift.c @@ -0,0 +1,83 @@ +/******************************** +Author: Sravanthi Kota Venkata +********************************/ + +#include +#include +#include "sift.h" +#include +#include "extra.h" +#define SIFT_MEM 1<<29 +void normalizeImage(F2D* image) +{ + int i; + int rows; + int cols; + + int tempMin = 10000, tempMax = -1; + rows = image->height; + cols = image->width; + + for(i=0; i<(rows*cols); i++) + if(tempMin > asubsref(image,i)) + tempMin = asubsref(image,i); + + for(i=0; i<(rows*cols); i++) + asubsref(image,i) = asubsref(image,i) - tempMin; + + for(i=0; i<(rows*cols); i++) + if(tempMax < asubsref(image,i)) + tempMax = asubsref(image,i); + + for(i=0; i<(rows*cols); i++) + asubsref(image,i) = ( asubsref(image,i) / (tempMax+0.0) ); +} + +int main(int argc, char* argv[]) +{ + SET_UP + mallopt(M_TOP_PAD, SIFT_MEM); + mallopt(M_MMAP_MAX, 0); + I2D* im; + F2D *image; + int rows, cols, i, j; + F2D* frames; + unsigned int* startTime, *endTime, *elapsed; + + char imSrc[100]; + printf("Input image: "); + scanf("%s", imSrc); + im = readImage(imSrc); + image = fiDeepCopy(im); + rows = image->height; + cols = image->width; + + + printf("start\n"); + for_each_job{ + image = fiDeepCopy(im); + normalizeImage(image); + /** Extract sift features for the normalized image **/ + frames = sift(image); + } + printf("end..\n"); + +#ifdef CHECK + { + int ret=0; + float tol = 0.2; +#ifdef GENERATE_OUTPUT + fWriteMatrix(frames, argv[1]); +#endif + ret = fSelfCheck(frames, "expected_C.txt", tol); + if (ret == -1) + printf("Error in SIFT\n"); + } +#endif + + iFreeHandle(im); + fFreeHandle(frames); + WRITE_TO_FILE + return 0; +} + -- cgit v1.2.2 From 163c440444c74a4e0bbe0a8db3d1ca725413994b Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Thu, 22 Oct 2020 03:17:31 -0400 Subject: Make SD-VBS compatible with run_bench.sh and cleanup SD-VBS: - Run silently - Fix some whitespace errors - Don't duplicate extra.h - Auto-detect if building with LITMUS-RT - Disable result checking - Add helper symlinks Misc: - Remove unused code from libextra - Set some missing rt_param fields in libextra - Disable CSV info dump from computeSMTslowdown.sh - Widen scope of .gitignore on .txt files - Include list of 2MB DIS pair benchmarks and inputs --- SD-VBS/benchmarks/sift/src/c/script_sift.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'SD-VBS/benchmarks/sift/src/c/script_sift.c') diff --git a/SD-VBS/benchmarks/sift/src/c/script_sift.c b/SD-VBS/benchmarks/sift/src/c/script_sift.c index 0b2f106..ab39ae3 100644 --- a/SD-VBS/benchmarks/sift/src/c/script_sift.c +++ b/SD-VBS/benchmarks/sift/src/c/script_sift.c @@ -45,7 +45,6 @@ int main(int argc, char* argv[]) unsigned int* startTime, *endTime, *elapsed; char imSrc[100]; - printf("Input image: "); scanf("%s", imSrc); im = readImage(imSrc); image = fiDeepCopy(im); @@ -53,16 +52,14 @@ int main(int argc, char* argv[]) cols = image->width; - printf("start\n"); for_each_job{ image = fiDeepCopy(im); - normalizeImage(image); + normalizeImage(image); /** Extract sift features for the normalized image **/ frames = sift(image); } - printf("end..\n"); - -#ifdef CHECK + +#ifdef CHECK { int ret=0; float tol = 0.2; -- cgit v1.2.2