Added gpu implementation.