Exemple #1
0
        private OpenCLProgram LoadProgram(string resourceName)
        {
            var source  = GetProgramSourceFromResource(Assembly.GetExecutingAssembly(), resourceName);
            var program = new OpenCLProgram(Context, source);

            try
            {
                var optionsList = new[]
                {
                    "-cl-fast-relaxed-math",
                    "-cl-mad-enable",
                    "-cl-no-signed-zeros",
                    "-cl-strict-aliasing",
                    "-Werror"
                };
                var options = string.Join(" ", optionsList);
                program.Build(new List <OpenCLDevice> {
                    CommandQueue.Device
                }, options, null, IntPtr.Zero);
            }
            catch (BuildProgramFailureOpenCLException)
            {
                var buildLog = program.GetBuildLog(CommandQueue.Device);
                throw new ApplicationException($"Error building program \"{resourceName}\":{Environment.NewLine}{buildLog}");
            }

            return(program);
        }
Exemple #2
0
        private static OpenCLProgram LoadProgram(OpenCLContext context, OpenCLDevice device, string resourceName)
        {
            var source  = GetProgramSourceFromResource(Assembly.GetExecutingAssembly(), resourceName);
            var program = new OpenCLProgram(context, source);

            try
            {
                program.Build(new List <OpenCLDevice> {
                    device
                }, string.Empty, null, IntPtr.Zero);
            }
            catch (BuildProgramFailureOpenCLException)
            {
                var buildLog = program.GetBuildLog(device);
                throw new ApplicationException($"Error building program \"{resourceName}\":{Environment.NewLine}{buildLog}");
            }

            return(program);
        }
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);
        }
Exemple #4
0
 public static extern OpenCLKernel clCreateKernel(OpenCLProgram program, String kernel_name, Error error);
Exemple #5
0
 public static extern Error clCreateKernelsInProgram(OpenCLProgram program, Int32 num_kernels, [Out] OpenCLKernel[] kernels, Int32 num_kernels_ret);
Exemple #6
0
 public static Error clRetainProgram(OpenCLProgram program)
 {
     Console.WriteLine("Calling Error clRetainProgram(OpenCLProgram program)");
     return default(Error);
 }
Exemple #7
0
 public static extern Error clBuildProgram(OpenCLProgram program, Int32 num_devices, [In] OpenCLDevice[] device_list, String options, NotifyFunction func, IntPtr user_data);
Exemple #8
0
 public static Error clGetProgramBuildInfo(OpenCLProgram program, OpenCLDevice device, ProgramBuildInfo param_name, IntPtr param_value_size, IntPtr param_value, out IntPtr param_value_size_ret)
 {
     param_value_size_ret = default(IntPtr);
     Console.WriteLine("Calling Error clGetProgramBuildInfo(OpenCLProgram program, OpenCLDevice device, ProgramBuildInfo param_name, IntPtr param_value_size, IntPtr param_value, out IntPtr param_value_size_ret)");
     return default(Error);
 }
Exemple #9
0
 public static Error clGetProgramInfo(OpenCLProgram program, ProgramInfo param_name, IntPtr param_value_size, IntPtr param_value, IntPtr param_value_size_ret)
 {
     Console.WriteLine("Calling Error clGetProgramInfo(OpenCLProgram program, ProgramInfo param_name, IntPtr param_value_size, IntPtr param_value, IntPtr param_value_size_ret)");
     return default(Error);
 }
Exemple #10
0
 public static Error clCreateKernelsInProgram(OpenCLProgram program, Int32 num_kernels, [Out] OpenCLKernel[] kernels, Int32 num_kernels_ret)
 {
     Console.WriteLine("Calling Error clCreateKernelsInProgram(OpenCLProgram program, Int32 num_kernels, [Out] OpenCLKernel[] kernels, Int32 num_kernels_ret)");
     return default(Error);
 }
Exemple #11
0
 public static Error clBuildProgram(OpenCLProgram program, Int32 num_devices, [In] OpenCLDevice[] device_list, String options, NotifyFunction func, IntPtr user_data)
 {
     Console.WriteLine("Calling Error clBuildProgram(OpenCLProgram program, Int32 num_devices, [In] OpenCLDevice[] device_list, String options, NotifyFunction func, IntPtr user_data)");
     return default(Error);
 }
Exemple #12
0
 public static extern Error clRetainProgram(OpenCLProgram program);
Exemple #13
0
 public static extern Error clReleaseProgram(OpenCLProgram program);
Exemple #14
0
 public static OpenCLKernel clCreateKernel(OpenCLProgram program, String kernel_name, Error error)
 {
     Console.WriteLine("Calling OpenCLKernel clCreateKernel(OpenCLProgram program, String kernel_name, Error error)");
     return default(OpenCLKernel);
 }
Exemple #15
0
 public static extern Error clGetProgramInfo(OpenCLProgram program, ProgramInfo param_name, IntPtr param_value_size, IntPtr param_value, IntPtr param_value_size_ret);
Exemple #16
0
 public static extern Error clGetProgramBuildInfo(OpenCLProgram program, OpenCLDevice device, ProgramBuildInfo param_name, IntPtr param_value_size, IntPtr param_value, IntPtr param_value_size_ret);