Please run the following codes to build the library (Do not forget to install XRT/XRM and setup the environment):
#!/bin/bash cd Vitis_Libraries/graph/L3/lib make libgraphL3 export LD_LIBRARY_PATH=<PATH TO YOUR Vitis_Libraries/graph/L3/lib>:$LD_LIBRARY_PATH
To make use of the L3/APIs, please include Vitis_Libraries/graph/L3/include
path and link Vitis_Libraries/graph/L3/lib
path when compiling the code.
The following steps are usually required to make a call of the L3 APIs:
- Setup the handle
xf::graph::L3::Handle::singleOP op0; // create a configuration of operation (such as shortest path, wcc) op0.operationName = "shortestPathFloat"; xf::graph::L3::Handle handle0; handle0.addOp(op0); // initialize the Alveo board with the required operation, may have more than one kind of operation handle0.setUp(); // Download binaries to FPGAs
- Setup and Deploy the Graph
xf::graph::Graph<uint32_t, DT> g("CSR", numVertices, numEdges, offsetsCSR, indicesCSR, weightsCSR); // Create the graph (handle0.opsp)->loadGraph(g); // Deploy the graph data
- Run the required operation
auto ev = xf::graph::L3::shortestPath(handle0, nSource, &sourceID, weighted, g, result, pred); // Run the operation, this is a non-block call, actually start a thread int ret = ev.wait(); // wait for the operation to finish
- Release resources
(handle0.opsp)->join(); // join the thread handle0.free(); // release other memories g.freeBuffers(); // release graph memories