FloydWarshall#

Functions#

NVCVStatus pvaFloydWarshallCreate(NVCVOperatorHandle *handle, NVCVTensorRequirements *tensorRequirements)

Constructs an instance of the Floyd-Warshall operator.

NVCVStatus pvaFloydWarshallSubmit(NVCVOperatorHandle handle, cupvaStream_t stream, NVCVTensorHandle lenTensor, NVCVTensorHandle nextTensor)

Submits the Floyd-Warshall operator to a cuPVA stream.

NVCVStatus pvaFloydWarshallSubmit(NVCVOperatorHandle handle, cudaStream_t stream, NVCVTensorHandle lenTensor, NVCVTensorHandle nextTensor)

Submits the Floyd-Warshall operator to a CUDA stream.

Functions#

NVCVStatus pvaFloydWarshallCreate(
NVCVOperatorHandle *handle,
NVCVTensorRequirements *tensorRequirements,
)#

Constructs an instance of the Floyd-Warshall operator.

The Floyd-Warshall algorithm finds the shortest path between each pair of nodes in a weighted graph. There are two tensors involved in the algorithm:

  • length tensor: represents the length of the shortest path between each pair of nodes. For a graph with N nodes, this should be an N*N tensor initialized as:

    • length[i][i] = 0

    • length[i][j] = weight of the edge, if a direct edge exists from node i to j

    • length[i][j] = positive infinity (0xFFFF), if no direct edge exists

  • next tensor: represents the next node in the shortest path between each pair of nodes. For a graph with N nodes, this should be an N*N tensor initialized as:

    • next[i][i] = i

    • next[i][j] = j, if a direct edge exists from node i to j

    • next[i][j] = NIL (0xFFFF), if no direct edge exists The next tensor is used to reconstruct the shortest path. Both tensors are updated in place. Length tensor: Data Layout: [HWC] Channels: [1] Data Type: [16bit Unsigned] Next tensor: Data Layout: [HWC] Channels: [1] Data Type: [16bit Unsigned]

Note

The current implementation supports graphs with up to 240 nodes (N <= 240) due to VMEM constraints.

Note

The length tensor and the next tensor must have the same dimensions.

Parameters:
  • handle[out] Where the operator instance handle will be written to.

    • Must not be NULL.

  • tensorRequirements[in] Pointer to the NVCVTensorRequirements structure.

Return values:
  • NVCV_ERROR_INVALID_ARGUMENT – Handle is null.

  • NVCV_ERROR_OUT_OF_MEMORY – Not enough memory to create the operator.

  • NVCV_SUCCESS – Operation executed successfully.

NVCVStatus pvaFloydWarshallSubmit(
NVCVOperatorHandle handle,
cupvaStream_t stream,
NVCVTensorHandle lenTensor,
NVCVTensorHandle nextTensor,
)#

Submits the Floyd-Warshall operator to a cuPVA stream.

Parameters:
  • handle[in] Handle to the operator.

    • Must not be NULL.

  • stream[in] Handle to a valid cuPVA stream.

  • lenTensor[in] Length tensor handle.

  • nextTensor[in] Next tensor handle.

Return values:
  • NVCV_ERROR_INVALID_ARGUMENT – Some parameter is outside valid range.

  • NVCV_ERROR_INTERNAL – Internal error in the operator, invalid types passed in.

  • NVCV_SUCCESS – Operation executed successfully.

NVCVStatus pvaFloydWarshallSubmit(
NVCVOperatorHandle handle,
cudaStream_t stream,
NVCVTensorHandle lenTensor,
NVCVTensorHandle nextTensor,
)#

Submits the Floyd-Warshall operator to a CUDA stream.

Note

CUDA stream support requirements:

  • PVA SDK 2.7.0 or later

  • Jetpack 7 or later

  • DriveOS 7 or later

  • x86 Emulator is not supported

Parameters:
  • handle[in] Handle to the operator.

  • stream[in] Handle to a valid CUDA stream.

  • lenTensor[in] Length tensor handle.

  • nextTensor[in] Next tensor handle.

Return values:
  • NVCV_ERROR_INVALID_ARGUMENT – Some parameter is outside valid range.

  • NVCV_ERROR_INTERNAL – Internal error in the operator, invalid types passed in.

  • NVCV_SUCCESS – Operation executed successfully.