Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7783055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:43:53+00:00 2026-06-01T19:43:53+00:00

Have following kernel function: private static String programSource = __kernel void sampleKernel(__global float *Y,

  • 0

Have following kernel function:

   private static String programSource =
        "__kernel void sampleKernel(__global float *Y, __global  float *param) "
        + "{ int index = get_global_id(0); "
        + "  Y[index]=param[0]-Y[index]/param[1]-param[2]; "
        + "} ";

First argument “Y” works perfect, but second parameter “param” works non correct, I receive null values . Second parametr must be a array and consists from 3 cells.

Fragment of code with the transmission parameters:

        float[] arr_params = new float[3];
        arr_params[0] = (float) h_c;
        arr_params[1] = (float) sy;
        arr_params[2] = (float) dy;

        //pointers
        Pointer Pvy = Pointer.to(vy);
        Pointer Parr_params = Pointer.to(arr_params);

        cl_mem memObjects[] = new cl_mem[2];

        memObjects[0] = clCreateBuffer(context,
                CL_MEM_READ_WRITE,
                Sizeof.cl_float * vy.length, Pvy, null);
        memObjects[1] = clCreateBuffer(context,
                CL_MEM_READ_ONLY,
                Sizeof.cl_float * arr_params.length, Parr_params, null);

        // Set the arguments for the kernel
        clSetKernelArg(kernel, 0,
                Sizeof.cl_mem, Pointer.to(memObjects[0]));
        clSetKernelArg(kernel, 1,
                Sizeof.cl_mem, Pointer.to(memObjects[1]));

        // Set the work-item dimensions
        long global_work_size[] = new long[]{vy.length};
        long local_work_size[] = new long[]{1};

        // Execute the kernel
        clEnqueueNDRangeKernel(commandQueue, kernel, 1, null,
                global_work_size, local_work_size, 0, null, null);

        // Read the output data
        clEnqueueReadBuffer(commandQueue, memObjects[0], CL_TRUE, 0, vy.length * Sizeof.cl_float, Pvy, 0, null, null);
        // Release kernel, program, and memory objects
        clReleaseMemObject(memObjects[0]);
        clReleaseMemObject(memObjects[1]);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T19:43:54+00:00Added an answer on June 1, 2026 at 7:43 pm

    The second buffer is all zeros because, in the clCreateBuffer call, you haven’t told OpenCL where to get the data. Use CL_MEM_USE_HOST_PTR or CL_MEM_COPY_HOST_PTR.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following (snippet) of a kernel. __global__ void plain(int* geneVec, float* probs,
I'm updating kernel on embedded platform to 3.3. I have following mem allocation dump
In a CUDA kernel, I have code similar to the following. I am trying
I have following string String str = replace :) :) with some other string;
I have following foreach-loop: using System.IO; //... if (Directory.Exists(path)) { foreach(string strFile in Directory.GetFiles(path,
I have following table structure: Table: Plant PlantID: Primary Key PlantName: String Table: Party
I have the following call trace and info from kernel: INFO: task raw_device_benc:9684 blocked
I have the following code in a kernel module that walks up the process
I have a somewhat complex kernel with the following stats: ptxas info : Compiling
Situation I have the following Sitecore Lucene config: New index, type=Sitecore.Search.Index, Sitecore.Kernel Contains two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.