Ejemplo n.º 1
0
        public OpenClCompiler(Device device, string source)
        {
            _device = device;
            _ctx    = device.CreateContext();

            SVMCapabilities capabilities = _device.SvmCapabilities;

            IsCoarseGrainBufferSupported = (capabilities & SVMCapabilities.SvmCoarseGrainBuffer) == SVMCapabilities.SvmCoarseGrainBuffer;
            IsFineGrainBufferSupported   = (capabilities & SVMCapabilities.SvmFineGrainBuffer) == SVMCapabilities.SvmFineGrainBuffer;
            IsFineGrainSystemSupported   = (capabilities & SVMCapabilities.SvmFineGrainSystem) == SVMCapabilities.SvmFineGrainSystem;
            IsAtomicSupported            = (capabilities & SVMCapabilities.SvmAtomics) == SVMCapabilities.SvmAtomics;

            Source   = source;
            _program = new Program(Cl.CreateProgramWithSource(_ctx, 1, new string[] { source }, null, out ErrorCode error));
            Cl.BuildProgram(_program, 1, new[] { _device }, string.Empty, null, IntPtr.Zero);

            KernelCount = _program.NumKernels;
            Methodes    = _program.KernelNames;

            _kernels = new Kernel[KernelCount];

            Cl.CreateKernelsInProgram(_program, KernelCount, _kernels, out _);
        }
Ejemplo n.º 2
0
 /// <summary>
 //Ctor
 internal Device(IntPtr handle)
 {
     Handle = handle;
     SVMCapabilities capabilities = Utils.GetTInfo <DeviceInfo, SVMCapabilities>(Handle, DeviceInfo.SvmCapabilities, Cl.GetDeviceInfo);
 }