From 80c73b45777b9d2c8ca2ccb2083f06d6d01abee0 Mon Sep 17 00:00:00 2001 From: tony <292224750@qq.com> Date: Tue, 6 Jun 2023 15:21:23 +0800 Subject: [PATCH] 1. Update the example scripts in scripts/scanThreads 2. Add the parameter passing logic to CPPAlgos --- .../scripts/scanThreads/config_BCoAMM.csv | 8 - .../config_CPPCOFD.csv} | 5 +- .../scanThreads/config_CPPCOUNTERSKETCH.csv | 10 + .../scripts/scanThreads/config_CPPCRS.csv | 5 +- .../config_CPPEWS.csv} | 5 +- .../scripts/scanThreads/config_CPPMM.csv | 5 +- .../scripts/scanThreads/config_CPPTOW.csv | 10 + benchmark/scripts/scanThreads/config_CRS.csv | 6 - .../scripts/scanThreads/config_CoAMM.csv | 8 - .../scanThreads/config_CounterSketch.csv | 8 - .../scripts/scanThreads/config_FDAMM.csv | 8 - benchmark/scripts/scanThreads/drawTogether.py | 18 +- .../scripts/scanThreadsRockPi5/OoOCommon.py | 0 .../scripts/scanThreadsRockPi5/accuBar.py | 0 .../scripts/scanThreadsRockPi5/autoParase.py | 0 .../config_CPPCOFD.csv} | 6 +- .../config_CPPCOUNTERSKETCH.csv | 10 + .../scanThreadsRockPi5/config_CPPCRS.csv | 5 +- .../scanThreadsRockPi5/config_CPPEWS.csv | 10 + .../scanThreadsRockPi5/config_CPPMM.csv | 5 +- .../scanThreadsRockPi5/config_CPPTOW.csv | 10 + .../scanThreadsRockPi5/drawTogether.py | 16 +- .../scanThreadsRockPi5/drawTogetherNoCRS.py | 212 ++++++++++++++++++ .../scripts/scanThreadsRockPi5/groupBar.py | 0 .../scripts/scanThreadsRockPi5/groupBar2.py | 0 .../scripts/scanThreadsRockPi5/groupLine.py | 0 benchmark/scripts/scanThreadsRockPi5/main.c | 14 -- benchmark/scripts/scanThreadsRockPi5/tb | Bin 8904 -> 0 bytes benchmark/src/Benchmark.cpp | 1 + commit_info | 3 +- include/AMMBench.h | 11 + include/CPPAlgos/AbstractCPPAlgo.h | 4 + include/CPPAlgos/BCRSCPPAlgo.h | 6 +- include/CPPAlgos/BetaCoOFDCPPAlgo.h | 14 +- include/CPPAlgos/CRSCPPAlgo.h | 2 +- include/CPPAlgos/CRSV2CPPAlgo.h | 3 +- include/CPPAlgos/CoOccurringFDCPPAlgo.h | 4 +- include/CPPAlgos/CountSketchCPPAlgo.h | 3 +- include/CPPAlgos/EWSCPPAlgo.h | 3 +- include/CPPAlgos/TugOfWarCPPAlgo.h | 6 +- src/CPPAlgos/AbstractCPPAlgo.cpp | 3 + src/CPPAlgos/BetaCoOFDCPPAlgo.cpp | 8 +- src/CPPAlgos/CPPAlgoTable.cpp | 2 +- src/Parallelization/BlockPartitionRunner.cpp | 1 + 44 files changed, 354 insertions(+), 104 deletions(-) delete mode 100644 benchmark/scripts/scanThreads/config_BCoAMM.csv rename benchmark/scripts/{scanThreadsRockPi5/config_CPPBCO.csv => scanThreads/config_CPPCOFD.csv} (79%) create mode 100644 benchmark/scripts/scanThreads/config_CPPCOUNTERSKETCH.csv rename benchmark/scripts/{scanThreadsRockPi5/config_CPPCounterSketch.csv => scanThreads/config_CPPEWS.csv} (80%) create mode 100644 benchmark/scripts/scanThreads/config_CPPTOW.csv delete mode 100644 benchmark/scripts/scanThreads/config_CRS.csv delete mode 100644 benchmark/scripts/scanThreads/config_CoAMM.csv delete mode 100644 benchmark/scripts/scanThreads/config_CounterSketch.csv delete mode 100644 benchmark/scripts/scanThreads/config_FDAMM.csv mode change 100755 => 100644 benchmark/scripts/scanThreadsRockPi5/OoOCommon.py mode change 100755 => 100644 benchmark/scripts/scanThreadsRockPi5/accuBar.py mode change 100755 => 100644 benchmark/scripts/scanThreadsRockPi5/autoParase.py rename benchmark/scripts/{scanThreads/config_RAWMM.csv => scanThreadsRockPi5/config_CPPCOFD.csv} (52%) create mode 100644 benchmark/scripts/scanThreadsRockPi5/config_CPPCOUNTERSKETCH.csv create mode 100644 benchmark/scripts/scanThreadsRockPi5/config_CPPEWS.csv create mode 100644 benchmark/scripts/scanThreadsRockPi5/config_CPPTOW.csv mode change 100755 => 100644 benchmark/scripts/scanThreadsRockPi5/drawTogether.py create mode 100644 benchmark/scripts/scanThreadsRockPi5/drawTogetherNoCRS.py mode change 100755 => 100644 benchmark/scripts/scanThreadsRockPi5/groupBar.py mode change 100755 => 100644 benchmark/scripts/scanThreadsRockPi5/groupBar2.py mode change 100755 => 100644 benchmark/scripts/scanThreadsRockPi5/groupLine.py delete mode 100644 benchmark/scripts/scanThreadsRockPi5/main.c delete mode 100755 benchmark/scripts/scanThreadsRockPi5/tb diff --git a/benchmark/scripts/scanThreads/config_BCoAMM.csv b/benchmark/scripts/scanThreads/config_BCoAMM.csv deleted file mode 100644 index 6777ad23..00000000 --- a/benchmark/scripts/scanThreads/config_BCoAMM.csv +++ /dev/null @@ -1,8 +0,0 @@ -key,value,type -aRow,1000,U64 -aCol,1000,U64 -bCol,500,U64 -aReduce,10,U64 -sketchDimension,25,U64 -threads,1,U64 -ptFile,torchscripts/BetaCoOccurringFD.pt,String \ No newline at end of file diff --git a/benchmark/scripts/scanThreadsRockPi5/config_CPPBCO.csv b/benchmark/scripts/scanThreads/config_CPPCOFD.csv similarity index 79% rename from benchmark/scripts/scanThreadsRockPi5/config_CPPBCO.csv rename to benchmark/scripts/scanThreads/config_CPPCOFD.csv index 37943e33..69e4c717 100644 --- a/benchmark/scripts/scanThreadsRockPi5/config_CPPBCO.csv +++ b/benchmark/scripts/scanThreads/config_CPPCOFD.csv @@ -3,7 +3,8 @@ aRow,10000,U64 aCol,1000,U64 bCol,500,U64 sketchDimension,25,U64 -threads,1,U64 ptFile,torchscripts/CRS.pt,String useCPP,1,U64 -cppAlgoTag,bcoofd,String \ No newline at end of file +cppAlgoTag,CoOFD,String +threads,1,U64 +forceMP,1,U64 \ No newline at end of file diff --git a/benchmark/scripts/scanThreads/config_CPPCOUNTERSKETCH.csv b/benchmark/scripts/scanThreads/config_CPPCOUNTERSKETCH.csv new file mode 100644 index 00000000..7311dc68 --- /dev/null +++ b/benchmark/scripts/scanThreads/config_CPPCOUNTERSKETCH.csv @@ -0,0 +1,10 @@ +key,value,type +aRow,10000,U64 +aCol,1000,U64 +bCol,500,U64 +sketchDimension,25,U64 +ptFile,torchscripts/CRS.pt,String +useCPP,1,U64 +cppAlgoTag,countSketch,String +threads,1,U64 +forceMP,1,U64 diff --git a/benchmark/scripts/scanThreads/config_CPPCRS.csv b/benchmark/scripts/scanThreads/config_CPPCRS.csv index 132e789a..a6d197b6 100644 --- a/benchmark/scripts/scanThreads/config_CPPCRS.csv +++ b/benchmark/scripts/scanThreads/config_CPPCRS.csv @@ -3,7 +3,8 @@ aRow,10000,U64 aCol,1000,U64 bCol,500,U64 sketchDimension,25,U64 -threads,1,U64 ptFile,torchscripts/CRS.pt,String useCPP,1,U64 -cppAlgoTag,crs,String \ No newline at end of file +cppAlgoTag,crs,String +threads,1,U64 +forceMP,1,U64 \ No newline at end of file diff --git a/benchmark/scripts/scanThreadsRockPi5/config_CPPCounterSketch.csv b/benchmark/scripts/scanThreads/config_CPPEWS.csv similarity index 80% rename from benchmark/scripts/scanThreadsRockPi5/config_CPPCounterSketch.csv rename to benchmark/scripts/scanThreads/config_CPPEWS.csv index f41b4df5..78499a07 100644 --- a/benchmark/scripts/scanThreadsRockPi5/config_CPPCounterSketch.csv +++ b/benchmark/scripts/scanThreads/config_CPPEWS.csv @@ -3,7 +3,8 @@ aRow,10000,U64 aCol,1000,U64 bCol,500,U64 sketchDimension,25,U64 -threads,1,U64 ptFile,torchscripts/RAWMM.pt,String useCPP,1,U64 -cppAlgoTag,count-sketch,String \ No newline at end of file +cppAlgoTag,ews,String +threads,1,U64 +forceMP,1,U64 \ No newline at end of file diff --git a/benchmark/scripts/scanThreads/config_CPPMM.csv b/benchmark/scripts/scanThreads/config_CPPMM.csv index ef200e05..4d87eab7 100644 --- a/benchmark/scripts/scanThreads/config_CPPMM.csv +++ b/benchmark/scripts/scanThreads/config_CPPMM.csv @@ -3,7 +3,8 @@ aRow,10000,U64 aCol,1000,U64 bCol,500,U64 sketchDimension,25,U64 -threads,1,U64 ptFile,torchscripts/RAWMM.pt,String useCPP,1,U64 -cppAlgoTag,mm,String \ No newline at end of file +cppAlgoTag,mm,String +forceMP,1,U64 +threads,1,U64 \ No newline at end of file diff --git a/benchmark/scripts/scanThreads/config_CPPTOW.csv b/benchmark/scripts/scanThreads/config_CPPTOW.csv new file mode 100644 index 00000000..148fa90c --- /dev/null +++ b/benchmark/scripts/scanThreads/config_CPPTOW.csv @@ -0,0 +1,10 @@ +key,value,type +aRow,10000,U64 +aCol,1000,U64 +bCol,500,U64 +sketchDimension,25,U64 +ptFile,torchscripts/RAWMM.pt,String +useCPP,1,U64 +cppAlgoTag,tugOfWar,String +threads,1,U64 +forceMP,1,U64 \ No newline at end of file diff --git a/benchmark/scripts/scanThreads/config_CRS.csv b/benchmark/scripts/scanThreads/config_CRS.csv deleted file mode 100644 index b6afe1ef..00000000 --- a/benchmark/scripts/scanThreads/config_CRS.csv +++ /dev/null @@ -1,6 +0,0 @@ -key,value,type -aRow,100,U64 -aCol,1000,U64 -bCol,500,U64 -sketchDimension,25,U64 -ptFile,torchscripts/CRS.pt,String \ No newline at end of file diff --git a/benchmark/scripts/scanThreads/config_CoAMM.csv b/benchmark/scripts/scanThreads/config_CoAMM.csv deleted file mode 100644 index 984ebb29..00000000 --- a/benchmark/scripts/scanThreads/config_CoAMM.csv +++ /dev/null @@ -1,8 +0,0 @@ -key,value,type -aRow,1000,U64 -aCol,1000,U64 -bCol,500,U64 -aReduce,10,U64 -sketchDimension,25,U64 -threads,1,U64 -ptFile,torchscripts/CoOccurringFD.pt,String \ No newline at end of file diff --git a/benchmark/scripts/scanThreads/config_CounterSketch.csv b/benchmark/scripts/scanThreads/config_CounterSketch.csv deleted file mode 100644 index 1b3e6676..00000000 --- a/benchmark/scripts/scanThreads/config_CounterSketch.csv +++ /dev/null @@ -1,8 +0,0 @@ -key,value,type -aRow,10000,U64 -aCol,1000,U64 -bCol,10000,U64 -aDensity,1.0,Double -matrixLoaderTag,sparse,String -sketchDimension,25,U64 -ptFile,torchscripts/CountSketch.pt,String diff --git a/benchmark/scripts/scanThreads/config_FDAMM.csv b/benchmark/scripts/scanThreads/config_FDAMM.csv deleted file mode 100644 index a513cad8..00000000 --- a/benchmark/scripts/scanThreads/config_FDAMM.csv +++ /dev/null @@ -1,8 +0,0 @@ -key,value,type -aRow,1000,U64 -aCol,1000,U64 -bCol,500,U64 -aReduce,10,U64 -sketchDimension,25,U64 -threads,1,U64 -ptFile,torchscripts/FDAMM.pt,String \ No newline at end of file diff --git a/benchmark/scripts/scanThreads/drawTogether.py b/benchmark/scripts/scanThreads/drawTogether.py index 9cdaf188..3cd27ce9 100755 --- a/benchmark/scripts/scanThreads/drawTogether.py +++ b/benchmark/scripts/scanThreads/drawTogether.py @@ -137,10 +137,10 @@ def main(): figPath = os.path.abspath(os.path.join(os.getcwd(), "../..")) + "/figures/" + scanTag configTemplate = exeSpace + "config.csv" commonBase = resultPath + "/" - resultPaths = ["CRS", "MM"] - csvTemplates = ["config_CPPCRS.csv", "config_CPPMM.csv"] - evaTypes = ['crs-cpp', 'mm-cpp'] - valueVec = [1, 2, 4, 6, 8, 10, 12] + resultPaths = ["mm", "crs","ews","counterSketch","cofd","tow"] + csvTemplates = ["config_CPPMM.csv", "config_CPPCRS.csv","config_CPPEWS.csv","config_CPPCOUNTERSKETCH.csv","config_CPPCOFD.csv","config_CPPTOW.csv"] + methodTags = ["mm", "crs","ews","counterSketch","cofd","tow"] + valueVec = [ 2, 4, 6, 8, 10, 12] valueVecRun = valueVec print(configTemplate) reRun = 0 @@ -159,7 +159,7 @@ def main(): froErroAllSum = np.zeros((tRows, tCols)) errorBoundRatioSum = np.zeros((tRows, tCols)) cacheMissAll = np.zeros((tRows, tCols)) - rounds = 10 + rounds = 1 for i in range(rounds): elapseTimeAll, ch, periodAll, fro, eb = compareMethod(exeSpace, commonBase, resultPaths, csvTemplates, valueVec, reRun) @@ -180,22 +180,22 @@ def main(): # os.system("mkdir " + figPath) groupLine.DrawFigureXYnormal(periodAll, 1 / elapseTimeAllSum, - evaTypes, + methodTags, "#threads", "1/elapsed time (1/ms)", 0, 1, figPath + "/" + "threads" + "_elapsedTime", True) groupLine.DrawFigureXYnormal(periodAll, froErroAllSum * 100.0, - evaTypes, + methodTags, "#threads", "normalized error %", 0, 1, figPath + "/" + "threads" + "_froError", True) groupLine.DrawFigureXYnormal(periodAll, errorBoundRatioSum * 100.0, - evaTypes, + methodTags, "#threads", "error bound ratio %", 0, 1, figPath + "/" + "threads" + "_ebRatio", True) groupLine.DrawFigureXYnormal(periodAll, cacheMissAll, - evaTypes, + methodTags, "#threads", "cache miss %", 0, 1, figPath + "/" + "threads" + "_cachemiss", True) # draw2yLine("watermark time (ms)",singleValueVecDisp,lat95Vec,errVec,"95% Latency (ms)","Error","ms","",figPath+"wm_lat") diff --git a/benchmark/scripts/scanThreadsRockPi5/OoOCommon.py b/benchmark/scripts/scanThreadsRockPi5/OoOCommon.py old mode 100755 new mode 100644 diff --git a/benchmark/scripts/scanThreadsRockPi5/accuBar.py b/benchmark/scripts/scanThreadsRockPi5/accuBar.py old mode 100755 new mode 100644 diff --git a/benchmark/scripts/scanThreadsRockPi5/autoParase.py b/benchmark/scripts/scanThreadsRockPi5/autoParase.py old mode 100755 new mode 100644 diff --git a/benchmark/scripts/scanThreads/config_RAWMM.csv b/benchmark/scripts/scanThreadsRockPi5/config_CPPCOFD.csv similarity index 52% rename from benchmark/scripts/scanThreads/config_RAWMM.csv rename to benchmark/scripts/scanThreadsRockPi5/config_CPPCOFD.csv index 32600e72..69e4c717 100644 --- a/benchmark/scripts/scanThreads/config_RAWMM.csv +++ b/benchmark/scripts/scanThreadsRockPi5/config_CPPCOFD.csv @@ -2,7 +2,9 @@ key,value,type aRow,10000,U64 aCol,1000,U64 bCol,500,U64 -aReduce,10,U64 sketchDimension,25,U64 +ptFile,torchscripts/CRS.pt,String +useCPP,1,U64 +cppAlgoTag,CoOFD,String threads,1,U64 -ptFile,torchscripts/RAWMM.pt,String \ No newline at end of file +forceMP,1,U64 \ No newline at end of file diff --git a/benchmark/scripts/scanThreadsRockPi5/config_CPPCOUNTERSKETCH.csv b/benchmark/scripts/scanThreadsRockPi5/config_CPPCOUNTERSKETCH.csv new file mode 100644 index 00000000..7311dc68 --- /dev/null +++ b/benchmark/scripts/scanThreadsRockPi5/config_CPPCOUNTERSKETCH.csv @@ -0,0 +1,10 @@ +key,value,type +aRow,10000,U64 +aCol,1000,U64 +bCol,500,U64 +sketchDimension,25,U64 +ptFile,torchscripts/CRS.pt,String +useCPP,1,U64 +cppAlgoTag,countSketch,String +threads,1,U64 +forceMP,1,U64 diff --git a/benchmark/scripts/scanThreadsRockPi5/config_CPPCRS.csv b/benchmark/scripts/scanThreadsRockPi5/config_CPPCRS.csv index 132e789a..a6d197b6 100644 --- a/benchmark/scripts/scanThreadsRockPi5/config_CPPCRS.csv +++ b/benchmark/scripts/scanThreadsRockPi5/config_CPPCRS.csv @@ -3,7 +3,8 @@ aRow,10000,U64 aCol,1000,U64 bCol,500,U64 sketchDimension,25,U64 -threads,1,U64 ptFile,torchscripts/CRS.pt,String useCPP,1,U64 -cppAlgoTag,crs,String \ No newline at end of file +cppAlgoTag,crs,String +threads,1,U64 +forceMP,1,U64 \ No newline at end of file diff --git a/benchmark/scripts/scanThreadsRockPi5/config_CPPEWS.csv b/benchmark/scripts/scanThreadsRockPi5/config_CPPEWS.csv new file mode 100644 index 00000000..78499a07 --- /dev/null +++ b/benchmark/scripts/scanThreadsRockPi5/config_CPPEWS.csv @@ -0,0 +1,10 @@ +key,value,type +aRow,10000,U64 +aCol,1000,U64 +bCol,500,U64 +sketchDimension,25,U64 +ptFile,torchscripts/RAWMM.pt,String +useCPP,1,U64 +cppAlgoTag,ews,String +threads,1,U64 +forceMP,1,U64 \ No newline at end of file diff --git a/benchmark/scripts/scanThreadsRockPi5/config_CPPMM.csv b/benchmark/scripts/scanThreadsRockPi5/config_CPPMM.csv index ef200e05..4d87eab7 100644 --- a/benchmark/scripts/scanThreadsRockPi5/config_CPPMM.csv +++ b/benchmark/scripts/scanThreadsRockPi5/config_CPPMM.csv @@ -3,7 +3,8 @@ aRow,10000,U64 aCol,1000,U64 bCol,500,U64 sketchDimension,25,U64 -threads,1,U64 ptFile,torchscripts/RAWMM.pt,String useCPP,1,U64 -cppAlgoTag,mm,String \ No newline at end of file +cppAlgoTag,mm,String +forceMP,1,U64 +threads,1,U64 \ No newline at end of file diff --git a/benchmark/scripts/scanThreadsRockPi5/config_CPPTOW.csv b/benchmark/scripts/scanThreadsRockPi5/config_CPPTOW.csv new file mode 100644 index 00000000..148fa90c --- /dev/null +++ b/benchmark/scripts/scanThreadsRockPi5/config_CPPTOW.csv @@ -0,0 +1,10 @@ +key,value,type +aRow,10000,U64 +aCol,1000,U64 +bCol,500,U64 +sketchDimension,25,U64 +ptFile,torchscripts/RAWMM.pt,String +useCPP,1,U64 +cppAlgoTag,tugOfWar,String +threads,1,U64 +forceMP,1,U64 \ No newline at end of file diff --git a/benchmark/scripts/scanThreadsRockPi5/drawTogether.py b/benchmark/scripts/scanThreadsRockPi5/drawTogether.py old mode 100755 new mode 100644 index 9a87b3ae..cc4e3e87 --- a/benchmark/scripts/scanThreadsRockPi5/drawTogether.py +++ b/benchmark/scripts/scanThreadsRockPi5/drawTogether.py @@ -137,10 +137,10 @@ def main(): figPath = os.path.abspath(os.path.join(os.getcwd(), "../..")) + "/figures/" + scanTag configTemplate = exeSpace + "config.csv" commonBase = resultPath + "/" - resultPaths = ["CRS", "MM", "counter-sketch", "BCO"] - csvTemplates = ["config_CPPCRS.csv", "config_CPPMM.csv", "config_CPPCounterSketch.csv", "config_CPPBCO.csv"] - evaTypes = ['crs-cpp', 'mm-cpp', 'counter-sketch-cpp', 'bco'] - valueVec = [1, 2, 3, 4, 5, 6, 7, 8] + resultPaths = ["mm", "crs","ews","counterSketch","cofd","tow"] + csvTemplates = ["config_CPPMM.csv", "config_CPPCRS.csv","config_CPPEWS.csv","config_CPPCOUNTERSKETCH.csv","config_CPPCOFD.csv","config_CPPTOW.csv"] + methodTags = ["mm", "crs","ews","counterSketch","cofd","tow"] + valueVec = [1,2,3,4,5,6,7,8] valueVecRun = valueVec print(configTemplate) reRun = 0 @@ -180,22 +180,22 @@ def main(): # os.system("mkdir " + figPath) groupLine.DrawFigureXYnormal(periodAll, 1 / elapseTimeAllSum, - evaTypes, + methodTags, "#threads", "1/elapsed time (1/ms)", 0, 1, figPath + "/" + "threads" + "_elapsedTime", True) groupLine.DrawFigureXYnormal(periodAll, froErroAllSum * 100.0, - evaTypes, + methodTags, "#threads", "normalized error %", 0, 1, figPath + "/" + "threads" + "_froError", True) groupLine.DrawFigureXYnormal(periodAll, errorBoundRatioSum * 100.0, - evaTypes, + methodTags, "#threads", "error bound ratio %", 0, 1, figPath + "/" + "threads" + "_ebRatio", True) groupLine.DrawFigureXYnormal(periodAll, cacheMissAll, - evaTypes, + methodTags, "#threads", "cache miss %", 0, 1, figPath + "/" + "threads" + "_cachemiss", True) # draw2yLine("watermark time (ms)",singleValueVecDisp,lat95Vec,errVec,"95% Latency (ms)","Error","ms","",figPath+"wm_lat") diff --git a/benchmark/scripts/scanThreadsRockPi5/drawTogetherNoCRS.py b/benchmark/scripts/scanThreadsRockPi5/drawTogetherNoCRS.py new file mode 100644 index 00000000..bf393ed1 --- /dev/null +++ b/benchmark/scripts/scanThreadsRockPi5/drawTogetherNoCRS.py @@ -0,0 +1,212 @@ +#!/usr/bin/env python3 +import csv +import numpy as np +import accuBar as accuBar +import groupBar as groupBar +import groupBar2 as groupBar2 +import groupLine as groupLine +from autoParase import * +import itertools as it +import os + +import matplotlib +import numpy as np +import pylab +import matplotlib.font_manager as fm +from matplotlib.font_manager import FontProperties +from matplotlib.ticker import LogLocator, LinearLocator +import os +import pandas as pd +import sys +from OoOCommon import * +import time + +# OPT_FONT_NAME = 'Helvetica' +TICK_FONT_SIZE = 22 +LABEL_FONT_SIZE = 28 +LEGEND_FONT_SIZE = 30 +LABEL_FP = FontProperties(style='normal', size=LABEL_FONT_SIZE) +LEGEND_FP = FontProperties(style='normal', size=LEGEND_FONT_SIZE) +TICK_FP = FontProperties(style='normal', size=TICK_FONT_SIZE) + +MARKERS = (['*', '|', 'v', "^", "", "h", "<", ">", "+", "d", "<", "|", "", "+", "_"]) +# you may want to change the color map for different figures +COLOR_MAP = ( + '#B03A2E', '#2874A6', '#239B56', '#7D3C98', '#FFFFFF', '#F1C40F', '#F5CBA7', '#82E0AA', '#AEB6BF', '#AA4499') +# you may want to change the patterns for different figures +PATTERNS = (["////", "o", "", "||", "-", "//", "\\", "o", "O", "////", ".", "|||", "o", "---", "+", "\\\\", "*"]) +LABEL_WEIGHT = 'bold' +LINE_COLORS = COLOR_MAP +LINE_WIDTH = 3.0 +MARKER_SIZE = 15.0 +MARKER_FREQUENCY = 1000 + +matplotlib.rcParams['ps.useafm'] = True +matplotlib.rcParams['pdf.use14corefonts'] = True +matplotlib.rcParams['xtick.labelsize'] = TICK_FONT_SIZE +matplotlib.rcParams['ytick.labelsize'] = TICK_FONT_SIZE +matplotlib.rcParams['font.family'] = OPT_FONT_NAME +matplotlib.rcParams['pdf.fonttype'] = 42 + +scanTag = "threads" + + +def singleRun(exePath, singleValue, resultPath, configTemplate): + # resultFolder="singleValueTests" + configFname = "config_" + scanTag + str(singleValue) + ".csv" + # configTemplate = "config.csv" + # clear old files + os.system("cd " + exePath + "&& sudo rm *.csv") + + # editConfig(configTemplate, exePath + configFname, "earlierEmitMs", 0) + editConfig(configTemplate, exePath + configFname, scanTag, singleValue) + # prepare new file + # run + os.system("cd " + exePath + "&& sudo ./benchmark " + configFname) + # copy result + os.system("sudo rm -rf " + resultPath + "/" + str(singleValue)) + os.system("sudo mkdir " + resultPath + "/" + str(singleValue)) + os.system("cd " + exePath + "&& sudo cp *.csv " + resultPath + "/" + str(singleValue)) + + +def runScanVector(exePath, singleValueVec, resultPath, templateName="config.csv"): + for i in singleValueVec: + singleRun(exePath, i, resultPath, templateName) + + +def readResultSingle(singleValue, resultPath): + resultFname = resultPath + "/" + str(singleValue) + "/default.csv" + elapsedTime = readConfig(resultFname, "perfElapsedTime") + cacheMiss = readConfig(resultFname, "cacheMiss") + cacheRefs = readConfig(resultFname, "cacheRefs") + froError = readConfig(resultFname, "froError") + errorBoundRatio = readConfig(resultFname, "errorBoundRatio") + return elapsedTime, cacheMiss, cacheRefs, froError, errorBoundRatio + + +def cleanPath(path): + os.system("sudo rm -rf " + path) + os.system("sudo mkdir " + path) + + +def readResultVector(singleValueVec, resultPath): + elapseTimeVec = [] + cacheMissVec = [] + cacheRefVec = [] + froErrorVec = [] + errorBoundRatioVec = [] + for i in singleValueVec: + elapsedTime, cacheMiss, cacheRefs, froError, errorBoundRatio = readResultSingle(i, resultPath) + elapseTimeVec.append(float(elapsedTime) / 1000.0) + cacheMissVec.append(float(cacheMiss)) + cacheRefVec.append(float(cacheRefs)) + froErrorVec.append(float(froError)) + errorBoundRatioVec.append(float(errorBoundRatio)) + return np.array(elapseTimeVec), np.array(cacheMissVec), np.array(cacheRefVec), np.array(froErrorVec), np.array( + errorBoundRatioVec) + + +def compareMethod(exeSpace, commonPathBase, resultPaths, csvTemplates, periodVec, reRun=1): + elapsedTimeAll = [] + cacheMissAll = [] + cacheRefAll = [] + periodAll = [] + froAll = [] + errorBoundRatioAll = [] + for i in range(len(csvTemplates)): + resultPath = commonPathBase + resultPaths[i] + if (reRun == 1): + os.system("sudo rm -rf " + resultPath) + os.system("sudo mkdir " + resultPath) + runScanVector(exeSpace, periodVec, resultPath, csvTemplates[i]) + elapsedTime, cacheMiss, cacheRef, fro, eb = readResultVector(periodVec, resultPath) + elapsedTimeAll.append(elapsedTime) + cacheMissAll.append(cacheMiss) + cacheRefAll.append(cacheRef) + periodAll.append(periodVec) + cacheMissRateAll = np.array(cacheMissAll) / np.array(cacheRefAll) * 100.0 + froAll.append(fro) + errorBoundRatioAll.append(eb) + # periodAll.append(periodVec) + return np.array(elapsedTimeAll), cacheMissRateAll, periodAll, np.array(froAll), np.array(errorBoundRatioAll) + + +def main(): + exeSpace = os.path.abspath(os.path.join(os.getcwd(), "../..")) + "/" + resultPath = os.path.abspath(os.path.join(os.getcwd(), "../..")) + "/results/" + scanTag + figPath = os.path.abspath(os.path.join(os.getcwd(), "../..")) + "/figures/" + scanTag+"_NOCRS" + configTemplate = exeSpace + "config.csv" + commonBase = resultPath + "/" + resultPaths = ["mm","ews","counterSketch","cofd","tow"] + csvTemplates = ["config_CPPMM.csv","config_CPPEWS.csv","config_CPPCOUNTERSKETCH.csv","config_CPPCOFD.csv","config_CPPTOW.csv"] + methodTags = ["mm","ews","counterSketch","cofd","tow"] + valueVec = [1,2,3,4,5,6,7,8] + valueVecRun = valueVec + print(configTemplate) + reRun = 0 + # run + if (len(sys.argv) < 2): + os.system("mkdir ../../results") + os.system("mkdir ../../figures") + os.system("mkdir " + figPath) + os.system("sudo rm -rf " + resultPath) + os.system("sudo mkdir " + resultPath) + # + reRun = 1 + tRows = len(resultPaths) + tCols = len(valueVec) + elapseTimeAllSum = np.zeros((tRows, tCols)) + froErroAllSum = np.zeros((tRows, tCols)) + errorBoundRatioSum = np.zeros((tRows, tCols)) + cacheMissAll = np.zeros((tRows, tCols)) + rounds = 5 + for i in range(rounds): + elapseTimeAll, ch, periodAll, fro, eb = compareMethod(exeSpace, commonBase, resultPaths, csvTemplates, valueVec, + reRun) + elapseTimeAllSum = elapseTimeAllSum + elapseTimeAll + froErroAllSum = froErroAllSum + fro + errorBoundRatioSum = errorBoundRatioSum + eb + cacheMissAll = cacheMissAll + ch + elapseTimeAllSum = elapseTimeAllSum / float(rounds) + froErroAllSum = froErroAllSum / float(rounds) + errorBoundRatioSum = errorBoundRatioSum / float(rounds) + cacheMissAll = cacheMissAll / float(rounds) + # evaTypes = ['FDAMM', 'MM', 'Co-FD', 'BCO-FD'] + + # elapseTimeVecFD, cacheMissVecFD, cacheRefVecFD = readResultVector(valueVecRun, resultPathFDAMM) + # elapseTimeVecCoFD, cacheMissVecCoFD, cacheRefVecCoFD = readResultVector(valueVecRun, resultPathCoFD) + # elapseTimeVeCB, cacheMissVecB, cacheRefVecB = readResultVector(valueVecRun, resultPathBetaCoFD) + + # os.system("mkdir " + figPath) + groupLine.DrawFigureXYnormal(periodAll, + 1 / elapseTimeAllSum, + methodTags, + "#threads", "1/elapsed time (1/ms)", 0, 1, figPath + "/" + "threads" + "_elapsedTime", + True) + groupLine.DrawFigureXYnormal(periodAll, + froErroAllSum * 100.0, + methodTags, + "#threads", "normalized error %", 0, 1, figPath + "/" + "threads" + "_froError", + True) + groupLine.DrawFigureXYnormal(periodAll, + errorBoundRatioSum * 100.0, + methodTags, + "#threads", "error bound ratio %", 0, 1, figPath + "/" + "threads" + "_ebRatio", + True) + groupLine.DrawFigureXYnormal(periodAll, + cacheMissAll, + methodTags, + "#threads", "cache miss %", 0, 1, figPath + "/" + "threads" + "_cachemiss", + True) + # draw2yLine("watermark time (ms)",singleValueVecDisp,lat95Vec,errVec,"95% Latency (ms)","Error","ms","",figPath+"wm_lat") + # draw2yLine("watermark time (ms)",singleValueVecDisp,thrVec,errVec,"Throughput (KTp/s)","Error","KTp/s","",figPath+"wm_thr") + # draw2yLine("watermark time (ms)",singleValueVecDisp,lat95Vec,compVec,"95% Latency (ms)","Completeness","ms","",figPath+"wm_omp") + # groupLine.DrawFigureYnormal([singleValueVec,singleValueVec],[errVec,aqpErrVec],['w/o aqp',"w/ MeanAqp"],"watermark time (ms)","Error",0,1,figPath+"wm_MeanAqp",True) + # print(errVec) + # print(aqpErrVec) + # print(elapseTimeVecFD) + # readResultsingleValue(50,resultPath) + + +if __name__ == "__main__": + main() diff --git a/benchmark/scripts/scanThreadsRockPi5/groupBar.py b/benchmark/scripts/scanThreadsRockPi5/groupBar.py old mode 100755 new mode 100644 diff --git a/benchmark/scripts/scanThreadsRockPi5/groupBar2.py b/benchmark/scripts/scanThreadsRockPi5/groupBar2.py old mode 100755 new mode 100644 diff --git a/benchmark/scripts/scanThreadsRockPi5/groupLine.py b/benchmark/scripts/scanThreadsRockPi5/groupLine.py old mode 100755 new mode 100644 diff --git a/benchmark/scripts/scanThreadsRockPi5/main.c b/benchmark/scripts/scanThreadsRockPi5/main.c deleted file mode 100644 index 35fa90f7..00000000 --- a/benchmark/scripts/scanThreadsRockPi5/main.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -int isFP32Supported() { - float32x4_t a; - // Perform a NEON vector addition of FP32 values - float32_t result = vaddvq_f32(a); - printf("ok\r\n"); - // If compilation succeeds, FP32 operations are supported - return 1; -} -void main() { - - isFP32Supported(); -} diff --git a/benchmark/scripts/scanThreadsRockPi5/tb b/benchmark/scripts/scanThreadsRockPi5/tb deleted file mode 100755 index 208ced9bbbc5f7213d9093bf20f0cf6362afe264..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8904 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 diff --git a/benchmark/src/Benchmark.cpp b/benchmark/src/Benchmark.cpp index 24e7da63..ff429fd5 100644 --- a/benchmark/src/Benchmark.cpp +++ b/benchmark/src/Benchmark.cpp @@ -85,6 +85,7 @@ auto B = torch::rand({(long) aCol, (long) bCol});*/ AMMBench::CPPAlgoTable cppAlgoTable; std::string cppAlgoTag = cfg->tryString("cppAlgoTag", "mm", true); AMMBench::AbstractCPPAlgoPtr cppAlgoPtr = cppAlgoTable.findCppAlgo(cppAlgoTag); + cppAlgoPtr->setConfig(cfg); INTELLI_WARNING("single thread, algo " + cppAlgoTag); if (eMeter != nullptr) { eMeter->startMeter(); diff --git a/commit_info b/commit_info index fbf0b8a6..3f6df389 100644 --- a/commit_info +++ b/commit_info @@ -1 +1,2 @@ -1. Update the example scripts in scripts/scanARowCPP and scripts/scanAColCPP \ No newline at end of file +1. Update the example scripts in scripts/scanThreads +2. Add the parameter passing logic to CPPAlgos \ No newline at end of file diff --git a/include/AMMBench.h b/include/AMMBench.h index 1e1b0a4b..30851aed 100755 --- a/include/AMMBench.h +++ b/include/AMMBench.h @@ -49,9 +49,20 @@ * @section subsec_extend_cpp_operator How to extend a new algorithm (pure static c++ based) * - go to the src/CPPAlgos and include/CPPAlgos * - copy the example class, such as CRSCPPAlgo, rename it, and implement your own @ref amm function + * - copy the cpp and h + * - rename the cpp and h + * - automatically conduct the IDE-full-replace over the CRSCPPAlgo by your own name in cpp and h + * - define your own function + * - @note Please use this copy-and-replace policy rather than creat your own, unless you know the doxygen comment style + * very well and can always keep it!!! + * - @warning This copy-and-replace policy will also prevent from wrong parameter types of interface functions, please + * DO KEEP THE INTERFACE PARAMETER UNDER THE SAME TYPE!!!!!!!!!!! * - register tour function with a tag to src/CPPAlgos/CPPAlgoTable.cpp * - edit the CMakelist.txt at src/CPPAlgos to include your new algo and recompile * - remember to add a test bench, you can refer to CRSTest.cpp at test/SystemTest for example + * - if your algorithms have specific parameters like beta, please additionally do the following in the XXXCPPAlgo class: + * - copy the virtual void setConfig(INTELLI::ConfigMapPtr cfg) claim to your *.h + * - implement that function in your cpp * @section subsec_edit_test How to add a single point test * - copy your config file to test/scripts, and your pt file to test/torchscripts * - follow and copy the SketchTest.cpp to create your own, say A.cpp diff --git a/include/CPPAlgos/AbstractCPPAlgo.h b/include/CPPAlgos/AbstractCPPAlgo.h index a5b29a1b..db35fd82 100644 --- a/include/CPPAlgos/AbstractCPPAlgo.h +++ b/include/CPPAlgos/AbstractCPPAlgo.h @@ -28,6 +28,10 @@ class AbstractCPPAlgo { ~AbstractCPPAlgo() { } + /** + * @brief set the alo-specfic config related to one algorithm + */ + virtual void setConfig(INTELLI::ConfigMapPtr cfg); /** * @brief the virtual function provided for outside callers, rewrite in children classes * @param A the A matrix diff --git a/include/CPPAlgos/BCRSCPPAlgo.h b/include/CPPAlgos/BCRSCPPAlgo.h index aaf1acd0..7dfd8cff 100644 --- a/include/CPPAlgos/BCRSCPPAlgo.h +++ b/include/CPPAlgos/BCRSCPPAlgo.h @@ -1,3 +1,4 @@ +/*! \file BCRSCPPAlgo.h*/ // // Created by haolan on 5/29/23. // @@ -12,9 +13,8 @@ namespace AMMBench { * @{ */ /** - * @class CRSCPPlgo CPPAlgos/BCRSCPPAlgo.h - * @brief The Bernoulli column row sampling (CRS) class of c++ algos - * + * @class BCRSCPPAlgo CPPAlgos/BCRSCPPAlgo.h + * @brief The Bernoulli column row sampling (BCRS) class of c++ algos */ class BCRSCPPAlgo : public AMMBench::AbstractCPPAlgo { public: diff --git a/include/CPPAlgos/BetaCoOFDCPPAlgo.h b/include/CPPAlgos/BetaCoOFDCPPAlgo.h index 6ff6007b..ae58648c 100644 --- a/include/CPPAlgos/BetaCoOFDCPPAlgo.h +++ b/include/CPPAlgos/BetaCoOFDCPPAlgo.h @@ -1,4 +1,4 @@ -// +/*! \file BetaCoOFDCPPAlgo.h*/ // Created by haolan on 5/30/23. // @@ -12,11 +12,14 @@ namespace AMMBench { * @{ */ /** - * @class CPPAlgos/BetaCoOFDCPPAlgo.h + * @class BetaCoOFDCPPAlgo CPPAlgos/BetaCoOFDCPPAlgo.h * @brief The Beta Co-Occurring FD AMM class of c++ algos - * + * @note parameters + * - algoBeta Double, the beta parameters in this algo, default 1.0 */ class BetaCoOFDCPPAlgo : public AMMBench::AbstractCPPAlgo { + protected: + float algoBeta=1.0; public: BetaCoOFDCPPAlgo() { @@ -25,7 +28,10 @@ class BetaCoOFDCPPAlgo : public AMMBench::AbstractCPPAlgo { ~BetaCoOFDCPPAlgo() { } - + /** + * @brief set the alo-specfic config related to one algorithm + */ + virtual void setConfig(INTELLI::ConfigMapPtr cfg); /** * @brief the virtual function provided for outside callers, rewrite in children classes * @param A the A matrix diff --git a/include/CPPAlgos/CRSCPPAlgo.h b/include/CPPAlgos/CRSCPPAlgo.h index 324e2c0f..015a3560 100644 --- a/include/CPPAlgos/CRSCPPAlgo.h +++ b/include/CPPAlgos/CRSCPPAlgo.h @@ -12,7 +12,7 @@ namespace AMMBench { * @{ */ /** - * @class CRSCPPlgo CPPAlgos/CRSCPPAlgo.h + * @class CRSCPPAlgo CPPAlgos/CRSCPPAlgo.h * @brief The column row sampling (CRS) class of c++ algos * */ diff --git a/include/CPPAlgos/CRSV2CPPAlgo.h b/include/CPPAlgos/CRSV2CPPAlgo.h index 142b28fd..8a1663f1 100644 --- a/include/CPPAlgos/CRSV2CPPAlgo.h +++ b/include/CPPAlgos/CRSV2CPPAlgo.h @@ -1,3 +1,4 @@ +/*! \file CRSV2CPPAlgo.h*/ // // Created by haolan on 5/26/23. // @@ -13,7 +14,7 @@ namespace AMMBench { * @{ */ /** - * @class CRSCPPlgo CPPAlgos/CRSV2CPPAlgo.h + * @class CRSV2CPPAlgo CPPAlgos/CRSV2CPPAlgo.h * @brief The column row sampling (CRS) class of c++ algos, a second implementation * */ diff --git a/include/CPPAlgos/CoOccurringFDCPPAlgo.h b/include/CPPAlgos/CoOccurringFDCPPAlgo.h index a91b8e11..f951cf40 100644 --- a/include/CPPAlgos/CoOccurringFDCPPAlgo.h +++ b/include/CPPAlgos/CoOccurringFDCPPAlgo.h @@ -1,4 +1,4 @@ -// +/*! \file CoOFDCPPAlgo.h*/ // Created by haolan on 5/29/23. // @@ -12,7 +12,7 @@ namespace AMMBench { * @{ */ /** - * @class CPPAlgos/CoOccurringFDCPPAlgo.h + * @class CoOccurringFDCPPAlgo CPPAlgos/CoOccurringFDCPPAlgo.h * @brief The Co-Occurring FD AMM class of c++ algos * */ diff --git a/include/CPPAlgos/CountSketchCPPAlgo.h b/include/CPPAlgos/CountSketchCPPAlgo.h index 66a37b3b..097584ac 100644 --- a/include/CPPAlgos/CountSketchCPPAlgo.h +++ b/include/CPPAlgos/CountSketchCPPAlgo.h @@ -1,3 +1,4 @@ +/*! \file CountSketchCPPAlgo.h*/ // // Created by luv on 5/28/23. // @@ -14,7 +15,7 @@ namespace AMMBench { */ /** * @class CountSketchCPPAlgo CPPAlgos/CountSketchCPPAlgo.h - * @brief The cloumn row sampling (CRS) class of c++ algos + * @brief The counter sketch class of c++ algos * */ class CountSketchCPPAlgo : public AMMBench::AbstractCPPAlgo { diff --git a/include/CPPAlgos/EWSCPPAlgo.h b/include/CPPAlgos/EWSCPPAlgo.h index 95a4bfa7..fda3d4d7 100644 --- a/include/CPPAlgos/EWSCPPAlgo.h +++ b/include/CPPAlgos/EWSCPPAlgo.h @@ -1,3 +1,4 @@ +/*! \file EWSCPPAlgo.h*/ // // Created by haolan on 5/29/23. // @@ -12,7 +13,7 @@ namespace AMMBench { * @{ */ /** - * @class CPPAlgos/EWSCPPAlgo.h + * @class EWSCPPAlgo CPPAlgos/EWSCPPAlgo.h * @brief The Element Wise Sampling (EWS) class of c++ algos * */ diff --git a/include/CPPAlgos/TugOfWarCPPAlgo.h b/include/CPPAlgos/TugOfWarCPPAlgo.h index f21cfbbf..63e1692a 100644 --- a/include/CPPAlgos/TugOfWarCPPAlgo.h +++ b/include/CPPAlgos/TugOfWarCPPAlgo.h @@ -1,3 +1,4 @@ +/*! \file TugOfWarCPPAlgo.h*/ // // Created by luv on 5/30/23. // @@ -13,9 +14,8 @@ namespace AMMBench { * @{ */ /** - * @class CRSCPPlgo CPPAlgos/TugOfWarCPPAlgo.h - * @brief The tug of war class of c++ algos - * + * @class TugOfWarCPPAlgo CPPAlgos/TugOfWarCPPAlgo.h + * @brief The tug of war class of c++ algoS */ class TugOfWarCPPAlgo : public AMMBench::AbstractCPPAlgo { double delta = 0.2; diff --git a/src/CPPAlgos/AbstractCPPAlgo.cpp b/src/CPPAlgos/AbstractCPPAlgo.cpp index 67f0127c..57d9367b 100644 --- a/src/CPPAlgos/AbstractCPPAlgo.cpp +++ b/src/CPPAlgos/AbstractCPPAlgo.cpp @@ -4,6 +4,9 @@ // #include +void AMMBench::AbstractCPPAlgo::setConfig(INTELLI::ConfigMapPtr cfg) { + assert(cfg); +} torch::Tensor AMMBench::AbstractCPPAlgo::amm(torch::Tensor A, torch::Tensor B, uint64_t sketchSize) { std::cout << sketchSize; INTELLI_INFO("I am mm"); diff --git a/src/CPPAlgos/BetaCoOFDCPPAlgo.cpp b/src/CPPAlgos/BetaCoOFDCPPAlgo.cpp index b65bcc13..0b315fc8 100644 --- a/src/CPPAlgos/BetaCoOFDCPPAlgo.cpp +++ b/src/CPPAlgos/BetaCoOFDCPPAlgo.cpp @@ -26,11 +26,13 @@ torch::Tensor paramerizedReduceRank(const torch::Tensor &SV, float delta, int l, torch::Tensor SV_shrunk = torch::clamp(SV - parameterizedReduceRank, 0); return SV_shrunk; } - +void AMMBench::BetaCoOFDCPPAlgo::setConfig(INTELLI::ConfigMapPtr cfg) { + algoBeta=cfg->tryDouble("algoBeta",1.0,true); +} torch::Tensor BetaCoOFDCPPAlgo::amm(const torch::Tensor A, const torch::Tensor B, uint64_t l2) { torch::Tensor B_t = B.t(); - float beta = 1.0; - + float beta =algoBeta; + INTELLI_INFO("BETA-COOCURRING, use beta "+ to_string(beta)); TORCH_CHECK(A.size(1) == B_t.size(1), "Shapes of A and B are incompatible"); int64_t mx = A.size(0); int64_t my = B_t.size(0); diff --git a/src/CPPAlgos/CPPAlgoTable.cpp b/src/CPPAlgos/CPPAlgoTable.cpp index 77ffb5e5..09b317f6 100644 --- a/src/CPPAlgos/CPPAlgoTable.cpp +++ b/src/CPPAlgos/CPPAlgoTable.cpp @@ -25,7 +25,7 @@ AMMBench::CPPAlgoTable::CPPAlgoTable() { algoMap["bcrs"] = newBCRSCPPAlgo(); algoMap["ews"] = newEWSCPPAlgo(); algoMap["cooFD"] = newCoOccurringFDCPPAlgo(); - algoMap["bcoofd"] = newBetaCoOFDCPPAlgo(); + algoMap["bcooFD"] = newBetaCoOFDCPPAlgo(); algoMap["int8"] = newINT8CPPAlgo(); algoMap["tugOfWar"] = newTugOfWarCPPAlgo(); } diff --git a/src/Parallelization/BlockPartitionRunner.cpp b/src/Parallelization/BlockPartitionRunner.cpp index cdc9234a..383ce986 100644 --- a/src/Parallelization/BlockPartitionRunner.cpp +++ b/src/Parallelization/BlockPartitionRunner.cpp @@ -13,6 +13,7 @@ void AMMBench::BlockPartitionWorker::setConfig(INTELLI::ConfigMapPtr _cfg) { if (useCPP) { std::string cppAlgoTag = cfg->tryString("cppAlgoTag", "mm", true); cppAlgoPtr = cppAlgoTable.findCppAlgo(cppAlgoTag); + cppAlgoPtr->setConfig(_cfg); } if (!useCPP || (cppAlgoPtr == nullptr)) { module = torch::jit::load(ptFile);