I should write a code in CUDA which computes an array in a recursive loop. There is the possibility to precompute some intermediate steps of this recursive loop before it, i.e. to allocate some constant arrays and scalars which would avoid some computations in the loop.
The first idea was to store the constant arrays in the global memory, while scalar parameters are passed every time from the CPU to the GPU (as suggested here: CUDA and shared variables among different global functions).
I would like to try to use the GPU constant memory since it should be faster. However, the few sample codes which I found illustrate how to allocate constant memory from the host. Is it possibile to allocate some constant memory from the GPU, i.e. computing there its values (like we would do with global memory)? And could you please provide a sample code?
Edit: Since I could allocate a lot of constant arrays, maybe the texture memory could be better to use in this situation. Are there some sample codes on how to allocate memory there from the GPU?