move local matrix calculation to gpu