Exemplo n.º 1
0
 /// <summary>
 /// create opencl buffer
 /// </summary>
 /// <param name="context"></param>
 /// <param name="numberOfElements_"></param>
 /// <param name="clType_"></param>
 /// <param name="GDDR_BUFFER"></param>
 /// <param name="isCSharpArray_"></param>
 /// <param name="arrPointer"></param>
 /// <param name="readOnly">always kernel reads, host writes</param>
 /// <param name="writeOnly">always kernel writes, host reads</param>
 public ClBuffer(ClContext context, int numberOfElements_, SizeOf clType_, bool GDDR_BUFFER, bool readOnly, bool writeOnly, int isCSharpArray_ = 1, IntPtr arrPointer = new IntPtr())
 {
     hContext         = context.h();
     numberOfElements = numberOfElements_;
     clType           = clType_;
     hBuffer          = createBuffer(hContext, numberOfElements, (int)clType, isCSharpArray_, arrPointer, GDDR_BUFFER, readOnly, writeOnly);
 }
Exemplo n.º 2
0
 /// <summary>
 /// creates a command queue in a context
 /// </summary>
 /// <param name="context"></param>
 /// <param name="defaultQueue">OpenCL 2.0 dynamic parallelism queue</param>
 /// <param name="async">async!=0 means out-of-order command queue</param>
 public ClCommandQueue(ClContext context, bool defaultQueue, int async = 0)
 {
     hContext = context.h();
     hDevice  = context.hd();
     if (defaultQueue)
     {
         try
         {
             hCommandQueue = createCommandQueue2(hContext, hDevice, async, defaultQueue);
         }
         catch (EntryPointNotFoundException epnfe)
         {
             Console.WriteLine("Error: KutuphaneCL.dll's OpenCL2.0 dynamic parallelism support(needs v1.4.1+) not found.");
             Console.WriteLine(epnfe.Message);
         }
         finally
         {
         }
     }
     else
     {
         hCommandQueue = createCommandQueue(hContext, hDevice, async);
     }
     addedMarkers = 0;
 }
Exemplo n.º 3
0
 /// <summary>
 /// creates a program from kernel string and context
 /// </summary>
 /// <param name="context"></param>
 /// <param name="clKernelString">kernel string to compile</param>
 public ClProgram(ClContext context, ClString clKernelString)
 {
     hContext        = context.h();
     hDevice         = context.hd();
     hString         = clKernelString.h();
     hProgram        = createProgram(hContext, hDevice, hString);
     intProgramError = getProgramErr(hProgram);
     // strHata = Encoding.UTF8.GetString(programHataStringiOku(hProgram));
     strProgramError = new StringBuilder(readProgramErrString(hProgram)).ToString();
 }
Exemplo n.º 4
0
 /// <summary>
 /// creates user event for fine grained synchronization
 /// </summary>
 /// <param name="ct"></param>
 public ClUserEvent(ClContext ct)
 {
     hUserEvent = createUserEvent(ct.h());
     hContext   = ct.h();
 }