implement cuda to default distance calculation.