Results 1 to 2 of 2

Thread: Initializing constant variables

  1. #1
    Junior Member
    Join Date
    May 2010
    Posts
    1

    Initializing constant variables

    Hi,

    I am trying to overwrite code from CUDA to OpenCl.
    Is there a way how to initialize constants variables declared in program source from host source?
    In CUDA you can read global variables with the function cuModuleGetGlobal() and set their values. I would like to do something like that in OpenCL.


    Thanks

  2. #2
    Junior Member
    Join Date
    Mar 2010
    Posts
    22

    Re: Initializing constant variables

    You can create the constants variables on the host, then initialize a memory object that contains it, do the corresponding copy of data, add this memory object in the kernel args and finally add the lline on you r kernel function file with __constant prefix.

Similar Threads

  1. Initializing array on the GPU!
    By Atmapuri in forum OpenCL
    Replies: 1
    Last Post: 06-28-2011, 05:51 AM
  2. initializing constant variable from file
    By finleybull in forum OpenCL
    Replies: 1
    Last Post: 07-01-2010, 10:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •