Constant Mem Overflowed Error in CUDA 4RC2


Here’s the problem I’ve observed: Taking the code that worked (and compiled) perfectly fine in CUDA 3.2, and recompiling with CUDA 4.0RC2 on the same machine, I get the following error: “Error: Const space overflowed.”

After some digging, an even more mystifying discovery. The following code compiles in 4.0RC2:

#include <stdlib.h>
#include “cuda.h”
//#include “curand_kernel.h” //this line causes the constant mem overflow error!

using namespace std;

constant float stuff[15000];

void crapfunc()

Please note the commented out curand_kernel header. Including that header results in the above error! In fact, with the “curand_kernel.h” in, the largest number of floats that can be allocated to constant mem becomes 3,584, equivalent to 14,336k.

Is this a known issue and will it be resolved in the final 4.0 release?

Thanks in advance for any ideas.


Alright. Very simply, if “curand_kernel.h” is included, somewhere in the kernel I must have some code referencing that header. For example, including code:

global void MrKernelSir(int blah, int bleh){

curandState RandState;
curand_init(2, 0, 0, &RandState);


resolves the Const Mem Overflowed issue. That header must be causing a mess if left unreferenced.

Not exactly a solution, but, with the superfluous inclusion of the curand header, my code was not without blame.