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 6989499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:13:12+00:00 2026-05-27T19:13:12+00:00

I am continuously getting an Access Violation Error with a all my kernels which

  • 0

I am continuously getting an Access Violation Error with a all my kernels which I am trying to build. Other kernels which I take from books seem to work fine.

https://github.com/ssarangi/VideoCL – This is where the code is.

Something seems to be missing in this. Could someone help me with this.

Thanks so much.

[James] – Thanks for the suggestion and you are right. I am doing it on Win 7 with a AMD Redwood card. I have the Catalyst 11.7 drivers with AMD APP SDK 2.5. I am posting the code below.

#include <iostream>
#include "bmpfuncs.h"

#include "CLManager.h"

void main()
{
    float theta = 3.14159f/6.0f;
    int W ;
    int H ;

    const char* inputFile = "input.bmp";
    const char* outputFile = "output.bmp";

    float* ip = readImage(inputFile, &W, &H);
    float *op = new float[W*H];

    //We assume that the input image is the array “ip”
    //and the angle of rotation is theta
    float cos_theta = cos(theta);
    float sin_theta = sin(theta);

    try
    {
        CLManager* clMgr = new CLManager();

        // Build the Source
        unsigned int pgmID = clMgr->buildSource("rotation.cl");

        // Create the kernel
        cl::Kernel* kernel = clMgr->makeKernel(pgmID, "img_rotate");

        // Create the memory Buffers
        cl::Buffer* clIp = clMgr->createBuffer(CL_MEM_READ_ONLY, W*H*sizeof(float));
        cl::Buffer* clOp = clMgr->createBuffer(CL_MEM_READ_WRITE, W*H*sizeof(float));

        // Get the command Queue
        cl::CommandQueue* queue = clMgr->getCmdQueue();
        queue->enqueueWriteBuffer(*clIp, CL_TRUE, 0, W*H*sizeof(float), ip);

        // Set the arguments to the kernel
        kernel->setArg(0, clOp);
        kernel->setArg(1, clIp);
        kernel->setArg(2, W);
        kernel->setArg(3, H);
        kernel->setArg(4, sin_theta);
        kernel->setArg(5, cos_theta);

        // Run the kernel on specific NDRange
        cl::NDRange globalws(W, H);


        queue->enqueueNDRangeKernel(*kernel, cl::NullRange, globalws, cl::NullRange);

        queue->enqueueReadBuffer(*clOp, CL_TRUE, 0, W*H*sizeof(float), op);

        storeImage(op, outputFile, H, W, inputFile);
    }
    catch(cl::Error error)
    {
        std::cout << error.what() << "(" << error.err() << ")" << std::endl;
    }
}

I am getting the error at the queue->enqueueNDRangeKernel line.
I have the queue and the kernel stored in a class.

CLManager::CLManager()
    : m_programIDs(-1)
{
    // Initialize the Platform
    cl::Platform::get(&m_platforms);

    // Create a Context
    cl_context_properties cps[3] = {
        CL_CONTEXT_PLATFORM,
        (cl_context_properties)(m_platforms[0])(),
        0
    };

    m_context = cl::Context(CL_DEVICE_TYPE_GPU, cps);

    // Get a list of devices on this platform
    m_devices = m_context.getInfo<CL_CONTEXT_DEVICES>();

    cl_int err;

    m_queue = new cl::CommandQueue(m_context, m_devices[0], 0, &err);
}


cl::Kernel* CLManager::makeKernel(unsigned int programID, std::string kernelName)
{
    cl::CommandQueue queue = cl::CommandQueue(m_context, m_devices[0]);

    cl::Kernel* kernel = new cl::Kernel(*(m_programs[programID]), kernelName.c_str());

    m_kernels.push_back(kernel);

    return kernel;
}
  • 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-05-27T19:13:12+00:00Added an answer on May 27, 2026 at 7:13 pm

    I checked your code. I’m on Linux though. At runtime I’m getting Error -38, which means CL_INVALID_MEM_OBJECT. So I went and checked your buffers.

    cl::Buffer* clIp = clMgr->createBuffer(CL_MEM_READ_ONLY, W*H*sizeof(float));
    cl::Buffer* clOp = clMgr->createBuffer(CL_MEM_READ_WRITE, W*H*sizeof(float));
    

    Then you pass the buffers as a Pointer:

    kernel->setArg(0, clOp);
    kernel->setArg(1, clIp);
    

    But setArg is expecting a value, so the buffer pointers should be dereferenced:

    kernel->setArg(0, *clOp);
    kernel->setArg(1, *clIp);
    

    After those changes the cat rotates 😉

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

Sidebar

Related Questions

AM getting continuously the illegal character error in this url : http://my.server.com/SelectPerson-0.1/nativeService/businessCardSave?company=Select Person&fullName=Rghh Dgivv&email=uday@uioperr.info&phoneNo=123456789&desiredPosition=Machine
Trying to generate db driven menu which based on parent->child structure. All root menu
I continuously get an error when I open all text and log files in
While deploying a dwr web app, i'm continuously getting this error. I dont know
I'm getting UDP packets from the port continuously. Following is the log from wireshark.
I want to continuously sample from my PC's audio line in using C# (then
I have a process which gives me continuously output in Screen. I want to
I am making a Windows service which needs to continuously check for database entries
I am making application in c#. I am getting data on 24097 port continuously
I am flex developer, and from last few months, i am continuously working on

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.