Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'clfftEnqueueTransform' input parameter outEvent,Event time erroe. #248

Open
SuDong1999 opened this issue Jan 4, 2024 · 0 comments
Open

Comments

@SuDong1999
Copy link

Set "event" as the parameter of the output event of the "clfftEnqueueTransform" function, and use "clWaitForEvents" to wait for the event to complete, and use "event" to calculate the Fourier transform time 1. The code is as follows:
int PC1D::fft(cl_mem& src, cl_mem& dst)
{
cl_event event;
clfftEnqueueTransform(_separatePlan, CLFFT_FORWARD, 1, &_commandQue, 0, NULL, &event, &src, &dst, NULL);

//统计计算行时间
_err = clWaitForEvents(1, &event);
if (_err != CL_SUCCESS) { PRINT_ERROR(_err); }
cl_ulong startTime, endTime;
_err = clGetEventProfilingInfo(event, CL_PROFILING_COMMAND_START, sizeof(cl_ulong), &startTime, NULL);
if (_err != CL_SUCCESS) { PRINT_ERROR(_err); }
_err = clGetEventProfilingInfo(event, CL_PROFILING_COMMAND_END, sizeof(cl_ulong), &endTime, NULL);
if (_err != CL_SUCCESS) { PRINT_ERROR(_err); }
_fftTime += endTime - startTime;
return 0;

}
The second method: Use the clFinish function to wait for the command queue to complete execution, and get the time of the system timer before and after execution, giving time 2.The code is as follows:
clFinish(_commandQue);
tic(0);
fft(_receipt,_receipt);
clFinish(_commandQue);
toc(0, "Total time: ");
It is found that time 2 is 6 or 7 times that of time 1. What is the cause of this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant