Skip to content
Snippets Groups Projects
Commit 18e12d80 authored by Prakalp Srivastava's avatar Prakalp Srivastava
Browse files

Fixed timers in sgemm and spmv

parent c68716d8
No related branches found
No related tags found
No related merge requests found
......@@ -102,6 +102,7 @@ int main (int argc, char *argv[]) {
exit(-1);
}
pb_SwitchToTimer(&timers, visc_TimerID_SETUP);
cl_int clStatus;
cl_platform_id clPlatform;
clStatus = clGetPlatformIDs(1,&clPlatform,NULL);
......@@ -139,14 +140,13 @@ int main (int argc, char *argv[]) {
// load A
readColMajorMatrixFile(params->inpFiles[0],
matArow, matAcol, matA);
// copy A to device memory
A_sz = matArow*matAcol*sizeof(float);
// load B^T
readColMajorMatrixFile(params->inpFiles[2],
matBcol, matBrow, matBT);
pb_SwitchToTimer( &timers, pb_TimerID_COMPUTE );
// copy A to device memory
A_sz = matArow*matAcol*sizeof(float);
B_sz = matBrow*matBcol*sizeof(float);
// allocate space for C
......@@ -154,6 +154,8 @@ int main (int argc, char *argv[]) {
// OpenCL memory allocation
std::vector<float> matC(matArow*matBcol);
pb_SwitchToTimer( &timers, pb_TimerID_COPY );
cl_mem dA = clCreateBuffer(clContext,CL_MEM_READ_ONLY,A_sz,NULL,&clStatus);
CHECK_ERROR("clCreateBuffer")
cl_mem dB = clCreateBuffer(clContext,CL_MEM_READ_ONLY,B_sz,NULL,&clStatus);
......@@ -174,6 +176,7 @@ int main (int argc, char *argv[]) {
clStatus = clEnqueueWriteBuffer(clCommandQueue,dC,CL_TRUE,0,C_sz,&matC.front(),0,NULL,NULL);
CHECK_ERROR("clEnqueueWriteBuffer")
pb_SwitchToTimer( &timers, pb_TimerID_COMPUTE );
pb_SwitchToTimer( &timers, pb_TimerID_KERNEL );
// Use standard sgemm interface
......
......@@ -108,14 +108,14 @@ int main (int argc, char *argv[]) {
// load A
readColMajorMatrixFile(params->inpFiles[0],
matArow, matAcol, matA);
// copy A to device memory
A_sz = matArow*matAcol*sizeof(float);
// load B^T
readColMajorMatrixFile(params->inpFiles[2],
matBcol, matBrow, matBT);
pb_SwitchToTimer( &timers, pb_TimerID_COMPUTE );
// copy A to device memory
A_sz = matArow*matAcol*sizeof(float);
B_sz = matBrow*matBcol*sizeof(float);
// allocate space for C
......@@ -133,7 +133,7 @@ int main (int argc, char *argv[]) {
for(size_t i=0; i<matC.size(); i++)
matC[i] = 0.0f;
pb_SwitchToTimer( &timers, pb_TimerID_KERNEL );
pb_SwitchToTimer( &timers, pb_TimerID_NONE );
// Use standard sgemm interface
basicSgemm('N', 'T', matArow, matBcol, matAcol, 1.0f, \
......@@ -149,6 +149,7 @@ int main (int argc, char *argv[]) {
matArow, matBcol, matC);
}
pb_SwitchToTimer( &timers, visc_TimerID_MEM_UNTRACK );
llvm_visc_untrack_mem(&matA.front());
llvm_visc_untrack_mem(&matBT.front());
llvm_visc_untrack_mem(&matC.front());
......
......@@ -99,7 +99,6 @@ void spmv_jds(float *dst_vector, float *d_data,
}
int main(int argc, char** argv) {
__visc__init();
struct pb_TimerSet timers;
struct pb_Parameters *parameters;
......@@ -114,6 +113,7 @@ int main(int argc, char** argv) {
}
pb_InitializeTimerSet(&timers);
__visc__init();
pb_SwitchToTimer(&timers, pb_TimerID_COMPUTE);
//parameters declaration
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment