Commit 12534ca5 authored by tempy@maggie's avatar tempy@maggie
Browse files

Wrong compile flags have been removed

parent 272eebef
......@@ -359,7 +359,7 @@ for(i=0;i<=Bm;i++)BI[i]--; for(i=0;i<Bnnz;i++)BJ[i]--;
printmm_one(Am, Cval, CJ, CI);
/** In order to write the output C matrix to file, uncomment the following line */
//printfilemm_one(strpathC, Am, Bn, Cval, CJ, CI);
printfilemm_one(strpathC, Am, Bn, Cval, CJ, CI);
/** run my SpGEMM routine in order to find number of multiply-and-add operations */
long nummult = 0;
......
......@@ -13,10 +13,11 @@ set(CMAKE_VERBOSE_MAKEFILE ON)
#find_package(MKL)
SET(ICC_MKL_LINK_FLAGS " -mkl -offload-option,mic,ld,\"-rpath /opt/intel/mic/myo/lib/ -rpath /opt/intel/mic/coi/device-linux-release/lib/\"")
#SET(ICC_MKL_LINK_FLAGS " -mkl -offload-option,mic,ld,\"-rpath /opt/intel/mic/myo/lib/ -rpath /opt/intel/mic/coi/device-linux-release/lib/\"")
SET(ICC_MKL_LINK_FLAGS " -mkl ")
#SET( CMAKE_EXE_LINKER_FLAGS "${ICC_MKL_LINK_FLAGS}" )
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${ICC_MKL_LINK_FLAGS}")
#set(CMAKE_CC_COMPILER_FLAGS " -g3 ")
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../../cmake/common.cmake)
......
......@@ -190,31 +190,6 @@ csr *csr_multiply(csi Am, csi An, csi Anzmax, const csi* Ap, const csi* Aj, cons
}/*}}}*/
/** Multiply two sparse matrices which are stored in CSR format. MKL is used */
void mkl_cpu_spgemm(MKL_INT Am, MKL_INT An, MKL_INT Annz, double* Aval, MKL_INT* AJ, MKL_INT* AI, MKL_INT Bn, MKL_INT Bnnz, double* Bval, MKL_INT* BJ, MKL_INT* BI, double** pCval, MKL_INT** pCJ, MKL_INT** pCI, double* time) { /*{{{*/
MKL_INT* CJ = NULL;
double* Cval = NULL;
MKL_INT sort = 3; // sort everything
MKL_INT* CI = (MKL_INT*)mkl_malloc( (Am+2) * sizeof( MKL_INT ), 64 );
MKL_INT nnzmax = 0; // nnzmax is zero in case of symbolic&numeric usage of mkl_?csrmultcsr
MKL_INT ierr;
MKL_INT request = 1; // symbolic multiplication
mkl_dcsrmultcsr(&transa, &request, &sort, &Am, &An, &Bn, Aval, AJ, AI, Bval, BJ, BI, Cval, CJ, CI, &nnzmax, &ierr);
request = 2; //numeric multiplication
int Cnnz = CI[Am]-1;
int Cval_size = Cnnz + 1;
CJ = (MKL_INT*)mkl_malloc( Cval_size * sizeof( MKL_INT ), 64 );
Cval = (double*)mkl_malloc( Cval_size * sizeof( double ), 64 );
double time_st = dsecnd();
int i;
for(i = 0; i < nrepeat; i++) {
mkl_dcsrmultcsr(&transa, &request, &sort, &Am, &An, &Bn, Aval, AJ, AI, Bval, BJ, BI, Cval, CJ, CI, &nnzmax, &ierr);
}
double time_end = dsecnd();
*time = (time_end - time_st)/nrepeat;
*pCval = Cval; *pCJ = CJ; *pCI = CI;
} /*}}}*/
void mkl_mic_spgemm(MKL_INT Am, MKL_INT An, MKL_INT Annz, double* Aval, MKL_INT* AJ, MKL_INT* AI, MKL_INT Bn, MKL_INT Bnnz, double* Bval, MKL_INT* BJ, MKL_INT* BI, double** pCval, MKL_INT** pCJ, MKL_INT** pCI, double* time) {/*{{{*/
int i;
......@@ -225,7 +200,7 @@ void mkl_mic_spgemm(MKL_INT Am, MKL_INT An, MKL_INT Annz, double* Aval, MKL_INT*
} else {
nthreads = mkl_get_max_threads();
}
} // printf("MIC started \n"); fflush(stdout);
}
#pragma offload target(mic:micdev) \
in(transa) \
in(Am) \
......@@ -238,13 +213,6 @@ void mkl_mic_spgemm(MKL_INT Am, MKL_INT An, MKL_INT Annz, double* Aval, MKL_INT*
in(BI:length(An+1) free_if(0)) \
in(BJ:length(Bnnz) free_if(0))
{}
//void mkl_dcsrmultcsr (char *transa, MKL_INT *job, MKL_INT *sort, MKL_INT *m, MKL_INT *n, MKL_INT *k, double *a, MKL_INT *ja, MKL_INT *ia, double *b, MKL_INT *jb, MKL_INT *ib, double *c, MKL_INT *jc, MKL_INT *ic, MKL_INT *nnzmax, MKL_INT *ierr);
// double s_initial = dsecnd();
// double s_elapsed = dsecnd() - s_initial; // seconds
MKL_INT Cnnz_host = -1;
MKL_INT* CI = NULL;
......@@ -288,10 +256,10 @@ void mkl_mic_spgemm(MKL_INT Am, MKL_INT An, MKL_INT Annz, double* Aval, MKL_INT*
CJ = (MKL_INT*)mkl_malloc( Cval_size * sizeof( MKL_INT ), 64 );
Cval = (double*)mkl_malloc( Cval_size * sizeof( double ), 64 );
mkl_dcsrmultcsr(&transa, &request, &sort, &Am, &An, &An, Aval, AJ, AI, Bval, BJ, BI, Cval, CJ, CI, &nnzmax, &ierr);
printmm_one(Am, Cval, CJ, CI);//printf("Cnnz=%d\n", Cnnz);
printmm_one(Am, Cval, CJ, CI);
sort = 7; // do not sort anything
request = 2; // numeric multiplication
}//printf("Cnnz_mic: %d\n", Cnnz_host);exit(-1);
}
double time_mic_numeric_mm = 0.0;
#pragma offload target(mic:micdev) nocopy(request) nocopy(sort) nocopy(i) nocopy(ierr) nocopy(nnzmax) nocopy(transa) nocopy(Am) nocopy(An) nocopy(Bn) \
out(time_mic_numeric_mm) \
......@@ -305,13 +273,6 @@ void mkl_mic_spgemm(MKL_INT Am, MKL_INT An, MKL_INT Annz, double* Aval, MKL_INT*
nocopy(CJ: alloc_if(0) free_if(0)) \
nocopy(Cval: alloc_if(0) free_if(0))
{
//sort = 7
//request = 1; 2'ye gore sure iki katina cikiyor
//request = 0; 2'ye gore sure uc katina cikiyor
//request = 2
//sort = 3; 7'ye gore %30 daha yavas
//printf("sort:%d request:%d\n", sort, request); // prints sort:7 request:2
for(i = 0; i < 10; i++) {
mkl_dcsrmultcsr(&transa, &request, &sort, &Am, &An, &An, Aval, AJ, AI, Bval, BJ, BI, Cval, CJ, CI, &nnzmax, &ierr);
}
......@@ -321,7 +282,8 @@ void mkl_mic_spgemm(MKL_INT Am, MKL_INT An, MKL_INT Annz, double* Aval, MKL_INT*
}
time_mic_numeric_mm = (dsecnd() - s_initial) / nrepeat; // seconds
}
if (0) {
*time = time_mic_numeric_mm;
if (1) { // Copy result matrix from MIC to Host
int nelm_CI = Am + 2;
int nelm_CJ = Cnnz_host + 1;
int nelm_Cval = Cnnz_host + 1;
......@@ -340,7 +302,7 @@ void mkl_mic_spgemm(MKL_INT Am, MKL_INT An, MKL_INT Annz, double* Aval, MKL_INT*
for(i = 0; i < nelm_CI; i++) CI_host[i] = CI[i];
for(i = 0; i < nelm_CJ; i++) {CJ_host[i] = CJ[i]; Cval_host[i] = Cval[i];}
}
*pCval = Cval_host; *pCJ = CJ_host; *pCI = CI_host; //printf("Cnnz_host:%d\n", Cnnz_host);
*pCval = Cval_host; *pCJ = CJ_host; *pCI = CI_host;
}
} /* ENDOF mkl_mic_spmm }}}*/
......@@ -491,7 +453,7 @@ for(i=0;i<=Bm;i++)BI[i]--; for(i=0;i<Bnnz;i++)BJ[i]--;
printmm_one(Am, Cval, CJ, CI);
/** In order to write the output C matrix to file, uncomment the following line */
//printfilemm_one(strpathC, Am, Bn, Cval, CJ, CI);
printfilemm_one(strpathC, Am, Bn, Cval, CJ, CI);
/** run my SpGEMM routine in order to find number of multiply-and-add operations */
long nummult = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment