Beispiel #1
0
        /// <summary>
        /// Test all versions of:
        /// 
        /// EnqueueNDRangeKernel
        /// 
        /// The tests just issue a dummy kernel a bunch of times with the various overloads
        /// </summary>
        /// <param name="c"></param>
        /// <param name="cq"></param>
        private void TestEnqueueNDRangeKernel(Context c, CommandQueue cq, Kernel k )
        {
            Output("Testing EnqueueNDRangeKernel");

            Event event0 = null;
            Event event1 = null;

            try
            {
                {
                    IntPtr[] globalWorkSize = new IntPtr[] { (IntPtr)10 };
                    IntPtr[] localWorkSize = new IntPtr[] { (IntPtr)1 };
                    cq.EnqueueNDRangeKernel(k, (uint)1, null, globalWorkSize, localWorkSize);
                    cq.EnqueueNDRangeKernel(k, (uint)1, null, globalWorkSize, localWorkSize, 0, null, out event0);
                    Event[] waitList = new Event[] { event0 };
                    cq.EnqueueNDRangeKernel(k, (uint)1, null, globalWorkSize, localWorkSize, 1, waitList, out event1);
                    cq.Finish();
                    event0.Dispose();
                    event1.Dispose();
                }
                {
                    int[] globalWorkSize = new int[] { (int)10 };
                    int[] localWorkSize = new int[] { (int)1 };
                    cq.EnqueueNDRangeKernel(k, 1, null, globalWorkSize, localWorkSize);
                    cq.EnqueueNDRangeKernel(k, 1, null, globalWorkSize, localWorkSize, 0, null, out event0);
                    Event[] waitList = new Event[] { event0 };
                    cq.EnqueueNDRangeKernel(k, 1, null, globalWorkSize, localWorkSize, 1, waitList, out event1);
                    cq.Finish();
                    event0.Dispose();
                    event1.Dispose();
                }
                {
                    long[] globalWorkSize = new long[] { (long)10 };
                    long[] localWorkSize = new long[] { (long)1 };
                    cq.EnqueueNDRangeKernel(k, 1, null, globalWorkSize, localWorkSize);
                    cq.EnqueueNDRangeKernel(k, 1, null, globalWorkSize, localWorkSize, 0, null, out event0);
                    Event[] waitList = new Event[] { event0 };
                    cq.EnqueueNDRangeKernel(k, 1, null, globalWorkSize, localWorkSize, 1, waitList, out event1);
                    cq.Finish();
                    event0.Dispose();
                    event1.Dispose();
                }
            }
            catch (Exception e)
            {
                Error("Exception during testing: " + e.ToString());
            }
            finally
            {
                if (event0 != null)
                    event0.Dispose();
                if (event1 != null)
                    event1.Dispose();
            }
        }