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. --- .../benchmarks/disparity/src/c/script_disparity.c | 132 +++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 SD-VBS/benchmarks/disparity/src/c/script_disparity.c (limited to 'SD-VBS/benchmarks/disparity/src/c/script_disparity.c') diff --git a/SD-VBS/benchmarks/disparity/src/c/script_disparity.c b/SD-VBS/benchmarks/disparity/src/c/script_disparity.c new file mode 100644 index 0000000..431c02c --- /dev/null +++ b/SD-VBS/benchmarks/disparity/src/c/script_disparity.c @@ -0,0 +1,132 @@ +/******************************** +Author: Sravanthi Kota Venkata +********************************/ + +#include +#include +#include "disparity.h" +#include +#include "extra.h" +#define DISPARITY_MEM 1<<24 +int main(int argc, char* argv[]) +{ + SET_UP + mallopt(M_TOP_PAD, DISPARITY_MEM); + mallopt(M_MMAP_MAX, 0); + int rows = 32; + int cols = 32; + I2D *imleft, *imright; + volatile I2D* retDisparity; + I2D *IrightPadded, *IleftPadded, *Iright_moved; + I2D *retDisp, *halfWin; + I2D *range; + F2D *retSAD, *minSAD, *SAD, *integralImg; + unsigned int *start, *endC, *elapsed; + + int i, j; + char im1[100], im2[100], timFile[100]; + int WIN_SZ=8, SHIFT=64; + FILE* fp; + + printf("Image 1: "); + scanf("%s", im1); + printf("Image 2: "); + scanf("%s", im2); +#ifdef CHECK + char checkFile[100] = "./expected_C.txt"; +#endif + imleft = readImage(im1); + imright = readImage(im2); + + rows = imleft->height; + cols = imleft->width; + +#ifdef test + WIN_SZ = 2; + SHIFT = 1; +#endif +#ifdef sim_fast + WIN_SZ = 4; + SHIFT = 4; +#endif +#ifdef sim + WIN_SZ = 4; + SHIFT = 8; +#endif + + + int nr, nc, k; + int half_win_sz; + nr = imleft->height; + nc = imleft->width; + half_win_sz = WIN_SZ / 2; + + minSAD = fSetArray(nr, nc, 255.0*255.0); + retDisp = iSetArray(nr, nc, SHIFT); + halfWin = iSetArray(1,2,half_win_sz); + + + if(WIN_SZ > 1) + { + IleftPadded = padarray2(imleft, halfWin); + IrightPadded = padarray2(imright, halfWin); + } + else + { + IleftPadded = imleft; + IrightPadded = imright; + } + + int paddedRows, paddedCols; + paddedRows = IleftPadded->height; + paddedCols = IleftPadded->width; + SAD = fSetArray(paddedRows, paddedCols,255); + integralImg = fSetArray(paddedRows, paddedCols,0); + retSAD = fMallocHandle(paddedRows- WIN_SZ, paddedCols - WIN_SZ); + Iright_moved = iSetArray(paddedRows, paddedCols, 0); + + range = iMallocHandle(1, 2); + printf("starting..\n"); + for_each_job{ + retDisparity = getDisparity(imleft, imright, WIN_SZ, SHIFT, + minSAD, retDisp, halfWin, + IrightPadded, IleftPadded, Iright_moved, + retSAD, SAD, integralImg, + range); + } + printf("ending\n"); + +#ifdef CHECK + /** Self checking - use expected.txt from data directory **/ + { + int tol, ret=0; + tol = 2; +#ifdef GENERATE_OUTPUT + writeMatrix(retDisparity, argv[1]); +#endif + ret = selfCheck(retDisparity, checkFile, tol); + if (ret == -1) + printf("Error in Disparity Map\n"); + } + /** Self checking done **/ +#endif + + //end of benchmark + fFreeHandle(minSAD); + fFreeHandle(SAD); + fFreeHandle(integralImg); + iFreeHandle(IrightPadded); + iFreeHandle(IleftPadded); + iFreeHandle(Iright_moved); + fFreeHandle(retSAD); + iFreeHandle(imleft); + iFreeHandle(imright); + iFreeHandle(retDisparity); + iFreeHandle(halfWin); + iFreeHandle(range); + free(start); + free(endC); + free(elapsed); + 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/disparity/src/c/script_disparity.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'SD-VBS/benchmarks/disparity/src/c/script_disparity.c') diff --git a/SD-VBS/benchmarks/disparity/src/c/script_disparity.c b/SD-VBS/benchmarks/disparity/src/c/script_disparity.c index 431c02c..7d45ada 100644 --- a/SD-VBS/benchmarks/disparity/src/c/script_disparity.c +++ b/SD-VBS/benchmarks/disparity/src/c/script_disparity.c @@ -28,9 +28,7 @@ int main(int argc, char* argv[]) int WIN_SZ=8, SHIFT=64; FILE* fp; - printf("Image 1: "); scanf("%s", im1); - printf("Image 2: "); scanf("%s", im2); #ifdef CHECK char checkFile[100] = "./expected_C.txt"; @@ -86,17 +84,15 @@ int main(int argc, char* argv[]) Iright_moved = iSetArray(paddedRows, paddedCols, 0); range = iMallocHandle(1, 2); - printf("starting..\n"); - for_each_job{ - retDisparity = getDisparity(imleft, imright, WIN_SZ, SHIFT, - minSAD, retDisp, halfWin, - IrightPadded, IleftPadded, Iright_moved, - retSAD, SAD, integralImg, - range); + for_each_job { + retDisparity = getDisparity(imleft, imright, WIN_SZ, SHIFT, + minSAD, retDisp, halfWin, + IrightPadded, IleftPadded, Iright_moved, + retSAD, SAD, integralImg, + range); } - printf("ending\n"); -#ifdef CHECK +#ifdef CHECK /** Self checking - use expected.txt from data directory **/ { int tol, ret=0; -- cgit v1.2.2