本文整理汇总了C++中PiSDFGraph类的典型用法代码示例。如果您正苦于以下问题:C++ PiSDFGraph类的具体用法?C++ PiSDFGraph怎么用?C++ PiSDFGraph使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PiSDFGraph类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initPisdf_test6
PiSDFGraph* initPisdf_test6(Archi* archi, Stack* stack){
PiSDFGraph* top = CREATE(stack, PiSDFGraph)(
0,0,0,0,0,1, archi, stack);
top->addHierVertex(
"top", test6(archi, stack),
0, 0, 0);
return top;
}
示例2: result_Test6
SRDAGGraph* result_Test6(PiSDFGraph* pisdf, Stack* stack){
SRDAGGraph* srdag = CREATE(stack, SRDAGGraph)(stack);
PiSDFGraph* topPisdf = pisdf->getBody(0)->getSubGraph();
SRDAGVertex* vxA = srdag->addVertex(topPisdf->getBody(0));
SRDAGVertex* vxB = srdag->addVertex(topPisdf->getBody(1));
SRDAGVertex* vxH0 = srdag->addVertex(topPisdf->getBody(2)->getSubGraph()->getBody(0));
SRDAGVertex* vxH1 = srdag->addVertex(topPisdf->getBody(2)->getSubGraph()->getBody(0));
SRDAGVertex* vxH2 = srdag->addVertex(topPisdf->getBody(2)->getSubGraph()->getBody(0));
SRDAGVertex* vxH3 = srdag->addVertex(topPisdf->getBody(2)->getSubGraph()->getBody(0));
SRDAGVertex* vxJ = srdag->addJoin(4);
SRDAGVertex* vxF = srdag->addFork(4);
srdag->addEdge(
vxA, 0,
vxF, 0,
4);
srdag->addEdge(
vxF , 0,
vxH0, 0,
1);
srdag->addEdge(
vxF , 1,
vxH1, 0,
1);
srdag->addEdge(
vxF , 2,
vxH2, 0,
1);
srdag->addEdge(
vxF , 3,
vxH3, 0,
1);
srdag->addEdge(
vxH0, 0,
vxJ , 0,
1);
srdag->addEdge(
vxH1, 0,
vxJ , 1,
1);
srdag->addEdge(
vxH2, 0,
vxJ , 2,
1);
srdag->addEdge(
vxH3, 0,
vxJ , 3,
1);
srdag->addEdge(
vxJ, 0,
vxB, 0,
4);
return srdag;
}
示例3: test5
PiSDFGraph* test5(Archi* archi, Stack* stack){
PiSDFGraph* graph = CREATE(stack, PiSDFGraph)(
/*Edges*/ 3,
/*Params*/ 0,
/*InIf*/ 0,
/*OutIf*/ 0,
/*Config*/ 0,
/*Normal*/ 4,
archi,
stack);
// Parameters.
// Configure vertices
// Other vertices
PiSDFVertex *vxA = graph->addBodyVertex(
"A", /*Fct*/ 19,
/*In*/ 0, /*Out*/ 1,
/*Par*/ 0);
PiSDFVertex *vxB = graph->addBodyVertex(
"B", /*Fct*/ 20,
/*In*/ 1, /*Out*/ 1,
/*Par*/ 0);
PiSDFVertex *vxCheck = graph->addBodyVertex(
"Check", /*Fct*/ 22,
/*In*/ 1, /*Out*/ 0,
/*Par*/ 0);
PiSDFVertex *vxH = graph->addHierVertex(
"H_top",
/*SubGraph*/ test5_sub(archi, stack),
/*In*/ 1, /*Out*/ 1,
/*Par*/ 0);
// Edges.
graph->connect(
/*Src*/ vxA, /*SrcPrt*/ 0, /*Prod*/ "1",
/*Snk*/ vxH, /*SnkPrt*/ 0, /*Cons*/ "2",
/*Delay*/ "0", 0);
graph->connect(
/*Src*/ vxH, /*SrcPrt*/ 0, /*Prod*/ "2",
/*Snk*/ vxB, /*SnkPrt*/ 0, /*Cons*/ "1",
/*Delay*/ "0", 0);
graph->connect(
/*Src*/ vxB, /*SrcPrt*/ 0, /*Prod*/ "1",
/*Snk*/ vxCheck, /*SnkPrt*/ 0, /*Cons*/ "2",
/*Delay*/ "0", 0);
// Timings
vxA->isExecutableOnAllPE();
vxA->setTimingOnType(0, "10", stack);
vxB->isExecutableOnAllPE();
vxB->setTimingOnType(0, "10", stack);
vxCheck->isExecutableOnPE(0);
vxCheck->setTimingOnType(0, "10", stack);
return graph;
}
示例4: result_Test0_1
SRDAGGraph* result_Test0_1(PiSDFGraph* pisdf, Stack* stack){
SRDAGGraph* srdag = CREATE(stack, SRDAGGraph)(stack);
PiSDFGraph* topPisdf = pisdf->getBody(0)->getSubGraph();
SRDAGVertex* vxC = srdag->addVertex(topPisdf->getConfig(0));
SRDAGVertex* vxA = srdag->addVertex(topPisdf->getBody(0));
SRDAGVertex* vxB0 = srdag->addVertex(topPisdf->getBody(1));
SRDAGVertex* vxB1 = srdag->addVertex(topPisdf->getBody(1));
SRDAGVertex* vxCheck = srdag->addVertex(topPisdf->getBody(2));
SRDAGVertex* vxF = srdag->addFork(2);
SRDAGVertex* vxJ = srdag->addJoin(2);
vxB0->addInParam(0, 1);
vxB1->addInParam(0, 1);
vxCheck->addInParam(0, 1);
srdag->addEdge(
vxA, 0,
vxF, 0,
2);
srdag->addEdge(
vxF, 0,
vxB0, 0,
1);
srdag->addEdge(
vxF, 1,
vxB1, 0,
1);
srdag->addEdge(
vxB0, 0,
vxJ, 0,
1);
srdag->addEdge(
vxB1, 0,
vxJ, 1,
1);
srdag->addEdge(
vxJ, 0,
vxCheck, 0,
2);
return srdag;
}
示例5: init_daq_fft
/**
* This is the method you need to call to build a complete PiSDF graph.
*/
PiSDFGraph* init_daq_fft(Archi* archi, Stack* stack) {
PiSDFGraph* top = CREATE(stack, PiSDFGraph)(
/*Edges*/ 0,
/*Params*/ 0,
/*InputIf*/ 0,
/*OutputIf*/ 0,
/*Config*/ 0,
/*Body*/ 1,
/*Archi*/ archi,
/*Stack*/ stack);
top->addHierVertex(
/*Name*/ "top",
/*Graph*/ daq_fft(archi, stack),
/*InputIf*/ 0,
/*OutputIf*/ 0,
/*Params*/ 0);
return top;
}
示例6: result_Test0_2
SRDAGGraph* result_Test0_2(PiSDFGraph* pisdf, Stack* stack){
SRDAGGraph* srdag = CREATE(stack, SRDAGGraph)(stack);
PiSDFGraph* topPisdf = pisdf->getBody(0)->getSubGraph();
SRDAGVertex* vxC = srdag->addVertex(topPisdf->getConfig(0));
SRDAGVertex* vxA = srdag->addVertex(topPisdf->getBody(0));
SRDAGVertex* vxB = srdag->addVertex(topPisdf->getBody(1));
SRDAGVertex* vxCheck = srdag->addVertex(topPisdf->getBody(2));
vxB->addInParam(0, 2);
vxCheck->addInParam(0, 2);
srdag->addEdge(
vxA, 0,
vxB, 0,
2);
srdag->addEdge(
vxB, 0,
vxCheck, 0,
2);
return srdag;
}
示例7: test6_sub
PiSDFGraph* test6_sub(Archi* archi, Stack* stack){
PiSDFGraph* graph = CREATE(stack, PiSDFGraph)(
/*Edges*/ 2,
/*Params*/ 0,
/*InIf*/ 1,
/*OutIf*/ 1,
/*Config*/ 0,
/*Normal*/ 1,
archi,
stack);
// Parameters.
// Configure vertices
// Interfaces
PiSDFVertex *ifIn = graph->addInputIf(
"in",
0 /*Par*/);
PiSDFVertex *ifOut = graph->addOutputIf(
"out",
0 /*Par*/);
// Other vertices
PiSDFVertex *vxH = graph->addBodyVertex(
"H", /*Fct*/ 24,
/*In*/ 1, /*Out*/ 1,
/*Par*/ 0);
// Edges.
graph->connect(
/*Src*/ ifIn, /*SrcPrt*/ 0, /*Prod*/ "2",
/*Snk*/ vxH, /*SnkPrt*/ 0, /*Cons*/ "1",
/*Delay*/ "0", 0);
graph->connect(
/*Src*/ vxH, /*SrcPrt*/ 0, /*Prod*/ "1",
/*Snk*/ ifOut, /*SnkPrt*/ 0, /*Cons*/ "2",
/*Delay*/ "0", 0);
// Timings
vxH->isExecutableOnAllPE();
vxH->setTimingOnType(0, "10", stack);
// Subgraphs
return graph;
}
示例8: main
int main(int argc, char* argv[]){
SpiderConfig cfg;
ExecutionStat stat;
initActors();
DynStack pisdfStack("PisdfStack");
DynStack archiStack("ArchiStack");
#define SH_MEM 0x00500000
PlatformK2Arm platform(2, 4, SH_MEM, &archiStack, radix2_fft_fcts, N_FCT_RADIX2_FFT);
Archi* archi = platform.getArchi();
cfg.memAllocType = MEMALLOC_SPECIAL_ACTOR;
cfg.memAllocStart = (void*)0;
cfg.memAllocSize = SH_MEM;
cfg.schedulerType = SCHEDULER_LIST;
cfg.srdagStack.type = STACK_DYNAMIC;
cfg.srdagStack.name = "SrdagStack";
cfg.srdagStack.size = 0;
cfg.srdagStack.start = 0;
cfg.transfoStack.type = STACK_DYNAMIC;
cfg.transfoStack.name = "TransfoStack";
cfg.transfoStack.size = 0;
cfg.transfoStack.start = 0;
spider_init(cfg);
printf("Start\n");
try{
pisdfStack.freeAll();
PiSDFGraph *topPisdf = init_Radix2_fft(archi, &pisdfStack);
topPisdf->print("topPisdf.gv");
Platform::get()->rstTime();
spider_launch(archi, topPisdf);
spider_printGantt(archi, spider_getLastSRDAG(), "radixFFT_2.pgantt", "latex.tex", &stat);
spider_getLastSRDAG()->print("radixFFT_2.gv");
printf("EndTime = %ld us\n", stat.globalEndTime/1000);
printf("Memory use = ");
if(stat.memoryUsed < 1024)
printf("\t%5.1f B", stat.memoryUsed/1.);
else if(stat.memoryUsed < 1024*1024)
printf("\t%5.1f KB", stat.memoryUsed/1024.);
else if(stat.memoryUsed < 1024*1024*1024)
printf("\t%5.1f MB", stat.memoryUsed/1024./1024.);
else
printf("\t%5.1f GB", stat.memoryUsed/1024./1024./1024.);
printf("\n");
printf("Actors:\n");
for(int j=0; j<stat.nbActor; j++){
printf("\t%18s:", stat.actors[j]->getName());
for(int k=0; k<archi->getNPETypes(); k++)
printf("\t%8ld (x%3ld)",
stat.actorTimes[j][k]/stat.actorIterations[j][k],
stat.actorIterations[j][k]);
printf("\n");
}
free_Radix2_fft(topPisdf, &pisdfStack);
}catch(const char* s){
printf("Exception : %s\n", s);
}
printf("finished\n");
spider_free();
return 0;
}
示例9: costParallel
// Method building PiSDFGraphcostParallel
PiSDFGraph* costParallel(Archi* archi, Stack* stack) {
PiSDFGraph* graph = CREATE(stack, PiSDFGraph)(
/*Edges*/ 18,
/*Params*/ 9,
/*InputIf*/ 5,
/*OutputIf*/ 1,
/*Config*/ 0,
/*Body*/ 9,
/*Archi*/ archi,
/*Stack*/ stack);
/* Parameters */
PiSDFParam *param_nIter = graph->addHeritedParam("nIter", 0);
PiSDFParam *param_height = graph->addHeritedParam("height", 1);
PiSDFParam *param_width = graph->addHeritedParam("width", 2);
PiSDFParam *param_maxDisp = graph->addHeritedParam("maxDisp", 3);
PiSDFParam *param_minDisp = graph->addHeritedParam("minDisp", 4);
PiSDFParam *param_truncValue = graph->addHeritedParam("truncValue", 5);
PiSDFParam *param_scale = graph->addHeritedParam("scale", 6);
PiSDFParam *param_size = graph->addDependentParam("size", "height*width");
PiSDFParam *param_nDisp = graph->addDependentParam("nDisp", "maxDisp-minDisp+1");
/* Vertices */
PiSDFVertex* if_cenL = graph->addInputIf(
/*Name*/ "if_cenL",
/*InParam*/ 1);
if_cenL->addInParam(0, param_size);
PiSDFVertex* if_cenR = graph->addInputIf(
/*Name*/ "if_cenR",
/*InParam*/ 1);
if_cenR->addInParam(0, param_size);
PiSDFVertex* if_grayL = graph->addInputIf(
/*Name*/ "if_grayL",
/*InParam*/ 1);
if_grayL->addInParam(0, param_size);
PiSDFVertex* if_grayR = graph->addInputIf(
/*Name*/ "if_grayR",
/*InParam*/ 1);
if_grayR->addInParam(0, param_size);
PiSDFVertex* if_rgb = graph->addInputIf(
/*Name*/ "if_rgb",
/*InParam*/ 1);
if_rgb->addInParam(0, param_size);
PiSDFVertex* bo_Br_rgb = graph->addSpecialVertex(
/*Type*/ PISDF_SUBTYPE_BROADCAST,
/*InData*/ 1,
/*OutData*/ 2,
/*InParam*/ 1);
bo_Br_rgb->addInParam(0, param_size);
PiSDFVertex* bo_GenIx = graph->addBodyVertex(
/*Name*/ "GenIx",
/*FctId*/ COSTPARALLEL_GENIX_FCT,
/*InData*/ 0,
/*OutData*/ 1,
/*InParam*/ 1);
bo_GenIx->addInParam(0, param_nIter);
bo_GenIx->isExecutableOnPE(CORE_ARM0);
bo_GenIx->setTimingOnType(CORE_TYPE_ARM, "3330", stack);
PiSDFVertex* bo_GenDisp = graph->addBodyVertex(
/*Name*/ "GenDisp",
/*FctId*/ COSTPARALLEL_GENDISP_FCT,
/*InData*/ 0,
/*OutData*/ 1,
/*InParam*/ 2);
bo_GenDisp->addInParam(0, param_minDisp);
bo_GenDisp->addInParam(1, param_maxDisp);
bo_GenDisp->isExecutableOnPE(CORE_ARM0);
bo_GenDisp->setTimingOnType(CORE_TYPE_ARM, "4025", stack);
PiSDFVertex* bo_VWeights = graph->addBodyVertex(
/*Name*/ "VWeights",
/*FctId*/ COSTPARALLEL_VWEIGHTS_FCT,
/*InData*/ 2,
/*OutData*/ 1,
/*InParam*/ 2);
bo_VWeights->addInParam(0, param_height);
bo_VWeights->addInParam(1, param_width);
// bo_VWeights->isExecutableOnPE(CORE_ARM0);
bo_VWeights->isExecutableOnPE(CORE_DSP0);
bo_VWeights->isExecutableOnPE(CORE_DSP1);
bo_VWeights->isExecutableOnPE(CORE_DSP2);
bo_VWeights->isExecutableOnPE(CORE_DSP3);
bo_VWeights->isExecutableOnPE(CORE_DSP4);
bo_VWeights->isExecutableOnPE(CORE_DSP5);
bo_VWeights->isExecutableOnPE(CORE_DSP6);
bo_VWeights->isExecutableOnPE(CORE_DSP7);
bo_VWeights->setTimingOnType(CORE_TYPE_C6X, "58039643", stack);
bo_VWeights->setTimingOnType(CORE_TYPE_ARM, "219177142", stack);
PiSDFVertex* bo_HWeight = graph->addBodyVertex(
/*Name*/ "HWeight",
/*FctId*/ COSTPARALLEL_HWEIGHT_FCT,
//.........这里部分代码省略.........
示例10: Radix2_fft
// Method building PiSDFGraphRadix2_fft
PiSDFGraph* Radix2_fft(Archi* archi, Stack* stack){
PiSDFGraph* graph = CREATE(stack, PiSDFGraph)(
/*Edges*/ 4,
/*Params*/ 6,
/*InputIf*/ 0,
/*OutputIf*/ 0,
/*Config*/ 1,
/*Body*/ 5,
/*Archi*/ archi,
/*Stack*/ stack);
/* Parameters */
PiSDFParam *param_fftSize = graph->addDynamicParam("fftSize");
PiSDFParam *param_P = graph->addDynamicParam("P");
PiSDFParam *param_n1 = graph->addDynamicParam("n1");
PiSDFParam *param_n2 = graph->addDynamicParam("n2");
PiSDFParam *param_N1 = graph->addDependentParam("N1", "2^P");
PiSDFParam *param_N2 = graph->addDependentParam("N2", "fftSize/2^P");
/* Vertices */
PiSDFVertex* bo_src = graph->addBodyVertex(
/*Name*/ "src",
/*FctId*/ RADIX2_FFT_SRC_FCT,
/*InData*/ 0,
/*OutData*/ 1,
/*InParam*/ 1);
bo_src->addInParam(0, param_fftSize);
// bo_src->isExecutableOnPE(CORE_ARM0);
// bo_src->isExecutableOnPE(CORE_ARM1);
// bo_src->isExecutableOnPE(CORE_ARM2);
// bo_src->isExecutableOnPE(CORE_ARM3);
bo_src->isExecutableOnPE(CORE_DSP0);
bo_src->setTimingOnType(CORE_TYPE_C6X, "100", stack);
bo_src->setTimingOnType(CORE_TYPE_ARM, "100", stack);
PiSDFVertex* bo_T = graph->addBodyVertex(
/*Name*/ "T",
/*FctId*/ RADIX2_FFT_T_FCT,
/*InData*/ 1,
/*OutData*/ 1,
/*InParam*/ 2);
bo_T->addInParam(0, param_N1);
bo_T->addInParam(1, param_N2);
// bo_T->isExecutableOnPE(CORE_ARM0);
// bo_T->isExecutableOnPE(CORE_ARM1);
// bo_T->isExecutableOnPE(CORE_ARM2);
// bo_T->isExecutableOnPE(CORE_ARM3);
bo_T->isExecutableOnPE(CORE_DSP0);
// bo_T->isExecutableOnPE(CORE_DSP1);
// bo_T->isExecutableOnPE(CORE_DSP2);
// bo_T->isExecutableOnPE(CORE_DSP3);
// bo_T->isExecutableOnPE(CORE_DSP4);
// bo_T->isExecutableOnPE(CORE_DSP5);
// bo_T->isExecutableOnPE(CORE_DSP6);
// bo_T->isExecutableOnPE(CORE_DSP7);
bo_T->setTimingOnType(CORE_TYPE_C6X, "100", stack);
bo_T->setTimingOnType(CORE_TYPE_ARM, "100", stack);
PiSDFVertex* bo_DFT_N2 = graph->addBodyVertex(
/*Name*/ "DFT_N2",
/*FctId*/ RADIX2_FFT_DFT_N2_FCT,
/*InData*/ 1,
/*OutData*/ 1,
/*InParam*/ 2);
bo_DFT_N2->addInParam(0, param_N2);
bo_DFT_N2->addInParam(1, param_n2);
// bo_DFT_N2->isExecutableOnPE(CORE_ARM0);
bo_DFT_N2->isExecutableOnPE(CORE_ARM1);
bo_DFT_N2->isExecutableOnPE(CORE_ARM2);
// bo_DFT_N2->isExecutableOnPE(CORE_ARM3);
bo_DFT_N2->isExecutableOnPE(CORE_DSP0);
bo_DFT_N2->isExecutableOnPE(CORE_DSP1);
bo_DFT_N2->isExecutableOnPE(CORE_DSP2);
bo_DFT_N2->isExecutableOnPE(CORE_DSP3);
bo_DFT_N2->isExecutableOnPE(CORE_DSP4);
bo_DFT_N2->isExecutableOnPE(CORE_DSP5);
bo_DFT_N2->isExecutableOnPE(CORE_DSP6);
bo_DFT_N2->isExecutableOnPE(CORE_DSP7);
bo_DFT_N2->setTimingOnType(CORE_TYPE_C6X, "117445", stack);
bo_DFT_N2->setTimingOnType(CORE_TYPE_ARM, "78130", stack);
PiSDFVertex* bo_snk = graph->addBodyVertex(
/*Name*/ "snk",
/*FctId*/ RADIX2_FFT_SNK_FCT,
/*InData*/ 1,
/*OutData*/ 0,
/*InParam*/ 1);
bo_snk->addInParam(0, param_fftSize);
// bo_snk->isExecutableOnPE(CORE_ARM0);
// bo_snk->isExecutableOnPE(CORE_ARM1);
// bo_snk->isExecutableOnPE(CORE_ARM2);
// bo_snk->isExecutableOnPE(CORE_ARM3);
bo_snk->isExecutableOnPE(CORE_DSP0);
bo_snk->setTimingOnType(CORE_TYPE_C6X, "100", stack);
bo_snk->setTimingOnType(CORE_TYPE_ARM, "100", stack);
PiSDFVertex* cf_cfgFFT = graph->addConfigVertex(
/*Name*/ "cfgFFT",
/*FctId*/ RADIX2_FFT_CFGFFT_FCT,
//.........这里部分代码省略.........
示例11: result_Test5
SRDAGGraph* result_Test5(PiSDFGraph* pisdf, Stack* stack){
SRDAGGraph* srdag = CREATE(stack, SRDAGGraph)(stack);
PiSDFGraph* topPisdf = pisdf->getBody(0)->getSubGraph();
SRDAGVertex* vxA0 = srdag->addVertex(topPisdf->getBody(0));
SRDAGVertex* vxA1 = srdag->addVertex(topPisdf->getBody(0));
SRDAGVertex* vxB0 = srdag->addVertex(topPisdf->getBody(1));
SRDAGVertex* vxB1 = srdag->addVertex(topPisdf->getBody(1));
SRDAGVertex* vxH = srdag->addVertex(topPisdf->getBody(3)->getSubGraph()->getBody(0));
SRDAGVertex* vxBr = srdag->addBroadcast(2);
SRDAGVertex* vxJ0 = srdag->addJoin(2);
SRDAGVertex* vxJ1 = srdag->addJoin(2);
SRDAGVertex* vxF = srdag->addFork(3);
SRDAGVertex* vxE = srdag->addEnd();
SRDAGVertex* vxJCheck = srdag->addJoin(2);
SRDAGVertex* vxCheck = srdag->addVertex(topPisdf->getBody(2));
srdag->addEdge(
vxA0, 0,
vxJ0, 0,
1);
srdag->addEdge(
vxA1, 0,
vxJ0, 1,
1);
srdag->addEdge(
vxJ0, 0,
vxBr, 0,
2);
srdag->addEdge(
vxBr, 0,
vxJ1, 0,
2);
srdag->addEdge(
vxBr, 1,
vxJ1, 1,
2);
srdag->addEdge(
vxJ1, 0,
vxH , 0,
4);
srdag->addEdge(
vxH , 0,
vxF , 0,
4);
srdag->addEdge(
vxF , 0,
vxE , 0,
2);
srdag->addEdge(
vxF , 1,
vxB0 , 0,
1);
srdag->addEdge(
vxF , 2,
vxB1 , 0,
1);
srdag->addEdge(
vxB0 , 0,
vxJCheck , 0,
1);
srdag->addEdge(
vxB1 , 0,
vxJCheck , 1,
1);
srdag->addEdge(
vxJCheck , 0,
vxCheck , 0,
2);
return srdag;
}
示例12: DispComp
// Method building PiSDFGraphDispComp
PiSDFGraph* DispComp(Archi* archi, Stack* stack) {
PiSDFGraph* graph = CREATE(stack, PiSDFGraph)(
/*Edges*/ 10,
/*Params*/ 8,
/*InputIf*/ 5,
/*OutputIf*/ 1,
/*Config*/ 0,
/*Body*/ 3,
/*Archi*/ archi,
/*Stack*/ stack);
/* Parameters */
PiSDFParam *param_height = graph->addHeritedParam("height", 0);
PiSDFParam *param_width = graph->addHeritedParam("width", 1);
PiSDFParam *param_nIter = graph->addHeritedParam("nIter", 2);
PiSDFParam *param_scale = graph->addHeritedParam("scale", 3);
PiSDFParam *param_minDisp = graph->addHeritedParam("minDisp", 4);
PiSDFParam *param_maxDisp = graph->addHeritedParam("maxDisp", 5);
PiSDFParam *param_size = graph->addDependentParam("size", "height*width");
PiSDFParam *param_nDisp = graph->addDependentParam("nDisp", "maxDisp-minDisp+1");
/* Vertices */
PiSDFVertex* bo_AggregateCost = graph->addBodyVertex(
/*Name*/ "AggregateCost",
/*FctId*/ DISPCOMP_AGGREGATECOST_FCT,
/*InData*/ 4,
/*OutData*/ 1,
/*InParam*/ 3);
bo_AggregateCost->addInParam(0, param_height);
bo_AggregateCost->addInParam(1, param_width);
bo_AggregateCost->addInParam(2, param_nIter);
// bo_AggregateCost->isExecutableOnPE(CORE_ARM0);
bo_AggregateCost->isExecutableOnPE(CORE_DSP0);
bo_AggregateCost->isExecutableOnPE(CORE_DSP1);
bo_AggregateCost->isExecutableOnPE(CORE_DSP2);
bo_AggregateCost->isExecutableOnPE(CORE_DSP3);
bo_AggregateCost->isExecutableOnPE(CORE_DSP4);
bo_AggregateCost->isExecutableOnPE(CORE_DSP5);
bo_AggregateCost->isExecutableOnPE(CORE_DSP6);
bo_AggregateCost->isExecutableOnPE(CORE_DSP7);
bo_AggregateCost->setTimingOnType(CORE_TYPE_C6X, "127693715", stack);
bo_AggregateCost->setTimingOnType(CORE_TYPE_ARM, "255956368", stack);
PiSDFVertex* bo_DisparitySelect = graph->addBodyVertex(
/*Name*/ "DisparitySelect",
/*FctId*/ DISPCOMP_DISPARITYSELECT_FCT,
/*InData*/ 4,
/*OutData*/ 2,
/*InParam*/ 5);
bo_DisparitySelect->addInParam(0, param_height);
bo_DisparitySelect->addInParam(1, param_width);
bo_DisparitySelect->addInParam(2, param_scale);
bo_DisparitySelect->addInParam(3, param_minDisp);
bo_DisparitySelect->addInParam(4, param_maxDisp);
// bo_DisparitySelect->isExecutableOnPE(CORE_ARM0);
bo_DisparitySelect->isExecutableOnPE(CORE_DSP0);
bo_DisparitySelect->isExecutableOnPE(CORE_DSP1);
bo_DisparitySelect->isExecutableOnPE(CORE_DSP2);
bo_DisparitySelect->isExecutableOnPE(CORE_DSP3);
bo_DisparitySelect->isExecutableOnPE(CORE_DSP4);
bo_DisparitySelect->isExecutableOnPE(CORE_DSP5);
bo_DisparitySelect->isExecutableOnPE(CORE_DSP6);
bo_DisparitySelect->isExecutableOnPE(CORE_DSP7);
bo_DisparitySelect->setTimingOnType(CORE_TYPE_C6X, "43926345", stack);
bo_DisparitySelect->setTimingOnType(CORE_TYPE_ARM, "177962862", stack);
PiSDFVertex* bo_Br_Disp = graph->addSpecialVertex(
/*Type*/ PISDF_SUBTYPE_BROADCAST,
/*InData*/ 1,
/*OutData*/ 2,
/*InParam*/ 1);
bo_Br_Disp->addInParam(0, param_size);
PiSDFVertex* if_rawDisparity = graph->addOutputIf(
/*Name*/ "if_rawDisparity",
/*InParam*/ 1);
if_rawDisparity->addInParam(0, param_size);
PiSDFVertex* if_offsets = graph->addInputIf(
/*Name*/ "if_offsets",
/*InParam*/ 2);
if_offsets->addInParam(0, param_nDisp);
if_offsets->addInParam(1, param_nIter);
PiSDFVertex* if_vWeights = graph->addInputIf(
/*Name*/ "if_vWeights",
/*InParam*/ 2);
if_vWeights->addInParam(0, param_size);
if_vWeights->addInParam(1, param_nIter);
PiSDFVertex* if_hWeights = graph->addInputIf(
/*Name*/ "if_hWeights",
/*InParam*/ 2);
if_hWeights->addInParam(0, param_size);
if_hWeights->addInParam(1, param_nIter);
PiSDFVertex* if_dispIx = graph->addInputIf(
/*Name*/ "if_dispIx",
/*InParam*/ 1);
//.........这里部分代码省略.........
示例13: main
int main(int argc, char* argv[]) {
SpiderConfig cfg;
ExecutionStat stat;
initActors();
DynStack pisdfStack("PisdfStack");
DynStack archiStack("ArchiStack");
#define SH_MEM 0x00500000
PlatformLinux platform(4, SH_MEM, &archiStack, daq_fft_fcts, N_FCT_DAQ_FFT);
Archi* archi = platform.getArchi();
cfg.memAllocType = MEMALLOC_SPECIAL_ACTOR;
cfg.memAllocStart = (void*)0;
cfg.memAllocSize = SH_MEM;
cfg.schedulerType = SCHEDULER_LIST;
cfg.srdagStack = {STACK_DYNAMIC, "SrdagStack", 0, 0};
cfg.transfoStack = {STACK_DYNAMIC, "TransfoStack", 0, 0};
spider_init(cfg);
printf("Start\n");
// try{
PiSDFGraph *topPisdf = init_daq_fft(archi, &pisdfStack);
topPisdf->print("topPisdf.gv");
Platform::get()->rstTime();
spider_launch(archi, topPisdf);
spider_printGantt(archi, spider_getLastSRDAG(), "daq_fft.pgantt", "latex.tex", &stat);
spider_getLastSRDAG()->print("daq_fft.gv");
printf("EndTime = %d ms\n", stat.globalEndTime/1000000);
printf("Memory use = ");
if(stat.memoryUsed < 1024)
printf("\t%5.1f B", stat.memoryUsed/1.);
else if(stat.memoryUsed < 1024*1024)
printf("\t%5.1f KB", stat.memoryUsed/1024.);
else if(stat.memoryUsed < 1024*1024*1024)
printf("\t%5.1f MB", stat.memoryUsed/1024./1024.);
else
printf("\t%5.1f GB", stat.memoryUsed/1024./1024./1024.);
printf("\n");
FILE* f = fopen("timings.csv", "w+");
fprintf(f, "Actors,x86\n");
printf("Actors:\n");
for(int j=0; j<stat.nbActor; j++) {
printf("\t%12s:", stat.actors[j]->getName());
fprintf(f, "%s", stat.actors[j]->getName());
for(int k=0; k<archi->getNPETypes(); k++) {
printf("\t%d (x%d)",
stat.actorTimes[j][k]/stat.actorIterations[j][k],
stat.actorIterations[j][k]);
fprintf(f, ",%d", stat.actorTimes[j][k]/stat.actorIterations[j][k]);
}
printf("\n");
fprintf(f, "\n");
}
free_daq_fft(topPisdf, &pisdfStack);
// }catch(const char* s){
// printf("Exception : %s\n", s);
// }
printf("finished\n");
spider_free();
return 0;
}
示例14: main
int main(int argc, char* argv[]) {
SpiderConfig cfg;
ExecutionStat stat;
// initActors();
StaticStack pisdfStack("PisdfStack", pisdfStackMem, PISDF_SIZE);
StaticStack archiStack("ArchiStack", archiStackMem, ARCHI_SIZE);
#define SH_MEM 0x04000000
PlatformK2Arm platform(1, 0, USE_DDR, SH_MEM, &archiStack, stereo_fcts, N_FCT_STEREO);
Archi* archi = platform.getArchi();
cfg.memAllocType = MEMALLOC_SPECIAL_ACTOR;
cfg.memAllocStart = (void*)0;
cfg.memAllocSize = SH_MEM;
cfg.schedulerType = SCHEDULER_LIST;
cfg.srdagStack.type = STACK_STATIC;
cfg.srdagStack.name = "SrdagStack";
cfg.srdagStack.size = SRDAG_SIZE;
cfg.srdagStack.start = srdagStack;
cfg.transfoStack.type = STACK_STATIC;
cfg.transfoStack.name = "TransfoStack";
cfg.transfoStack.size = TRANSFO_SIZE;
cfg.transfoStack.start = transfoStack;
spider_init(cfg);
printf("Start\n");
try {
int i=1;
// for(int i=1; i<=1; i++){
printf("NStep = %d\n", i);
char ganttPath[30];
sprintf(ganttPath, "stereo.pgantt");
char srdagPath[30];
sprintf(srdagPath, "stereo.gv");
pisdfStack.freeAll();
PiSDFGraph *topPisdf = init_stereo(archi, &pisdfStack);
topPisdf->print("topPisdf.gv");
Platform::get()->rstTime();
spider_launch(archi, topPisdf);
//
spider_printGantt(archi, spider_getLastSRDAG(), ganttPath, "latex.tex", &stat);
spider_getLastSRDAG()->print(srdagPath);
printf("EndTime = %d ms\n", stat.globalEndTime/1000000);
printf("Memory use = ");
if(stat.memoryUsed < 1024)
printf("\t%5.1f B", stat.memoryUsed/1.);
else if(stat.memoryUsed < 1024*1024)
printf("\t%5.1f KB", stat.memoryUsed/1024.);
else if(stat.memoryUsed < 1024*1024*1024)
printf("\t%5.1f MB", stat.memoryUsed/1024./1024.);
else
printf("\t%5.1f GB", stat.memoryUsed/1024./1024./1024.);
printf("\n");
printf("Actors:\n");
for(int j=0; j<stat.nbActor; j++) {
printf("\t%12s:", stat.actors[j]->getName());
for(int k=0; k<archi->getNPETypes(); k++)
printf("\t%d (x%d)",
stat.actorTimes[j][k]/stat.actorIterations[j][k],
stat.actorIterations[j][k]);
printf("\n");
}
free_stereo(topPisdf, &pisdfStack);
// }
} catch(const char* s) {
printf("Exception : %s\n", s);
}
printf("finished\n");
spider_free();
return 0;
}
示例15: daq_fft
// Method building PiSDFGraphdaq_fft
PiSDFGraph* daq_fft(Archi* archi, Stack* stack) {
PiSDFGraph* graph = CREATE(stack, PiSDFGraph)(
/*Edges*/ 8,
/*Params*/ 5,
/*InputIf*/ 0,
/*OutputIf*/ 0,
/*Config*/ 1,
/*Body*/ 9,
/*Archi*/ archi,
/*Stack*/ stack);
/* Parameters */
PiSDFParam *param_Nr = graph->addDynamicParam("Nr");
PiSDFParam *param_Nc = graph->addDynamicParam("Nc");
PiSDFParam *param_N1 = graph->addDynamicParam("n1");
PiSDFParam *param_N2 = graph->addDynamicParam("n2");
PiSDFParam *param_size = graph->addStaticParam("size", 2*64*1024);
/* Vertices */
PiSDFVertex* bo_src = graph->addBodyVertex(
/*Name*/ "src",
/*FctId*/ SRC_FCT,
/*InData*/ 0,
/*OutData*/ 1,
/*InParam*/ 1);
bo_src->addInParam(0, param_size);
bo_src->isExecutableOnPE(CORE_ARM0);
bo_src->isExecutableOnPE(CORE_DSP0);
bo_src->setTimingOnType(CORE_TYPE_C6678, "1000", stack);
bo_src->setTimingOnType(CORE_TYPE_CORTEXA15, "1000", stack);
PiSDFVertex* bo_T_1 = graph->addBodyVertex(
/*Name*/ "T_1",
/*FctId*/ T_1_FCT,
/*InData*/ 1,
/*OutData*/ 1,
/*InParam*/ 2);
bo_T_1->addInParam(0, param_Nc);
bo_T_1->addInParam(1, param_Nr);
bo_T_1->isExecutableOnPE(CORE_DSP0);
bo_T_1->isExecutableOnPE(CORE_DSP3);
bo_T_1->isExecutableOnPE(CORE_DSP4);
bo_T_1->isExecutableOnPE(CORE_DSP1);
bo_T_1->isExecutableOnPE(CORE_DSP2);
bo_T_1->isExecutableOnPE(CORE_DSP7);
bo_T_1->isExecutableOnPE(CORE_DSP5);
bo_T_1->isExecutableOnPE(CORE_DSP6);
// bo_T_1->isExecutableOnPE(CORE_ARM0);
bo_T_1->setTimingOnType(CORE_TYPE_C6678, "1000", stack);
bo_T_1->setTimingOnType(CORE_TYPE_CORTEXA15, "1000", stack);
PiSDFVertex* bo_FFT_2 = graph->addBodyVertex(
/*Name*/ "FFT_2",
/*FctId*/ FFT_2_FCT,
/*InData*/ 1,
/*OutData*/ 1,
/*InParam*/ 2);
bo_FFT_2->addInParam(0, param_Nr);
bo_FFT_2->addInParam(1, param_N1);
bo_FFT_2->isExecutableOnPE(CORE_DSP0);
bo_FFT_2->isExecutableOnPE(CORE_DSP3);
bo_FFT_2->isExecutableOnPE(CORE_DSP4);
bo_FFT_2->isExecutableOnPE(CORE_DSP1);
bo_FFT_2->isExecutableOnPE(CORE_DSP2);
bo_FFT_2->isExecutableOnPE(CORE_DSP7);
bo_FFT_2->isExecutableOnPE(CORE_DSP5);
bo_FFT_2->isExecutableOnPE(CORE_DSP6);
// bo_FFT_2->isExecutableOnPE(CORE_ARM0);
// bo_FFT_2->isExecutableOnPE(CORE_ARM1);
bo_FFT_2->setTimingOnType(CORE_TYPE_C6678, "32000", stack);
bo_FFT_2->setTimingOnType(CORE_TYPE_CORTEXA15, "17000", stack);
PiSDFVertex* bo_T_3 = graph->addBodyVertex(
/*Name*/ "T_3",
/*FctId*/ T_3_FCT,
/*InData*/ 1,
/*OutData*/ 1,
/*InParam*/ 2);
bo_T_3->addInParam(0, param_Nr);
bo_T_3->addInParam(1, param_Nc);
bo_T_3->isExecutableOnPE(CORE_DSP0);
bo_T_3->isExecutableOnPE(CORE_DSP3);
bo_T_3->isExecutableOnPE(CORE_DSP4);
bo_T_3->isExecutableOnPE(CORE_DSP1);
bo_T_3->isExecutableOnPE(CORE_DSP2);
bo_T_3->isExecutableOnPE(CORE_DSP7);
bo_T_3->isExecutableOnPE(CORE_DSP5);
bo_T_3->isExecutableOnPE(CORE_DSP6);
// bo_T_3->isExecutableOnPE(CORE_ARM0);
bo_T_3->setTimingOnType(CORE_TYPE_C6678, "1000", stack);
bo_T_3->setTimingOnType(CORE_TYPE_CORTEXA15, "1000", stack);
PiSDFVertex* bo_Twi_4 = graph->addBodyVertex(
/*Name*/ "Twi_4",
/*FctId*/ TWI_4_FCT,
/*InData*/ 2,
/*OutData*/ 1,
/*InParam*/ 2);
bo_Twi_4->addInParam(0, param_Nc);
//.........这里部分代码省略.........