public SpecialPointCollector(int wordsPerNumber, Pollard_Rho pRho, OpenCLBuffer <uint> gpuSpecialPointsBuffer, StartingPointGenerator startingPointGenerator)
 {
     this.wordsPerNumber         = wordsPerNumber;
     this.pRho                   = pRho;
     this.gpuSpecialPointsBuffer = gpuSpecialPointsBuffer;
     this.startingPointGenerator = startingPointGenerator;
 }
Exemple #2
0
        public DLPSolver(InputTuple input)
        {
            modulus = input.Modulus;

            if (modulus % 2 == 0)
            {
                throw new NotImplementedException("At the moment, it is not possible to use an even number for a modulus.");
            }

            generator = input.Generator;
            order     = input.Order;
            element   = input.Element;

            wordsPerNumber = modulus.ToUintArray().Length;
            rAsPower       = 32 * wordsPerNumber;

            Pollard_Rho pRho = new Pollard_Rho(input, rAsPower);

            // Initialize the startingPointGenerator.
            gpuStartingPointsBuffer = new OpenCLBuffer <uint>(program, new uint[4 * NUM_GPU_THREADS * wordsPerNumber]);
            startingPointGenerator  = new StartingPointGenerator(input, rAsPower, wordsPerNumber, pRho, program, gpuStartingPointsBuffer);

            // Initialize the specialPointCollector.
            gpuSpecialPointsBuffer = new OpenCLBuffer <uint>(program, new uint[2 * wordsPerNumber * 4 * NUM_GPU_THREADS]);
            specialPointCollector  = new SpecialPointCollector(wordsPerNumber, pRho, gpuSpecialPointsBuffer, startingPointGenerator);
        }
Exemple #3
0
        public StartingPointGenerator(InputTuple input, int rAsPower, int wordsPerNumber, Pollard_Rho pRho, OpenCLProgram program, OpenCLBuffer <uint> startingPointsBuffer)
        {
            this.modulus        = input.Modulus;
            this.generator      = input.Generator;
            this.order          = input.Order;
            this.element        = input.Element;
            this.rAsPower       = rAsPower;
            this.wordsPerNumber = wordsPerNumber;
            this.pRho           = pRho;

            this.kernel = new OpenCLKernel(program, "add_new_starting_points");
            this.newStartingPointsBuffer = new OpenCLBuffer <uint>(program, new uint[4 * DLPSolver.NUM_GPU_THREADS * wordsPerNumber]);

            this.startingPointPool = new uint[4 * DLPSolver.NUM_GPU_THREADS * wordsPerNumber];

            kernel.SetArgument(0, startingPointsBuffer);
            kernel.SetArgument(1, newStartingPointsBuffer);
        }