/// <summary> /// Creates a <see cref="ComputeKernel"/> for every <c>kernel</c> function in <see cref="ComputeProgram"/>. /// </summary> /// <returns> The collection of created <see cref="ComputeKernel"/>s. </returns> /// <remarks> <see cref="ComputeKernel"/>s are not created for any <c>kernel</c> functions in <see cref="ComputeProgram"/> that do not have the same function definition across all <see cref="ComputeProgram.Devices"/> for which a program executable has been successfully built. </remarks> public ICollection <ComputeKernel> CreateAllKernels() { ICollection <ComputeKernel> kernels = new Collection <ComputeKernel>(); int kernelsCount = 0; CLKernelHandle[] kernelHandles; ComputeErrorCode error = CL10.CreateKernelsInProgram(Handle, 0, null, out kernelsCount); ComputeException.ThrowOnError(error); kernelHandles = new CLKernelHandle[kernelsCount]; error = CL10.CreateKernelsInProgram(Handle, kernelsCount, kernelHandles, out kernelsCount); ComputeException.ThrowOnError(error); for (int i = 0; i < kernelsCount; i++) { kernels.Add(new ComputeKernel(kernelHandles[i], this)); } return(kernels); }