---
title: kupl_set_kernel_concurrency_local
description: "设置当前线程作为主线程用于调用memcpy算子时支持的多线程并发度。"
url: https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpckit/devg/KunpengHPCKit_developer_072.html
sourcePath: /source/zh/kunpenghpcs/hpckit/devg/KunpengHPCKit_developer_072.html
indexId: 3150303f8cbfd90bbbd8947cfc416ac72628d640f36f115045ec5deab24e0f2067
---
# kupl_set_kernel_concurrency_local

设置当前线程作为主线程用于调用memcpy算子时支持的多线程并发度。

#### 接口定义

void kupl_set_kernel_concurrency_local(int num);


#### 参数


**表1 参数定义**

| 参数名 | 类型 | 描述 | 输入/输出 |
| --- | --- | --- | --- |
| num | int | 需要设置的当前线程的算子并发度的值 约束：1≤num≤kupl\_get\_num\_executors()。当输入不在约束范围内时，内部设置num为kupl\_get\_num\_executors() | 输入 |


#### 示例

```
#include <stdio.h> 
#include "kupl.h" 

int main() 
{ 
    kupl_set_kernel_concurrency_local(2); 
    int num = kupl_get_kernel_concurrency_local();
    printf("local kupl kernel concurrency = %d\n", num); 
    return 0; 
}
```

运行结果如下。

```
local kupl kernel concurrency = 2
```

- 上述示例设置并打印了当前线程的算子并发度的值。
- 上述kupl_set_kernel_concurrency_local函数将算子并发度设置为2。
