This project is read-only.

CUDAfy and OpenCL parameter error.

Apr 13, 2015 at 7:35 AM
Edited Apr 13, 2015 at 7:36 AM
Hello, Some time ago i use CUDAfy for CUDA. I was very usefull. So now i try to write some code for OpenCL. And have a trouble with parameters to kernel function.
I try to reduce array size, try many other after all i wrote test code, but it also have this trouble:
            CudafyModule km = CudafyModule.TryDeserialize();
            if (km == null || !km.TryVerifyChecksums())
                km = CudafyTranslator.Cudafy();
            CudafyModes.DeviceId = comboBox1.SelectedIndex; // selecting device (Videocard by default)
            GPGPU gpu = CudafyHost.GetDevice(CudafyModes.Target, CudafyModes.DeviceId );
            textBox1.AppendText(String.Format(Environment.NewLine + "Starting on Device {0} ( {1} )", CudafyModes.DeviceId, gpu.GetDeviceProperties(false).Name) );
            UInt32[] partBuf = new UInt32[26];
            UInt32[] dev_items = gpu.Allocate<UInt32>(partBuf); // at this pont we got dev_items size 0!!! is that right?!!
            dim3 threads = new dim3(5, 6);
            dim3 grids = new dim3(7, 8);
            gpu.Launch(threads, grids).calc_db_units( 0, 0, 0, dev_items ); // at this point we've got an "OpenCL error code detected: InvalidArgumentSize." error message.

            gpu.CopyFromDevice(dev_items, partBuf);
// Just test function...only for "doing something"...
        public static void calc_db_units(GThread thread, UInt32 definer, UInt16 dp, UInt32 part, UInt32[] generated)
            UInt64 currResult = (UInt64)thread.blockDim.x + ((UInt64)thread.blockDim.y << 8) + ((UInt64)thread.gridDim.x << 16) + ((UInt64)thread.gridDim.y);
            generated[0] = (UInt32)(currResult);
            generated[1] = (UInt32)(currResult >> 32);
So, what i've doing wrong?
Thank you.
Apr 13, 2015 at 9:39 AM
So, it starts when i remove all params but thread and buffer.
        public static void calc_db_units(GThread thread, UInt32[] generated)
So how can i give to a kernel some parameters, when using OpenCL target?