time function added

also created the GPU version to revise