Rate This Document
Findability
Accuracy
Completeness
Readability

kupl_graph_create

Create a KUPL dynamic graph. By adding tasks to the dynamic graph, you can enable concurrent execution across multiple tasks, thereby fully utilizing the multi-core capacity of Kunpeng hardware.

Interface Definition

kupl_graph_h kupl_graph_create(kupl_egroup_h egroup);

Parameters

Table 1 Parameter definition

Parameter

Type

Description

Input/Output

egroup

kupl_egroup_h

Executor collection used by the graph. This parameter can be set to KUPL_ALL_EXECUTORS, indicating that all available executors are used.

Input

Return Value

  • Success: created KUPL graph
  • Failure: nullptr

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#include <stdio.h> 
#include "kupl.h" 

int main() 
{ 
    int executor_num = kupl_get_num_executors(); 
    int executors[executor_num]; 
    for (int i =0; i < executor_num; i++) {
        executors[i] = i;
    } 
    kupl_egroup_h egroup = kupl_egroup_create(executors, executor_num);
    kupl_graph_h graph = kupl_graph_create(egroup); 
    kupl_graph_destroy(graph);
    kupl_egroup_destroy(egroup);
    return 0;         
}

The preceding example demonstrates how to create and then destroy an egroup and a graph. The preceding kupl_graph_create function creates a graph associated with all executors.