FFTThread
- Set the maximum number of threads:
HmppResult HMPP_SetFFTNumberThreads(int32_t fftNumberThreads);
- Obtain the current number of threads:
HmppResult HMPP_GetFFTNumberThreads(int32_t* fftNumberThreads);
Parameters
Parameter |
Description |
Value Range |
Input/Output |
|---|---|---|---|
fftNumberThreads |
Maximum number of threads (SetFFTNumberThreads). |
Greater than 0. |
Input |
fftNumberThreads |
Pointer to the number of threads (GetFFTNumberThreads). |
The value cannot be NULL. |
Output |
Return Value
- Success: HMPP_STS_NO_ERR
- Failure: An error code is returned.
Error Codes
Error Code |
Description |
|---|---|
HMPP_STS_NULL_PTR_ERR |
The input pointer is NULL. |
HMPP_STS_SIZE_ERR |
The value of len is less than or equal to 0. |
Example
#define NUMBER_THREAD_FFT 4
void FFT_Thread_Example()
{
int curNum = 0;
HMPP_GetNumberThreads(&curNum);
printf("curNum = %d\n", curNum);
HMPP_SetFFTNumberThreads(NUMBER_THREAD_FFT);
int num = 0;
HMPP_GetNumberThreads(&num);
printf("num = %d\n", num);
}
Output:
curNum = 8 num = 4
- By default, the number of FFT threads in the HMPP is 8. You can use the HMPP_SetFFTNumberThreads function described in this section to set the number of FFT threads used for current task execution. The setting is not permanently valid.
- In addition, you can set the number of FFT threads through the HUAWEI_HMPP_FFT_THREAD_NUM environment variable.
Parent topic: Basic Functions