Ejemplo n.º 1
0
        private static void Run(
            Arr arr,
            int start,
            int cacheSize,
            int cacheLineLength,
            int associativity,
            long repetitions,
            int coreIndex,
            IDummy dummy)
        {
            int *a   = arr.a;
            int  sum = 0;

            for (long r = 0; r < repetitions; r++)
            {
                dummy.DummyMethod(a);
                for (int c = 0; c < cacheLineLength; c++)
                {
                    for (int i = 0; i < 1 << 20; i++)
                    {
                        int j = ((i * 1009) % associativity) * cacheSize + c;
                        sum += a[start + j];
                    }
                }
            }


            lock (lockObject)
                totalSum += sum;
        }
Ejemplo n.º 2
0
        private static void RunVectorTriad(TriadData data, long vectorLength, long repetitions, IDummy dummy)
        {
            fixed(double *ap = data.a)
            fixed(double *bp = data.b)
            fixed(double *cp = data.c)
            fixed(double *dp = data.d)
            {
                for (long r = 0; r < repetitions; r++)
                {
                    if (ap[1] < 1)
                    {
                        dummy.DummyMethod(ap, bp, cp, dp);
                    }

                    for (long i = 0; i < vectorLength; i++)
                    {
                        long j = i;//(i * 1009) % vectorLength;
                        ap[j] = bp[j] + cp[j] * dp[j];
                    }
                }
            }
        }