Exemple #1
0
        public BatchMemSchedHelper bhelper;         //ranking algorithm helper

        /**
         * Constructor
         */
        public BatchMemSched(int buf_size, Bank[] bank, RankAlgo rank_algo, BatchSchedAlgo batch_sched_algo)
            : base(buf_size, bank)
        {
            //stat
            bstat = new BatchMemSchedStat(this);

            //components
            this.rank_algo = rank_algo;
            this.batch_sched_algo = batch_sched_algo;

            rank_to_proc = new int[Config.N];
            proc_to_rank = new int[Config.N];
            for (int p = 0; p < Config.N; p++) {
                rank_to_proc[p] = p;
                proc_to_rank[p] = Config.N - 1;
            }

            //batch formulation; marking
            markable = new MemoryRequest[Config.N][][];
            for (int p = 0; p < Config.N; p++) {
                markable[p] = new MemoryRequest[bank_max][];
                for (int b = 0; b < bank_max; b++) {
                    markable[p][b] = new MemoryRequest[markable_len];
                }
            }

            markable_cnt = new int[Config.N][];
            for (int p = 0; p < Config.N; p++) {
                markable_cnt[p] = new int[bank_max];
            }

            markable_cnt_unbound = new int[Config.N][];
            for (int p = 0; p < Config.N; p++) {
                markable_cnt_unbound[p] = new int[bank_max];
            }

            //marked requests per processor
            cur_marked_per_proc = new int[Config.N];
            cur_period_marked_per_proc = new int[Config.N];

            //marked requests per processor, bank
            cur_marked_per_procbank = new int[Config.N, bank_max];
            cur_period_marked_per_procbank = new int[Config.N, bank_max];

            //bhelper
            bhelper = new BatchMemSchedHelper(this);

            Console.WriteLine("Initialized BATCH_MemoryScheduler");
            Console.WriteLine("Ranking Scheme: " + rank_algo.ToString());
            Console.WriteLine("WithinBatch Priority: " + batch_sched_algo.ToString());
            Console.WriteLine("BatchingCap: " + Config.memory.batch_cap);
        }
Exemple #2
0
        public BATCH_WITH_PRIORITIES_MemoryScheduler(int totalSize, Bank[] bank, RankAlgo rankingScheme)
            : base(totalSize, bank)
        {
            this.rankingScheme = rankingScheme;
            procRank           = new int[Config.N];
            Rank = new int[Config.N];
            markedReqThisBatchPerPriority = new int[Config.memory.prio_max];

            curMarkedPerProc     = new int[Config.N];
            curMarkedPerProcBank = new int[Config.N, Config.memory.bank_max_per_mem];
            exceedsBatchingCap   = new bool[Config.N, Config.memory.bank_max_per_mem];

            threadPriority       = new int[Config.N];
            minimumPriorityLevel = Config.memory.prio_max + 1;
            for (int p = 0; p < Config.N; p++)
            {
                threadPriority[p] = (int)Config.memory.weight[p];  // TODO: Properly rescale between weights and priorities!
                Console.WriteLine("Processor " + p + " has priority-level: " + threadPriority[p]);
                if (threadPriority[p] < minimumPriorityLevel)
                {
                    minimumPriorityLevel = threadPriority[p];
                }
            }

            avgNumReqPerProcRemark            = new double[Config.N];
            avgMaxReqPerProcRemark            = new double[Config.N];
            avgNumReqPerProcRecomp            = new ulong[Config.N];
            avgMaxReqPerProcRecomp            = new ulong[Config.N];
            avgMarkedReqAtBatchEnd            = new ulong[Config.N];
            avgNumMarkedReqPerProcRemark      = new double[Config.N];
            avgMaxMarkedReqPerProcRemark      = new double[Config.N];
            finalavgNumMarkedReqPerProcRemark = new double[Config.N];
            finalavgMaxMarkedReqPerProcRemark = new double[Config.N];
            markCountPerPriority         = new ulong[Config.memory.prio_max];
            finalmarkCountPerPriority    = new ulong[Config.N];
            finalavgNumReqPerProcRemark  = new double[Config.N];
            finalavgMaxReqPerProcRemark  = new double[Config.N];
            finalavgNumReqPerProcRecomp  = new double[Config.N];
            finalavgMaxReqPerProcRecomp  = new double[Config.N];
            finalavgMarkedReqAtBatchEnd  = new double[Config.N];
            avgFullBatchingDuration      = new ulong[Config.N];
            finalavgFullBatchingDuration = new double[Config.N];
            batchStart = new ulong[Config.memory.prio_max];
            for (int i = 0; i < Config.N; i++)
            {
                procRank[i] = i;
                Rank[i]     = Config.N - 1;
            }
            Console.WriteLine("Initialized BATCH_WITH_PRIORITIES_MemoryScheduler");
            Console.WriteLine("Ranking Scheme: " + rankingScheme.ToString());
        }
        public BATCH_WITH_PRIORITIES_MemoryScheduler(int totalSize, Bank[] bank, RankAlgo rankingScheme)
            : base(totalSize, bank)
        {
            this.rankingScheme = rankingScheme;
            procRank = new int[Config.N];
            Rank = new int[Config.N];
            markedReqThisBatchPerPriority = new int[Config.memory.prio_max];

            curMarkedPerProc = new int[Config.N];
            curMarkedPerProcBank = new int[Config.N, Config.memory.bank_max_per_mem];
            exceedsBatchingCap = new bool[Config.N, Config.memory.bank_max_per_mem];

            threadPriority = new int[Config.N];
            minimumPriorityLevel = Config.memory.prio_max + 1;
            for (int p = 0; p < Config.N; p++) {
                threadPriority[p] = (int)Config.memory.weight[p];  // TODO: Properly rescale between weights and priorities!
                Console.WriteLine("Processor " + p + " has priority-level: " + threadPriority[p]);
                if (threadPriority[p] < minimumPriorityLevel) minimumPriorityLevel = threadPriority[p];
            }

            avgNumReqPerProcRemark = new double[Config.N];
            avgMaxReqPerProcRemark = new double[Config.N];
            avgNumReqPerProcRecomp = new ulong[Config.N];
            avgMaxReqPerProcRecomp = new ulong[Config.N];
            avgMarkedReqAtBatchEnd = new ulong[Config.N];
            avgNumMarkedReqPerProcRemark = new double[Config.N];
            avgMaxMarkedReqPerProcRemark = new double[Config.N];
            finalavgNumMarkedReqPerProcRemark = new double[Config.N];
            finalavgMaxMarkedReqPerProcRemark = new double[Config.N];
            markCountPerPriority = new ulong[Config.memory.prio_max];
            finalmarkCountPerPriority = new ulong[Config.N];
            finalavgNumReqPerProcRemark = new double[Config.N];
            finalavgMaxReqPerProcRemark = new double[Config.N];
            finalavgNumReqPerProcRecomp = new double[Config.N];
            finalavgMaxReqPerProcRecomp = new double[Config.N];
            finalavgMarkedReqAtBatchEnd = new double[Config.N];
            avgFullBatchingDuration = new ulong[Config.N];
            finalavgFullBatchingDuration = new double[Config.N];
            batchStart = new ulong[Config.memory.prio_max];
            for (int i = 0; i < Config.N; i++) {
                procRank[i] = i;
                Rank[i] = Config.N - 1;
            }
            Console.WriteLine("Initialized BATCH_WITH_PRIORITIES_MemoryScheduler");
            Console.WriteLine("Ranking Scheme: " + rankingScheme.ToString());
        }
Exemple #4
0
        public PERBANK_BATCH_MemoryScheduler(int totalSize, Bank[] bank,
            RankAlgo rankingScheme, BatchSchedAlgo withinBatchPriority)
            : base(totalSize, bank)
        {
            this.rankingScheme = rankingScheme;
            this.withinBatchPriority = withinBatchPriority;
            procRank = new int[Config.N];
            Rank = new int[Config.N];
            perBankprocRank = new int[Config.N, Config.memory.bank_max_per_mem];
            perBankRank = new int[Config.N, Config.memory.bank_max_per_mem];
            curMarkedPerProc = new int[Config.N];
            thisPeriodMarkedPerProc = new int[Config.N];
            avgNumReqPerProcRemark = new double[Config.N];
            avgMaxReqPerProcRemark = new double[Config.N];
            avgNumMarkedReqPerProcRemark = new double[Config.N];
            avgMaxMarkedReqPerProcRemark = new double[Config.N];
            avgNumReqPerProcRecomp = new ulong[Config.N];
            avgMaxReqPerProcRecomp = new ulong[Config.N];
            avgMarkedReqAtBatchEnd = new ulong[Config.N];
            totalBatchCompletionTime = new ulong[Config.N];
            numberOfActiveBatches = new ulong[Config.N];
            sample_totalBatchCompletionTime = new ulong[Config.N];
            sample_numberOfActiveBatches = new ulong[Config.N];
            LPoptimal_totalBatchCompletionTime = new ulong[Config.N];
            LPoptimal_numberOfActiveBatches = new ulong[Config.N];
            nrTotalMarkedRequests = new ulong[Config.N];
            nrTotalRequests = new ulong[Config.N];
            finalavgNumReqPerProcRemark = new double[Config.N];
            finalavgMaxReqPerProcRemark = new double[Config.N];
            finalavgNumMarkedReqPerProcRemark = new double[Config.N];
            finalavgMaxMarkedReqPerProcRemark = new double[Config.N];
            finalavgNumReqPerProcRecomp = new double[Config.N];
            finalavgMaxReqPerProcRecomp = new double[Config.N];
            finalavgMarkedReqAtBatchEnd = new double[Config.N];
            finaltotalBatchCompletionTime = new ulong[Config.N];
            finalnumberOfActiveBatches = new ulong[Config.N];
            final_sample_totalBatchCompletionTime = new ulong[Config.N];
            final_sample_numberOfActiveBatches = new ulong[Config.N];
            final_LPoptimal_totalBatchCompletionTime = new ulong[Config.N];
            final_LPoptimal_numberOfActiveBatches = new ulong[Config.N];
            finalnrTotalMarkedRequests = new ulong[Config.N];
            finalnrTotalRequests = new ulong[Config.N];
            curMarkedPerProcBank = new int[Config.N, Config.memory.bank_max_per_mem];
            thisPeriodMarkedPerProcBank = new int[Config.N, Config.memory.bank_max_per_mem];
            exceedsBatchingCap = new bool[Config.N, Config.memory.bank_max_per_mem];
            thisPeriodMarkedMaxPerProc = new int[Config.N];
            thisPeriodMarkedTotalPerProc = new int[Config.N];

            for (int i = 0; i < Config.N; i++)
            {
                procRank[i] = i;
                Rank[i] = Config.N - 1;

                for (int b = 0; b < Config.memory.bank_max_per_mem; b++)
                {
                    perBankprocRank[i, b] = i;
                    perBankRank[i, b] = Config.N - 1;
                }
            }
            Console.WriteLine("Initialized PERBANK_BATCH_MemoryScheduler");
            Console.WriteLine("Ranking Scheme: " + rankingScheme.ToString() + " Sampling: " + Config.memory.ACTSamplingBatchInterval);
            Console.WriteLine("WithinBatch Priority: " + withinBatchPriority.ToString());
            Console.WriteLine("BatchingCap: " + Config.memory.batch_cap);
        }