Pre-calculate some constants before calling GPU kernels