AOCL libraries perform tasks that can be computationally expensive
and time consuming. AOCL Progress feature provides a callback
mechanism to check how far a computation has progressed. This
feature is available for only select set of APIs.
Usage
Application must define a function named aocl_fla_progress or
any other function in a specific format and register this as a callback
function with AOCL-LAPACK library.
The callback function prototype must be defined as follows:
int aocl_fla_progress(const char* const api, const integer lenapi,
const integer* const progress, const integer* const current_thread,
const integer* const total_threads)
Name of the function can be changed as per your preference.
Following table explains the parameters of the callback function:
Parameter |
Purpose |
|---|---|
api |
Name of the API running currently |
lenapi |
Length of the API name character buffer |
progress |
Linear progress made in the current thread so far |
current_thread |
Current thread ID |
total_threads |
Total number of threads in the current threads team |
Callback Registration
As mentioned previously, the callback function must be registered with AOCL-LAPACK library to get the progress update. Registration is done by calling:
aocl_fla_set_progress(test_progress);
Example:
int aocl_fla_progress(const char* const api,const integer lenapi,
const integer* const progress,const integer* const current_thread,
const integer* const total_threads)
{
printf("In AOCL FLA Progress thread %lld, at API %s, progress %lld total threads= %lld\n",
*current_thread, api, *progress,*total_threads );
return 0;
}
// or
int test_progress(const char* const api,const integer lenapi,const
integer * const progress,const integer *const current_thread,const
integer *const total_threads)
{
printf( "In AOCL Progress thread %lld, at API %s, progress %lld total threads= %lld\n",
*current_thread, api, *progress,*total_threads );
return 0;
}
// Register the callback with:
aocl_fla_set_progress(test_progress);
Note
In case of single-threaded AOCL-LAPACK (–enable-multithreading=none or ENABLE_MULTITHREADING=OFF), values of “current_thread” and “total_threads” are set to 0 and 1 respectively. As a result, the callback function cannot be used to monitor the thread ID and thread count of the application.
Limitations
On Windows, aocl_fla_progress is not supported when using AOCL-LAPACK. Hence, the callback function must be registered through aocl_fla_set_progress.