move some parameters to constant memory. change gini computation to just one single loop.