Пример #1
0
int main(int argc, char* argv[]){
	SpiderConfig cfg;
	ExecutionStat stat;

	cfg.memAllocType = MEMALLOC_SPECIAL_ACTOR;
	cfg.memAllocStart = (void*)0;
	cfg.memAllocSize = SH_MEM_SIZE;

	cfg.schedulerType = SCHEDULER_LIST;

	cfg.archiStack.type = STACK_STATIC;
	cfg.archiStack.name = "ArchiStack";
	cfg.archiStack.size = ARCHI_SIZE;
	cfg.archiStack.start = archiStack;

	cfg.pisdfStack.type = STACK_STATIC;
	cfg.pisdfStack.name = "PiSDFStack";
	cfg.pisdfStack.size = PISDF_SIZE;
	cfg.pisdfStack.start = pisdfStack;

	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;

	cfg.lrtStack.type = STACK_STATIC;
	cfg.lrtStack.name = "LrtStack";
	cfg.lrtStack.size = LRT_SIZE;
	cfg.lrtStack.start = lrtStack;

	cfg.useGraphOptim = true;
	cfg.useActorPrecedence = true;

	cfg.platform.nLrt = 1;
	cfg.platform.shMemSize = SH_MEM_SIZE;
	cfg.platform.fcts = stereo_fcts;
	cfg.platform.nLrtFcts = N_FCT_STEREO;

	Spider::init(cfg);

	printf("Start\n");

//	try{
		int i=1;
//	for(int i=1; i<=1; i++){
		printf("NStep = %d\n", i);

		init_stereo();

		Spider::iterate();

		Spider::printGantt("stereo.pgantt", "stereo_tex.dat", &stat);
		Spider::printSRDAG("stereo.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");

		Spider::printActorsStat(&stat);

		free_stereo();
//	}
//	}catch(const char* s){
//		printf("Exception : %s\n", s);
//	}
	printf("finished\n");
	Spider::clean();

	return 0;
}
Пример #2
0
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;
}