STABLE VERSION WITH DIC CALCULATION ON BOTH GPU AND CPU