improved for gpu
with pre initialization