Hello. I tried to launch 2 kernels one after another. The first one works fine but the other one isn’t launched at all. What could be the problem?
__global__ void initialize(float *d_lower, float *d_upper, struct harmony *d_population, curandState *states)
{
int i;
int j = threadIdx.x;
if (j == 0){
printf("%f %f %f\n", d_lower[0], d_lower[1], d_lower[2]);
printf("%f %f %f\n", d_upper[0], d_upper[1], d_upper[2]);
}
for (i = 0; i < NVARS; i++)
{
if (j<POPSIZE)
{
d_population[j].fitness = 0;
d_population[j].rfitness = 0;
d_population[j].cfitness = 0;
d_population[j].lower[i] = -1.0;
d_population[j].upper[i] = 1.0;
d_population[j].notes[i] = (curand_uniform(&states[j]) - 0.5)*2.0;
}
}
}
__global__ void produce(){
int i = threadIdx.x, j = threadIdx.y, member = blockIdx.x;
atomicAdd(&d_population[member].fitness, i + j);
__syncthreads();
}
kernel initialize is launched successfully, while the other doesn’t. It is as if it doesn’t get into the kernel to do the atomic adds. What could be the problem?