Port the `computeConnectivity` routine to run on device.
Port the
computeConnectivityroutine to run on device.