diff --git a/packages/shylu/shylu_node/basker/src/shylubasker_error_manager.hpp b/packages/shylu/shylu_node/basker/src/shylubasker_error_manager.hpp index 84cbb8b801b7..d9695c6e5c78 100644 --- a/packages/shylu/shylu_node/basker/src/shylubasker_error_manager.hpp +++ b/packages/shylu/shylu_node/basker/src/shylubasker_error_manager.hpp @@ -46,66 +46,66 @@ namespace BaskerNS for(Int ti = 0; ti < num_threads; ti++) { //Note: jdb we can make this into a switch - if(thread_array[ti].error_type == BASKER_ERROR_NOERROR) + if(thread_array(ti).error_type == BASKER_ERROR_NOERROR) { threads_start(ti) = BASKER_MAX_IDX; continue; - } else if(thread_array[ti].error_type == BASKER_ERROR_SINGULAR) + } else if(thread_array(ti).error_type == BASKER_ERROR_SINGULAR) { if(Options.verbose == BASKER_TRUE) { std::cout << "ERROR THREAD: " << ti - << " DOMBLK SINGULAR: blk=" << thread_array[ti].error_blk + << " DOMBLK SINGULAR: blk=" << thread_array(ti).error_blk << std::endl; } return BASKER_ERROR; - } else if(thread_array[ti].error_type == BASKER_ERROR_NOMALLOC) + } else if(thread_array(ti).error_type == BASKER_ERROR_NOMALLOC) { if(Options.verbose == BASKER_TRUE) { std::cout << "ERROR THREAD: " << ti - << " DOMBLK NOMALLOC : blk=" << thread_array[ti].error_blk + << " DOMBLK NOMALLOC : blk=" << thread_array(ti).error_blk << std::endl; } return BASKER_ERROR; - } else if(thread_array[ti].error_type == BASKER_ERROR_REMALLOC) + } else if(thread_array(ti).error_type == BASKER_ERROR_REMALLOC) { - BASKER_ASSERT(thread_array[ti].error_blk >= 0, "nfactor_dom_error error_blk"); + BASKER_ASSERT(thread_array(ti).error_blk >= 0, "nfactor_dom_error error_blk"); if(Options.verbose == BASKER_TRUE) { std::cout << " > THREAD: " << ti - << " DOMBLK MALLOC : blk=" << thread_array[ti].error_blk - << " subblk=" << thread_array[ti].error_subblk - << " newsize=" << thread_array[ti].error_info + << " DOMBLK MALLOC : blk=" << thread_array(ti).error_blk + << " subblk=" << thread_array(ti).error_subblk + << " newsize=" << thread_array(ti).error_info << std::endl; } //If on diagonal, want to compare L and U Int resize_L = BASKER_MAX_IDX; Int resize_U = BASKER_MAX_IDX; - if(thread_array[ti].error_subblk != BASKER_MAX_IDX) + if(thread_array(ti).error_subblk != BASKER_MAX_IDX) { - BASKER_ASSERT(thread_array[ti].error_info > 0, "L) newsize not big enough"); - resize_L = thread_array[ti].error_info; + BASKER_ASSERT(thread_array(ti).error_info > 0, "L) newsize not big enough"); + resize_L = thread_array(ti).error_info; //if L is already bigger and U, //We will want re size U as, well - if(thread_array[ti].error_subblk == 0) + if(thread_array(ti).error_subblk == 0) { - Int blkcol = thread_array[ti].error_blk; + Int blkcol = thread_array(ti).error_blk; Int blkUrow = LU_size(blkcol)-1; if(LL[blkcol][0].nnz >= LU[blkcol][blkUrow].nnz) { - resize_U = thread_array[ti].error_info; + resize_U = thread_array(ti).error_info; } }//if - a domain } //We don't care about the other way since, //L is already checked before U. - if(thread_array[ti].error_subblk == -1) + if(thread_array(ti).error_subblk == -1) { - resize_U = thread_array[ti].error_info; + resize_U = thread_array(ti).error_info; } //Resize L, if resize_L != -1 (meaning realloc-L is requested) @@ -116,7 +116,7 @@ namespace BaskerNS std::cout << " ++ resize L( tid = " << ti << " ): new size = " << resize_L << std::endl; } BASKER_MATRIX &L = - LL[thread_array[ti].error_blk][thread_array[ti].error_subblk]; + LL[thread_array(ti).error_blk][thread_array(ti).error_subblk]; REALLOC_INT_1DARRAY(L.row_idx, L.nnz, resize_L); @@ -142,7 +142,7 @@ namespace BaskerNS std::cout << " ++ resize U( tid = " << ti << " ): new size = " << resize_U << std::endl; } BASKER_MATRIX &U = - LU[thread_array[ti].error_blk][0]; + LU[thread_array(ti).error_blk][0]; REALLOC_INT_1DARRAY(U.row_idx, U.nnz, resize_U); @@ -153,7 +153,7 @@ namespace BaskerNS U.nnz = resize_U; //Still need to clear pend BASKER_MATRIX &L = - LL[thread_array[ti].error_blk][0]; + LL[thread_array(ti).error_blk][0]; L.clear_pend(); } @@ -163,11 +163,11 @@ namespace BaskerNS { //Clear workspace, whole column for(Int sb = 0; - sb < LL_size(thread_array[ti].error_blk); + sb < LL_size(thread_array(ti).error_blk); sb++) { BASKER_MATRIX &SL = - LL[thread_array[ti].error_blk][sb]; + LL[thread_array(ti).error_blk][sb]; for(Int i = 0; i < SL.iws_size*SL.iws_mult; ++i) { SL.iws(i) = (Int) 0; @@ -198,13 +198,13 @@ namespace BaskerNS }//for - sb (subblks) }//if ws is filled - threads_start(ti) = thread_array[ti].error_blk; + threads_start(ti) = thread_array(ti).error_blk; //Reset - thread_array[ti].error_type = BASKER_ERROR_NOERROR; - thread_array[ti].error_blk = BASKER_MAX_IDX; - thread_array[ti].error_info = BASKER_MAX_IDX; + thread_array(ti).error_type = BASKER_ERROR_NOERROR; + thread_array(ti).error_blk = BASKER_MAX_IDX; + thread_array(ti).error_info = BASKER_MAX_IDX; nthread_remalloc++; }//if REMALLOC @@ -231,26 +231,26 @@ namespace BaskerNS for(Int ti = 0; ti < num_threads; ti++) { //Note: jdb we can make this into a switch - if(thread_array[ti].error_type == BASKER_ERROR_NOERROR) + if(thread_array(ti).error_type == BASKER_ERROR_NOERROR) { thread_start(ti) = BASKER_MAX_IDX; continue; } - else if(thread_array[ti].error_type == BASKER_ERROR_SINGULAR) + else if(thread_array(ti).error_type == BASKER_ERROR_SINGULAR) { if(Options.verbose == BASKER_TRUE) { std::cout << "ERROR THREAD: " << ti - << " SEPBLK SINGULAR: blk=" << thread_array[ti].error_blk + << " SEPBLK SINGULAR: blk=" << thread_array(ti).error_blk << std::endl; } return BASKER_ERROR; - } else if(thread_array[ti].error_type == BASKER_ERROR_NOMALLOC) + } else if(thread_array(ti).error_type == BASKER_ERROR_NOMALLOC) { if(Options.verbose == BASKER_TRUE) { std::cout << "ERROR THREADS: " << ti - << " SEPBLK NOMALLOC: blk=" << thread_array[ti].error_blk + << " SEPBLK NOMALLOC: blk=" << thread_array(ti).error_blk << std::endl; } return BASKER_ERROR; @@ -260,22 +260,22 @@ namespace BaskerNS Int error_sep_lvl = BASKER_MAX_IDX; for(Int l = 1; l < tree.nlvls+1; l++) { - if(thread_array[ti].error_blk == S[l][ti]) + if(thread_array(ti).error_blk == S(l)(ti)) { error_sep_lvl = l; break; } } - if(thread_array[ti].error_type == BASKER_ERROR_REMALLOC) + if(thread_array(ti).error_type == BASKER_ERROR_REMALLOC) { - BASKER_ASSERT(thread_array[ti].error_blk >= 0, "nfactor_SEP_error error_blk"); + BASKER_ASSERT(thread_array(ti).error_blk >= 0, "nfactor_SEP_error error_blk"); if(Options.verbose == BASKER_TRUE) { std::cout << " > THREADS: " << ti - << " SEPBLK MALLOC: blk=" << thread_array[ti].error_blk - << " subblk=" << thread_array[ti].error_subblk - << " newsize=" << thread_array[ti].error_info + << " SEPBLK MALLOC: blk=" << thread_array(ti).error_blk + << " subblk=" << thread_array(ti).error_subblk + << " newsize=" << thread_array(ti).error_info << std::endl; std::cout << " > SEPLVL: " << error_sep_lvl << std::endl; } @@ -283,9 +283,9 @@ namespace BaskerNS //If on diagonal, want to compare L and U Int resize_L = BASKER_MAX_IDX; Int resize_U = BASKER_MAX_IDX; - if(thread_array[ti].error_subblk <= -1) + if(thread_array(ti).error_subblk <= -1) { - resize_L = thread_array[ti].error_info; + resize_L = thread_array(ti).error_info; if(Options.verbose == BASKER_TRUE) { std::cout << " ++ L size: " << resize_L << std::endl; @@ -293,9 +293,9 @@ namespace BaskerNS } //We don't care about the other way since, //L is already checked before U. - if(thread_array[ti].error_subblk > -1) + if(thread_array(ti).error_subblk > -1) { - resize_U = thread_array[ti].error_info; + resize_U = thread_array(ti).error_info; if(Options.verbose == BASKER_TRUE) { std::cout << " ++ U size: " << resize_U << std::endl; @@ -305,9 +305,9 @@ namespace BaskerNS //Resize L, if resize_L != -1 (meaning realloc-L is requested) if(resize_L != BASKER_MAX_IDX) { - const Int tsb = (-1*thread_array[ti].error_subblk)-1; + const Int tsb = (-1*thread_array(ti).error_subblk)-1; BASKER_MATRIX &L = - LL[thread_array[ti].error_blk][tsb]; + LL[thread_array(ti).error_blk][tsb]; REALLOC_INT_1DARRAY(L.row_idx, L.nnz, resize_L); @@ -322,9 +322,9 @@ namespace BaskerNS //Resize U, if resize_U != -1 (meaning realloc-U is requested) if(resize_U != BASKER_MAX_IDX) { - const Int tsb = thread_array[ti].error_subblk; + const Int tsb = thread_array(ti).error_subblk; BASKER_MATRIX &U = - LU[thread_array[ti].error_blk][tsb]; + LU[thread_array(ti).error_blk][tsb]; REALLOC_INT_1DARRAY(U.row_idx, U.nnz, resize_U); @@ -346,7 +346,7 @@ namespace BaskerNS //Though this could be done in parallel in the future for(Int p = 0; p < num_threads; p++) { - Int blk = S[0][p]; + Int blk = S(0)(p); //if(LL(blk)(0).w_fill == BASKER_TRUE) { //Clear workspace, whole column @@ -369,7 +369,7 @@ namespace BaskerNS Int scol_top = btf_tabs[btf_top_tabs_offset]; // the first column index of A for(Int p = 0; p < num_threads; p++) { - Int blk = S[error_sep_lvl][p]; + Int blk = S(error_sep_lvl)(p); //if(LL(blk)(0).w_fill == BASKER_TRUE) { BASKER_MATRIX &TM = LL[blk][0]; @@ -386,7 +386,7 @@ namespace BaskerNS //Note, will have to clear the perm in all sep blk in that level //Clear permuation BASKER_MATRIX &SL = - LL[thread_array[ti].error_blk][0]; + LL[thread_array(ti).error_blk][0]; //printf( " + scol_top = %d, srow = %d, nrowl = %d\n",scol_top,SL.srow,SL.nrow ); for(Int i = scol_top + SL.srow; i < scol_top + (SL.srow+SL.nrow); i++) { @@ -394,12 +394,12 @@ namespace BaskerNS gperm(i) = BASKER_MAX_IDX; }//for--to clear perm - thread_start(ti) = thread_array[ti].error_blk; + thread_start(ti) = thread_array(ti).error_blk; //Reset - thread_array[ti].error_type = BASKER_ERROR_NOERROR; - thread_array[ti].error_blk = BASKER_MAX_IDX; - thread_array[ti].error_info = BASKER_MAX_IDX; + thread_array(ti).error_type = BASKER_ERROR_NOERROR; + thread_array(ti).error_blk = BASKER_MAX_IDX; + thread_array(ti).error_info = BASKER_MAX_IDX; for(Int i = 0; i < num_threads; i++) { @@ -451,9 +451,9 @@ namespace BaskerNS Int btab = btf_tabs_offset; for(Int ti = 0; ti < num_threads; ti++) { - Int c = thread_array[ti].error_blk; + Int c = thread_array(ti).error_blk; //Note: jdb we can make this into a switch - if(thread_array[ti].error_type == BASKER_ERROR_NOERROR) + if(thread_array(ti).error_type == BASKER_ERROR_NOERROR) { if (c >= btab) { thread_start(ti) = BASKER_MAX_IDX; @@ -463,7 +463,7 @@ namespace BaskerNS continue; }//end if NOERROR - if(thread_array[ti].error_type == BASKER_ERROR_SINGULAR) + if(thread_array(ti).error_type == BASKER_ERROR_SINGULAR) { if(Options.verbose == BASKER_TRUE) { @@ -474,7 +474,7 @@ namespace BaskerNS return BASKER_ERROR; }//end if SINGULAR - if(thread_array[ti].error_type == BASKER_ERROR_NOMALLOC) + if(thread_array(ti).error_type == BASKER_ERROR_NOMALLOC) { std::cout << "ERROR_THREADS: " << ti << " DIAGBLK NOMALLOC blk=" << c @@ -482,16 +482,16 @@ namespace BaskerNS return BASKER_ERROR; }//end if NOMALLOC - if(thread_array[ti].error_type == BASKER_ERROR_REMALLOC) + if(thread_array(ti).error_type == BASKER_ERROR_REMALLOC) { - Int liwork = thread_array[ti].iws_size*thread_array[ti].iws_mult; - Int lework = thread_array[ti].ews_size*thread_array[ti].ews_mult; + Int liwork = thread_array(ti).iws_size*thread_array(ti).iws_mult; + Int lework = thread_array(ti).ews_size*thread_array(ti).ews_mult; BASKER_ASSERT(c >= 0, "nfactor_diag_error error_blk"); if(Options.verbose == BASKER_TRUE) { std::cout << " > THREADS: " << ti << " DIAGBLK MALLOC blk=" << c - << " newsize=" << thread_array[ti].error_info + << " newsize=" << thread_array(ti).error_info << " for both L( " << c << " ) and U( " << c << " )" << std::endl; @@ -504,11 +504,11 @@ namespace BaskerNS for(Int i = 0; i < liwork; i++) { - thread_array[ti].iws(i) = (Int) 0; + thread_array(ti).iws(i) = (Int) 0; } for(Int i = 0; i < lework; i++) { - thread_array[ti].ews(i) = zero; + thread_array(ti).ews(i) = zero; } //Resize L @@ -516,12 +516,12 @@ namespace BaskerNS L.clear_pend(); REALLOC_INT_1DARRAY(L.row_idx, L.nnz, - thread_array[ti].error_info); + thread_array(ti).error_info); REALLOC_ENTRY_1DARRAY(L.val, L.nnz, - thread_array[ti].error_info); - L.mnnz = thread_array[ti].error_info; - L.nnz = thread_array[ti].error_info; + thread_array(ti).error_info); + L.mnnz = thread_array(ti).error_info; + L.nnz = thread_array(ti).error_info; for(Int i = 0; i < L.ncol; i++) { L.col_ptr(i) = 0; @@ -536,12 +536,12 @@ namespace BaskerNS BASKER_MATRIX &U = (c >= btab ? UBTF[c-btab] : U_D[c]); REALLOC_INT_1DARRAY(U.row_idx, U.nnz, - thread_array[ti].error_info); + thread_array(ti).error_info); REALLOC_ENTRY_1DARRAY(U.val, U.nnz, - thread_array[ti].error_info); - U.mnnz = thread_array[ti].error_info; - U.nnz = thread_array[ti].error_info; + thread_array(ti).error_info); + U.mnnz = thread_array(ti).error_info; + U.nnz = thread_array(ti).error_info; for(Int i = 0; i < U.ncol; i++) { U.col_ptr(i) = 0; @@ -561,9 +561,9 @@ namespace BaskerNS } //Reset - thread_array[ti].error_type = BASKER_ERROR_NOERROR; - thread_array[ti].error_blk = BASKER_MAX_IDX; - thread_array[ti].error_info = BASKER_MAX_IDX; + thread_array(ti).error_type = BASKER_ERROR_NOERROR; + thread_array(ti).error_blk = BASKER_MAX_IDX; + thread_array(ti).error_info = BASKER_MAX_IDX; nthread_remalloc++; @@ -593,7 +593,7 @@ namespace BaskerNS { for(Int ti = 0; ti < num_threads; ti++) { - thread_array[ti].error_type = BASKER_ERROR_NOERROR; + thread_array(ti).error_type = BASKER_ERROR_NOERROR; } } diff --git a/packages/shylu/shylu_node/basker/src/shylubasker_nfactor_blk.hpp b/packages/shylu/shylu_node/basker/src/shylubasker_nfactor_blk.hpp index 6613d992dbc2..030d526299a1 100644 --- a/packages/shylu/shylu_node/basker/src/shylubasker_nfactor_blk.hpp +++ b/packages/shylu/shylu_node/basker/src/shylubasker_nfactor_blk.hpp @@ -149,7 +149,7 @@ namespace BaskerNS const Mag normA = BTF_A.gnorm; const Mag normA_blk = BTF_A.anorm; - Int b = S[0][kid]; //Which blk from schedule + Int b = S(0)(kid); //Which blk from schedule BASKER_MATRIX &L = LL[b][0]; BASKER_MATRIX &U = LU[b][LU_size(b)-1]; BASKER_MATRIX &M = ALM[b][0]; //A->blk @@ -159,9 +159,9 @@ namespace BaskerNS ENTRY_1DARRAY X = LL[b][0].ews; Int ws_size = LL[b][0].iws_size; #else //else if BASKER_2DL - INT_1DARRAY ws = thread_array[kid].iws; - ENTRY_1DARRAY X = thread_array[kid].ews; - Int ws_size = thread_array[kid].iws_size; + INT_1DARRAY ws = thread_array(kid).iws; + ENTRY_1DARRAY X = thread_array(kid).ews; + Int ws_size = thread_array(kid).iws_size; #endif //Int bcol = L.scol; //begining col //NOT UD Int scol_top = btf_tabs[btf_top_tabs_offset]; // the first column index of A @@ -577,11 +577,11 @@ namespace BaskerNS } } if (!explicit_pivot) { - thread_array[kid].error_type = + thread_array(kid).error_type = BASKER_ERROR_SINGULAR; - thread_array[kid].error_blk = b; - thread_array[kid].error_subblk = 0; - thread_array[kid].error_info = k; + thread_array(kid).error_blk = b; + thread_array(kid).error_subblk = 0; + thread_array(kid).error_info = k; return BASKER_ERROR; } } @@ -676,17 +676,17 @@ namespace BaskerNS (int)kid, (long)b, (long)llnnz, (long)lnnz, (long)lcnt, (int)lnnz, (int)M.nrow, (long)newsize); } - thread_array[kid].error_blk = b; - thread_array[kid].error_subblk = 0; + thread_array(kid).error_blk = b; + thread_array(kid).error_subblk = 0; if(Options.realloc == BASKER_FALSE) { - thread_array[kid].error_type = BASKER_ERROR_NOMALLOC; + thread_array(kid).error_type = BASKER_ERROR_NOMALLOC; return BASKER_ERROR; } else { - thread_array[kid].error_type = BASKER_ERROR_REMALLOC; - thread_array[kid].error_info = newsize; + thread_array(kid).error_type = BASKER_ERROR_REMALLOC; + thread_array(kid).error_info = newsize; return BASKER_ERROR; } @@ -701,17 +701,17 @@ namespace BaskerNS (int)kid, (long)b, (long)uunnz, (long)unnz+ucnt, (long)k, (int)uunnz, (int)M.nrow, (int)newsize); } - thread_array[kid].error_blk = b; - thread_array[kid].error_subblk = -1; + thread_array(kid).error_blk = b; + thread_array(kid).error_subblk = -1; if(Options.realloc == BASKER_FALSE) { - thread_array[kid].error_type = BASKER_ERROR_NOMALLOC; + thread_array(kid).error_type = BASKER_ERROR_NOMALLOC; return BASKER_ERROR; } else { - thread_array[kid].error_type = BASKER_ERROR_REMALLOC; - thread_array[kid].error_info = newsize; + thread_array(kid).error_type = BASKER_ERROR_REMALLOC; + thread_array(kid).error_info = newsize; return BASKER_ERROR; } @@ -981,7 +981,7 @@ namespace BaskerNS ) { //Setup variables - const Int wsb = S[0][kid]; + const Int wsb = S(0)(kid); INT_1DARRAY ws = LL[wsb][l].iws; const Int ws_size = LL[wsb][l].iws_size; @@ -1011,11 +1011,11 @@ namespace BaskerNS ) { const Int scol_top = btf_tabs[btf_top_tabs_offset]; // the first column index of A - const Int b = S[lvl][kid]; + const Int b = S(lvl)(kid); //const Int wsb = S(0)(kid); BASKER_MATRIX &L = LL[b][0]; - const Int U_col = S[lvl][kid]; + const Int U_col = S(lvl)(kid); Int U_row = LU_size(U_col)-1; if(lvl > 0) { @@ -1128,8 +1128,8 @@ namespace BaskerNS { //Setup variables - const Int b = S[lvl][kid]; - const Int wsb = S[0][kid]; + const Int b = S(lvl)(kid); + const Int wsb = S(0)(kid); BASKER_MATRIX &L = LL[b][0]; const Int scol_top = btf_tabs[btf_top_tabs_offset]; // the first column index of A const Int brow_g = L.srow + scol_top; // global offset @@ -1279,15 +1279,15 @@ namespace BaskerNS { //Setup variables - const Int b = S[lvl][kid]; - const Int wsb = S[0][kid]; + const Int b = S(lvl)(kid); + const Int wsb = S(0)(kid); BASKER_MATRIX &L = LL[b][0]; #ifdef BASKER_2DL INT_1DARRAY ws = LL[wsb][l].iws; const Int ws_size = LL[wsb][l].iws_size; #else - INT_1DARRAY ws = thread_array[kid].iws; - Int ws_size = thread_array[kid].iws_size; + INT_1DARRAY ws = thread_array(kid).iws; + Int ws_size = thread_array(kid).iws_size; #endif const Int scol_top = btf_tabs[btf_top_tabs_offset]; // the first column index of A @@ -1452,17 +1452,17 @@ namespace BaskerNS Int k, Int top, Int xnnz) { - const Int b = S[lvl][kid]; - const Int wsb = S[0][kid]; + const Int b = S(lvl)(kid); + const Int wsb = S(0)(kid); BASKER_MATRIX &L = LL[b][0]; #ifdef BASKER_2DL INT_1DARRAY ws = LL[wsb][l].iws; ENTRY_1DARRAY X = LL[wsb][l].ews; Int ws_size = LL[wsb][l].iws_size; #else - INT_1DARRAY ws = thread_array[kid].iws; - ENTRY_1DARRAY X = thread_array[kid].ews; - Int ws_size = thread_array[kid].iws_size; + INT_1DARRAY ws = thread_array(kid).iws; + ENTRY_1DARRAY X = thread_array(kid).ews; + Int ws_size = thread_array(kid).iws_size; #endif const Entry zero (0.0); @@ -1658,17 +1658,17 @@ namespace BaskerNS (long)blkcol, (long)blkrow, (long)kid, (long)llnnz, (long)lnnz, (long)p_size ); } - thread_array[kid].error_blk = blkcol; - thread_array[kid].error_subblk = blkrow; + thread_array(kid).error_blk = blkcol; + thread_array(kid).error_subblk = blkrow; if(Options.realloc == BASKER_FALSE) { - thread_array[kid].error_type = BASKER_ERROR_NOMALLOC; + thread_array(kid).error_type = BASKER_ERROR_NOMALLOC; return BASKER_ERROR; } else { - thread_array[kid].error_type = BASKER_ERROR_REMALLOC; - thread_array[kid].error_info = newsize; + thread_array(kid).error_type = BASKER_ERROR_REMALLOC; + thread_array(kid).error_info = newsize; return BASKER_ERROR; } //BASKER_ASSERT(0==1, "REALLOC LOWER BLOCK\n"); diff --git a/packages/shylu/shylu_node/basker/src/shylubasker_nfactor_blk_inc.hpp b/packages/shylu/shylu_node/basker/src/shylubasker_nfactor_blk_inc.hpp index 48dae30f95c9..cf6fd8b3c0d9 100644 --- a/packages/shylu/shylu_node/basker/src/shylubasker_nfactor_blk_inc.hpp +++ b/packages/shylu/shylu_node/basker/src/shylubasker_nfactor_blk_inc.hpp @@ -130,14 +130,14 @@ namespace BaskerNS BASKER_INLINE int Basker::t_nfactor_blk_inc_lvl(Int kid) { - Int b = S[0][kid]; //Which blk from schedule - BASKER_MATRIX &L = LL[b][0]; - BASKER_MATRIX &U = LU[b][LU_size(b)-1]; - BASKER_MATRIX &M = ALM[b][0]; //A->blk + Int b = S(0)(kid); //Which blk from schedule + BASKER_MATRIX &L = LL(b)(0); + BASKER_MATRIX &U = LU(b)(LU_size(b)-1); + BASKER_MATRIX &M = ALM(b)(0); //A->blk - INT_1DARRAY ws = LL[b][0].iws; - ENTRY_1DARRAY X = LL[b][0].ews; - Int ws_size = LL[b][0].iws_size; + INT_1DARRAY ws = LL(b)(0).iws; + ENTRY_1DARRAY X = LL(b)(0).ews; + Int ws_size = LL(b)(0).iws_size; Int brow = L.srow; //begining row Int lval = 0; @@ -384,10 +384,10 @@ namespace BaskerNS << pivot << endl; cout << "lcnt: " << lcnt << endl; } - thread_array[kid].error_type = + thread_array(kid).error_type = BASKER_ERROR_SINGULAR; - thread_array[kid].error_blk = b; - thread_array[kid].error_info = k; + thread_array(kid).error_blk = b; + thread_array(kid).error_info = k; return BASKER_ERROR; } @@ -410,17 +410,17 @@ namespace BaskerNS if(Options.realloc == BASKER_FALSE) { - thread_array[kid].error_type = + thread_array(kid).error_type = BASKER_ERROR_NOMALLOC; return BASKER_ERROR; } else { - thread_array[kid].error_type = + thread_array(kid).error_type = BASKER_ERROR_REMALLOC; - thread_array[kid].error_blk = b; - thread_array[kid].error_subblk = 0; - thread_array[kid].error_info = newsize; + thread_array(kid).error_blk = b; + thread_array(kid).error_subblk = 0; + thread_array(kid).error_info = newsize; return BASKER_ERROR; } @@ -441,17 +441,17 @@ namespace BaskerNS if(Options.realloc == BASKER_FALSE) { - thread_array[kid].error_type = + thread_array(kid).error_type = BASKER_ERROR_NOMALLOC; return BASKER_ERROR; } else { - thread_array[kid].error_type = + thread_array(kid).error_type = BASKER_ERROR_REMALLOC; - thread_array[kid].error_blk = b; - thread_array[kid].error_subblk = -1; - thread_array[kid].error_info = newsize; + thread_array(kid).error_blk = b; + thread_array(kid).error_subblk = -1; + thread_array(kid).error_info = newsize; return BASKER_ERROR; } @@ -665,9 +665,9 @@ namespace BaskerNS { //Setup variables - const Int b = S[lvl][kid]; - const Int wsb = S[0][kid]; - BASKER_MATRIX &L = LL[b][0]; + const Int b = S(lvl)(kid); + const Int wsb = S(0)(kid); + BASKER_MATRIX &L = LL(b)(0); const Int brow = L.srow; INT_1DARRAY ws = LL[wsb][l].iws; @@ -936,12 +936,12 @@ namespace BaskerNS ) { //Setup variables - const Int b = S[lvl][kid]; - const Int wsb = S[0][kid]; - BASKER_MATRIX &L = LL[b][0]; + const Int b = S(lvl)(kid); + const Int wsb = S(0)(kid); + BASKER_MATRIX &L = LL(b)(0); - INT_1DARRAY ws = LL[wsb][l].iws; - const Int ws_size = LL[wsb][l].iws_size; + INT_1DARRAY ws = LL(wsb)(l).iws; + const Int ws_size = LL(wsb)(l).iws_size; Int *color = &(ws(0)); Int *pattern = &(ws(ws_size)); @@ -985,9 +985,9 @@ namespace BaskerNS //Will want to make this backward in the future //Setup variables - const Int b = S[lvl][kid]; - const Int wsb = S[0][kid]; - BASKER_MATRIX &L = LL[b][0]; + const Int b = S(lvl)(kid); + const Int wsb = S(0)(kid); + BASKER_MATRIX &L = LL(b)(0); const Int brow = L.srow; INT_1DARRAY ws = LL[wsb][l].iws; @@ -1353,12 +1353,12 @@ namespace BaskerNS //We note that this can be fixed to be faster - const Int b = S[lvl][kid]; - const Int wsb = S[0][kid]; - BASKER_MATRIX &L = LL[b][0]; - INT_1DARRAY ws = LL[wsb][l].iws; - ENTRY_1DARRAY X = LL[wsb][l].ews; - const Int ws_size = LL[wsb][l].iws_size; + const Int b = S(lvl)(kid); + const Int wsb = S(0)(kid); + BASKER_MATRIX &L = LL(b)(0); + INT_1DARRAY ws = LL(wsb)(l).iws; + ENTRY_1DARRAY X = LL(wsb)(l).ews; + const Int ws_size = LL(wsb)(l).iws_size; Int brow = L.srow; @@ -1441,12 +1441,12 @@ namespace BaskerNS { //We note that this can be fixed to be faster - const Int b = S[lvl][kid]; - const Int wsb = S[0][kid]; - BASKER_MATRIX &L = LL[b][0]; - INT_1DARRAY ws = LL[wsb][l].iws; - ENTRY_1DARRAY X = LL[wsb][l].ews; - const Int ws_size = LL[wsb][l].iws_size; + const Int b = S(lvl)(kid); + const Int wsb = S(0)(kid); + BASKER_MATRIX &L = LL(b)(0); + INT_1DARRAY ws = LL(wsb)(l).iws; + ENTRY_1DARRAY X = LL(wsb)(l).ews; + const Int ws_size = LL(wsb)(l).iws_size; Int brow = L.srow; Int *color = &(ws(0)); @@ -2105,18 +2105,18 @@ namespace BaskerNS if(Options.realloc == BASKER_FALSE) { - thread_array[kid].error_type = + thread_array(kid).error_type = BASKER_ERROR_NOMALLOC; return BASKER_ERROR; } else { - thread_array[kid].error_type = + thread_array(kid).error_type = BASKER_ERROR_REMALLOC; - thread_array[kid].error_blk = blkcol; - thread_array[kid].error_subblk = blkrow; - thread_array[kid].error_info = newsize; + thread_array(kid).error_blk = blkcol; + thread_array(kid).error_subblk = blkrow; + thread_array(kid).error_info = newsize; return BASKER_ERROR; } @@ -2176,18 +2176,18 @@ namespace BaskerNS BASKER_INLINE int Basker::t_nfactor_blk_old(Int kid) { - Int b = S[0][kid]; //Which blk from schedule - BASKER_MATRIX &L = LL[b][0]; - BASKER_MATRIX &U = LU[b][LU_size[b]-1]; + Int b = S(0)(kid); //Which blk from schedule + BASKER_MATRIX &L = LL(b)(0); + BASKER_MATRIX &U = LU(b)(LU_size[b]-1); #ifdef BASKER_2DL printf("Accessing blk: %d \n", b); - INT_1DARRAY ws = LL[b][0].iws; - ENTRY_1DARRAY X = LL[b][0].ews; - Int ws_size = LL[b][0].iws_size; + INT_1DARRAY ws = LL(b)(0).iws; + ENTRY_1DARRAY X = LL(b)(0).ews; + Int ws_size = LL(b)(0).iws_size; #else //else if BASKER_2DL - INT_1DARRAY ws = thread_array[kid].iws; - ENTRY_1DARRAY X = thread_array[kid].ews; - Int ws_size = thread_array[kid].iws_size; + INT_1DARRAY ws = thread_array(kid).iws; + ENTRY_1DARRAY X = thread_array(kid).ews; + Int ws_size = thread_array(kid).iws_size; #endif Int bcol = L.scol; //begining col @@ -2576,15 +2576,15 @@ namespace BaskerNS { //Setup variables - const Int b = S[lvl][kid]; - const Int wsb = S[0][kid]; - BASKER_MATRIX &L = LL[b][0]; + const Int b = S(lvl)(kid); + const Int wsb = S(0)(kid); + BASKER_MATRIX &L = LL(b)(0); #ifdef BASKER_2DL - INT_1DARRAY ws = LL[wsb][l].iws; - Int ws_size = LL[wsb][l].iws_size; + INT_1DARRAY ws = LL(wsb)(l).iws; + Int ws_size = LL(wsb)(l).iws_size; #else - INT_1DARRAY ws = thread_array[kid].iws; - Int ws_size = thread_array[kid].iws_size; + INT_1DARRAY ws = thread_array(kid).iws; + Int ws_size = thread_array(kid).iws_size; #endif const Int brow = L.srow; @@ -2729,8 +2729,8 @@ namespace BaskerNS BASKER_BOOL A_option ) { - BASKER_MATRIX &L = LL[blkcol][blkrow]; - BASKER_MATRIX &B = ALM[blkcol][blkrow]; + BASKER_MATRIX &L = LL(blkcol)(blkrow); + BASKER_MATRIX &B = ALM[blkcol][blkrow]; /* @@ -2750,17 +2750,16 @@ namespace BaskerNS BASKER_MATRIX *LPP = &LU[LP_col][0]; if(LP_row != BASKER_MAX_IDX) { - LPP = &(LL[LP_col][LP_row]); + LPP = &(LL(LP_col)(LP_row)); } BASKER_MATRIX &LP = *(LPP); - INT_1DARRAY ws = LL[X_col][X_row].iws; - ENTRY_1DARRAY X = LL[X_col][X_row].ews; - Int ws_size = LL[X_col][X_row].iws_size; - - Int nnz = LL[X_col][X_row].p_size; + INT_1DARRAY ws = LL(X_col)(X_row).iws; + ENTRY_1DARRAY X = LL(X_col)(X_row).ews; + Int ws_size = LL(X_col)(X_row).iws_size; + Int nnz = LL(X_col)(X_row).p_size; @@ -2948,7 +2947,7 @@ namespace BaskerNS }//over all nonzero in left - LL[X_col][X_row].p_size = nnz; + LL(X_col)(X_row).p_size = nnz; return; @@ -2969,7 +2968,7 @@ namespace BaskerNS Int x_size, Int x_offset, BASKER_BOOL A_option) { - BASKER_MATRIX &L = LL[blkcol][blkrow]; + BASKER_MATRIX &L = LL(blkcol)(blkrow); BASKER_MATRIX &B = ALM[blkcol][blkrow]; INT_1DARRAY ws = LL[X_col][X_row].iws; @@ -3840,9 +3839,9 @@ namespace BaskerNS ) { - const Int my_idx = S[0][kid]; + const Int my_idx = S(0)(kid); const Int team_leader = find_leader(kid,sl); - const Int leader_idx = S[0][team_leader]; + const Int leader_idx = S(0)(team_leader); //Int loop_col_idx = S(l)(kid); //printf("Reduce col fill called, kid: %d leader: %d \n", @@ -3941,12 +3940,12 @@ namespace BaskerNS //printf("===========T ADD ORIG FILL CALLED\n"); const Int leader_id = find_leader(kid, l); const Int lteam_size = pow(2,l+1); - const Int L_col = S[lvl][leader_id]; + const Int L_col = S(lvl)(leader_id); Int L_row = 0; //const Int U_col = S(lvl)(leader_id); //Int U_row = LU_size(U_col)-1; //Int X_col = S(0)(leader_id); - Int X_col = S[0][kid]; + Int X_col = S(0)(kid); Int X_row = l+1; @@ -3977,7 +3976,7 @@ namespace BaskerNS //Int L_row = 0; //const Int U_col = S(lvl)(leader_id); //Int U_row = LU_size(U_col)-1; - Int X_col = S[0][leader_id]; + Int X_col = S(0)(leader_id); Int X_row = l+1; //printf("=***== fill MY ID: %d LEADER ID: %d ===** \n", @@ -3987,7 +3986,7 @@ namespace BaskerNS { Int bl = l+1; - Int A_col = S[lvl][kid]; + Int A_col = S(lvl)(kid); /* printf("leader_id: %d kid: %d lvl: %d l: %d blk: %d %d \n", @@ -3996,16 +3995,16 @@ namespace BaskerNS */ Int my_row_leader = find_leader(kid, lvl-1); Int my_new_row = - S[bl][kid] - S[0][my_row_leader]; + S(bl)(kid) - S(0)(my_row_leader); - Int A_row = (lvl==l)?(2):S[bl][kid]%(LU_size(A_col)); - if((S[bl](kid)>14) && - (S[bl](kid)>LU_size(A_col)) && + Int A_row = (lvl==l)?(2):S(bl)(kid)%(LU_size(A_col)); + if((S(bl)(kid)>14) && + (S(bl)(kid)>LU_size(A_col)) && (lvl != 1)) { - Int tm = (S[bl][kid]+1)/16; - A_row = ((S[bl][kid]+1)-(tm*16))%LU_size(A_col); + Int tm = (S(bl)(kid)+1)/16; + A_row = ((S(bl)(kid)+1)-(tm*16))%LU_size(A_col); } /* diff --git a/packages/shylu/shylu_node/basker/src/shylubasker_nfactor_col.hpp b/packages/shylu/shylu_node/basker/src/shylubasker_nfactor_col.hpp index 9c77c1f38994..68246464f757 100644 --- a/packages/shylu/shylu_node/basker/src/shylubasker_nfactor_col.hpp +++ b/packages/shylu/shylu_node/basker/src/shylubasker_nfactor_col.hpp @@ -134,7 +134,7 @@ namespace BaskerNS double barrier_time = 0; #endif - Int U_col = S[lvl][kid]; + Int U_col = S(lvl)(kid); Int U_row = 0; const Int scol = LU[U_col][U_row].scol; @@ -435,8 +435,8 @@ namespace BaskerNS for(Int l = 0; l < lvl; l++) { printf("OPS. KID : %d LVL: %d OPS : %d \n", - kid, l, thread_array[kid].ops_counts[l][0]); - thread_array[kid].ops_count[1][0] = 0; + kid, l, thread_array(kid).ops_counts[l][0]); + thread_array(kid).ops_count[1][0] = 0; } #endif @@ -460,15 +460,15 @@ namespace BaskerNS const Entry zero (0.0); //Get needed variables - const Int L_col = S[l][kid]; - const Int U_col = S[lvl][kid]; + const Int L_col = S(l)(kid); + const Int U_col = S(lvl)(kid); - Int my_row_leader = S[0][find_leader(kid,lvl-1)]; + Int my_row_leader = S(0)(find_leader(kid,lvl-1)); //Int my_new_row = // L_col - my_row_leader; Int U_row = L_col - my_row_leader; - const Int X_col = S[0][kid]; + const Int X_col = S(0)(kid); const Int X_row = l; //X_row = lower(L) //const Int col_idx_offset = 0; //we might be able to remove @@ -493,7 +493,7 @@ namespace BaskerNS } else { - Bp = &(thread_array[kid].C); + Bp = &(thread_array(kid).C); //printf("Using temp matrix, kid: %d\n", kid); //Bp->print(); } @@ -613,7 +613,7 @@ namespace BaskerNS //Count ops to show imbalance #ifdef BASKER_COUNT_OPS - thread_array[kid].ops_counts[0][l] += xnnz; + thread_array(kid).ops_counts[0][l] += xnnz; #endif //WE SHOUD DO A UNNZ COUNT @@ -649,17 +649,17 @@ namespace BaskerNS Int newsize = (unnz+U.nrow) * 1.2 ; - thread_array[kid].error_blk = U_col; - thread_array[kid].error_subblk = U_row; + thread_array(kid).error_blk = U_col; + thread_array(kid).error_subblk = U_row; if(Options.realloc == BASKER_FALSE) { - thread_array[kid].error_type = BASKER_ERROR_NOMALLOC; + thread_array(kid).error_type = BASKER_ERROR_NOMALLOC; return BASKER_ERROR; } else { - thread_array[kid].error_type = BASKER_ERROR_REMALLOC; - thread_array[kid].error_info = newsize; + thread_array(kid).error_type = BASKER_ERROR_REMALLOC; + thread_array(kid).error_info = newsize; return BASKER_ERROR; }//if/else realloc } @@ -741,10 +741,10 @@ namespace BaskerNS std::cout << "----Error--- kid = " << kid << ": extra L[" << j << "]=" << X[j] << " with gperm( " << brow_g << " + " << j << " ) = " << t << std::endl; - thread_array[kid].error_type = BASKER_ERROR_OTHER; - thread_array[kid].error_blk = lvl; - thread_array[kid].error_subblk = l; - thread_array[kid].error_info = k; + thread_array(kid).error_type = BASKER_ERROR_OTHER; + thread_array(kid).error_blk = lvl; + thread_array(kid).error_subblk = l; + thread_array(kid).error_info = k; info = BASKER_ERROR; //BASKER_ASSERT(t != BASKER_MAX_IDX, "lower entry in U"); #endif @@ -864,11 +864,11 @@ namespace BaskerNS int lteam_size = pow(2, l); #ifdef BASKER_2DL - Int L_col = S[l][my_leader]; + Int L_col = S(l)(my_leader); Int L_row = 0; - Int U_col = S[lvl][kid]; - Int U_row = (lvl==1)?(kid%2):S[l][kid]%LU_size(U_col); - Int X_col = S[0][my_leader]; + Int U_col = S(lvl)(kid); + Int U_row = (lvl==1)?(kid%2):S(l)(kid)%LU_size(U_col); + Int X_col = S(0)(my_leader); Int X_row = l; //this will change for us Int col_idx_offset = 0; BASKER_MATRIX &U = LU[U_col][U_row]; @@ -959,12 +959,12 @@ namespace BaskerNS ) { - Int b = S[l][kid]; + Int b = S(l)(kid); BASKER_MATRIX &L = LL[b][0]; - INT_1DARRAY ws = thread_array[kid].iws; - ENTRY_1DARRAY X = thread_array[team_leader].ews; - Int ws_size = thread_array[kid].iws_size; - Int ews_size = thread_array[team_leader].ews_size; + INT_1DARRAY ws = thread_array(kid).iws; + ENTRY_1DARRAY X = thread_array(team_leader).ews; + Int ws_size = thread_array(kid).iws_size; + Int ews_size = thread_array(team_leader).ews_size; #ifdef BASKER_DEBUG_NFACTOR_COL if(kid>3) @@ -1066,11 +1066,11 @@ namespace BaskerNS const Mag normA_blk = BTF_A.anorm; //Get needed variables - const Int L_col = S[lvl][kid]; + const Int L_col = S(lvl)(kid); const Int L_row = 0; - const Int U_col = S[lvl][kid]; + const Int U_col = S(lvl)(kid); const Int U_row = LU_size(U_col)-1; - const Int X_col = S[0][kid]; + const Int X_col = S(0)(kid); //Int col_idx_offset = 0; //can we get rid of now? #ifdef BASKER_DEBUG_NFACTOR_COL @@ -1083,7 +1083,7 @@ namespace BaskerNS BASKER_MATRIX &L = LL[L_col][L_row]; BASKER_MATRIX &U = LU[U_col][U_row]; - BASKER_MATRIX &B = thread_array[kid].C; + BASKER_MATRIX &B = thread_array(kid).C; #ifdef BASKER_DEBUG_NFACTOR_COL if(kid >= 0) @@ -1237,7 +1237,7 @@ namespace BaskerNS #endif #ifdef BASKER_OPS_COUNT - thread_array[kid].ops_counts[0][l] += xnnz; + thread_array(kid).ops_counts[0][l] += xnnz; #endif t_back_solve(kid, lvl,l+1, k, top, xnnz); // note: l not lvl given @@ -1327,10 +1327,10 @@ namespace BaskerNS X(maxindex) = pivot; } else { // replace-tiny-pivot not requested, or the current column is structurally empty after elimination - thread_array[kid].error_type = BASKER_ERROR_SINGULAR; - thread_array[kid].error_blk = L_col; - thread_array[kid].error_subblk = -1; - thread_array[kid].error_info = k; + thread_array(kid).error_type = BASKER_ERROR_SINGULAR; + thread_array(kid).error_blk = L_col; + thread_array(kid).error_subblk = -1; + thread_array(kid).error_info = k; return BASKER_ERROR; } } else if (Options.replace_tiny_pivot && normA_blk > abs(zero) && abs(pivot) < normA_blk * sqrt(eps)) { @@ -1374,17 +1374,17 @@ namespace BaskerNS //cout << " > L_col = " << L_col << " L_row = " << L_row << endl; } - thread_array[kid].error_blk = L_col; - thread_array[kid].error_subblk = -1; + thread_array(kid).error_blk = L_col; + thread_array(kid).error_subblk = -1; if(Options.realloc == BASKER_FALSE) { - thread_array[kid].error_type = BASKER_ERROR_NOMALLOC; + thread_array(kid).error_type = BASKER_ERROR_NOMALLOC; return BASKER_ERROR; } else { - thread_array[kid].error_type = BASKER_ERROR_REMALLOC; - thread_array[kid].error_info = newsize; + thread_array(kid).error_type = BASKER_ERROR_REMALLOC; + thread_array(kid).error_info = newsize; return BASKER_ERROR; } } @@ -1399,17 +1399,17 @@ namespace BaskerNS << endl; } - thread_array[kid].error_blk = U_col; - thread_array[kid].error_subblk = U_row; + thread_array(kid).error_blk = U_col; + thread_array(kid).error_subblk = U_row; if(Options.realloc == BASKER_FALSE) { - thread_array[kid].error_type = BASKER_ERROR_NOMALLOC; + thread_array(kid).error_type = BASKER_ERROR_NOMALLOC; return BASKER_ERROR; } else { - thread_array[kid].error_type = BASKER_ERROR_REMALLOC; - thread_array[kid].error_info = newsize; + thread_array(kid).error_type = BASKER_ERROR_REMALLOC; + thread_array(kid).error_info = newsize; return BASKER_ERROR; } } @@ -1640,11 +1640,11 @@ namespace BaskerNS const Int leader_id = find_leader(kid, l); const Int lteam_size = pow(2,l+1); - const Int L_col = S[lvl][leader_id]; + const Int L_col = S(lvl)(leader_id); Int L_row = 0; - const Int U_col = S[lvl][leader_id]; + const Int U_col = S(lvl)(leader_id); Int U_row = LU_size(U_col)-1; - Int X_col = S[0][leader_id]; + Int X_col = S(0)(leader_id); Int X_row = l+1; Int col_idx_offset = 0; //can get rid of? @@ -1743,15 +1743,15 @@ namespace BaskerNS //Setup - Int A_col = S[lvl][kid]; - Int A_row = (lvl==1)?(2):S[l+1][kid]%(LU_size(A_col)); + Int A_col = S(lvl)(kid); + Int A_row = (lvl==1)?(2):S(l+1)(kid)%(LU_size(A_col)); BASKER_MATRIX &B = AVM[A_col][A_col]; - const Int my_idx = S[0][kid]; + const Int my_idx = S(0)(kid); team_leader = find_leader(kid, l); - const Int leader_idx = S[0][team_leader]; - Int loop_col_idx = S[l][kid]; + const Int leader_idx = S(0)(team_leader); + Int loop_col_idx = S(l)(kid); #ifdef BASKER_DEBUG_NFACTOR_COL printf("Called t_blk_col_copy_atomic kid: %d " , kid); @@ -1909,15 +1909,15 @@ namespace BaskerNS //Setup - Int A_col = S[lvl][kid]; - Int A_row = (lvl==1)?(2):S[l+1][kid]%(LU_size(A_col)); + Int A_col = S(lvl)(kid); + Int A_row = (lvl==1)?(2):S(l+1)(kid)%(LU_size(A_col)); BASKER_MATRIX &B = AVM[A_col][A_col]; - const Int my_idx = S[0][kid]; + const Int my_idx = S(0)(kid); team_leader = find_leader(kid, l); - const Int leader_idx = S[0][team_leader]; - Int loop_col_idx = S[l][kid]; + const Int leader_idx = S(0)(team_leader); + Int loop_col_idx = S(l)(kid); #ifdef BASKER_DEBUG_NFACTOR_COL printf("Called t_blk_col_copy_atomic kid: %d " , kid); @@ -2073,8 +2073,8 @@ namespace BaskerNS //printf("-----------------copy_update_matrx----------"); //printf("\n\n\n\n"); - Int leader_idx = S[0][kid]; - BASKER_MATRIX &C = thread_array[kid].C; + Int leader_idx = S(0)(kid); + BASKER_MATRIX &C = thread_array(kid).C; Int nnz = 0; //COME BACK HERE @@ -2089,8 +2089,8 @@ namespace BaskerNS // for(Int bl = l+1; bl < last_blk; bl++) { Int bl = l+1; - Int A_col = S[lvl][kid]; - Int A_row = (lvl==1)?(2):S[bl][kid]%(LU_size(A_col)); + Int A_col = S(lvl)(kid); + Int A_row = (lvl==1)?(2):S(bl)(kid)%(LU_size(A_col)); Int CM_idx = kid; BASKER_MATRIX *Bp; @@ -2173,8 +2173,8 @@ namespace BaskerNS // l, last_blk, kid); for(Int bl=l+1; bl BB; - BB.Barrier(thread_array[leader_kid].token[sublvl][function_n], - thread_array[leader_kid].token[sublvl][1], + BB.Barrier(thread_array(leader_kid).token[sublvl][function_n], + thread_array(leader_kid).token[sublvl][1], size); */ } diff --git a/packages/shylu/shylu_node/basker/src/shylubasker_nfactor_col2.hpp b/packages/shylu/shylu_node/basker/src/shylubasker_nfactor_col2.hpp index 342835bd640c..4389365a84d6 100644 --- a/packages/shylu/shylu_node/basker/src/shylubasker_nfactor_col2.hpp +++ b/packages/shylu/shylu_node/basker/src/shylubasker_nfactor_col2.hpp @@ -135,7 +135,7 @@ namespace BaskerNS // 3) t_lower_col_factor : factor A(7,7), sequential // 4) t_lower_col_factor_offdiag2 : compute L(8:end, 7) - const Int U_col = S[lvl][kid]; + const Int U_col = S(lvl)(kid); const Int U_row = 0; Int ncol = LU[U_col][U_row].ncol; Int my_leader = find_leader(kid, 0); @@ -181,7 +181,7 @@ namespace BaskerNS t_basker_barrier(thread, kid, my_leader, b_size, 0, LU[U_col][U_row].scol, 0); for(Int tid = 0; tid < num_threads; tid++) { - if (thread_array[tid].error_type != BASKER_SUCCESS) { + if (thread_array(tid).error_type != BASKER_SUCCESS) { info = BASKER_ERROR; } } @@ -250,7 +250,7 @@ namespace BaskerNS t_basker_barrier(thread, kid, my_leader, b_size, 3, LU[U_col][U_row].scol, 0); for(Int ti = 0; ti < num_threads; ti++) { - if (thread_array[kid].error_type != BASKER_SUCCESS) { + if (thread_array(kid).error_type != BASKER_SUCCESS) { info = BASKER_ERROR; } } @@ -336,7 +336,7 @@ namespace BaskerNS t_basker_barrier(thread, kid, my_leader, b_size, 4, k, lvl-1); for(Int tid = 0; tid < num_threads; tid++) { - if (thread_array[tid].error_type != BASKER_SUCCESS) { + if (thread_array(tid).error_type != BASKER_SUCCESS) { info = BASKER_ERROR; } } @@ -395,7 +395,7 @@ namespace BaskerNS #ifdef BASKER_TIMER double time_factot = timer.seconds(); if((kid%(Int)(pow(2,lvl))) == 0) { - const Int L_col = S[lvl][kid]; + const Int L_col = S(lvl)(kid); const Int L_row = LU_size(U_col)-1; printf("Time Lower-Col(%d): %lf, n = %d, nnz(L) = %d, nnz(U) = %d \n", (int)kid, time_factot, @@ -446,7 +446,7 @@ namespace BaskerNS #endif //This will do the correct spmv - if(thread_array[kid].error_type == BASKER_ERROR_NOERROR) { + if(thread_array(kid).error_type == BASKER_ERROR_NOERROR) { t_upper_col_factor_offdiag2(kid, lvl, sl,l, k, lower); } //Barrier--Start @@ -461,7 +461,7 @@ namespace BaskerNS //Barrier--End if(kid%((Int)pow(2,sl)) == 0 && - thread_array[kid].error_type == BASKER_ERROR_NOERROR) { + thread_array(kid).error_type == BASKER_ERROR_NOERROR) { t_dense_blk_col_copy_atomic2(kid, my_leader, lvl, sl, l, k, lower); } @@ -477,7 +477,7 @@ namespace BaskerNS #endif }//over all sublevels - if(thread_array[kid].error_type == BASKER_ERROR_NOERROR) { + if(thread_array(kid).error_type == BASKER_ERROR_NOERROR) { t_dense_copy_update_matrix2(kid, my_leader, lvl, l, k); } }//end t_add_add @@ -507,10 +507,10 @@ namespace BaskerNS return; } - Int my_row_leader = S[0][find_leader(kid,lvl-1)]; - const Int L_col = S[sl][my_leader]; - const Int U_col = S[lvl][kid]; - const Int X_col = S[0][my_leader]; + Int my_row_leader = S(0)(find_leader(kid,lvl-1)); + const Int L_col = S(sl)(my_leader); + const Int U_col = S(lvl)(kid); + const Int X_col = S(0)(my_leader); Int L_row = l-sl+1; //Might have to think about th Int U_row = L_col-my_row_leader; Int X_row = l+1; //this will change for us @@ -588,10 +588,10 @@ namespace BaskerNS //Setup //printf("DEBUG, kid: %d k: %d A_col: %d A_row: %d \n", // kid, k, A_col, A_row); - const Int my_idx = S[0][kid]; + const Int my_idx = S(0)(kid); //should remove either as a paramter or here Int team_leader = find_leader(kid, sl); - const Int leader_idx = S[0][team_leader]; + const Int leader_idx = S(0)(team_leader); #ifdef BASKER_DEBUG_NFACTOR_COL2 if(lower == BASKER_TRUE) { @@ -709,8 +709,8 @@ namespace BaskerNS //printf("\n\n\n\n"); const Entry zero (0.0); - const Int leader_idx = S[0][kid]; - BASKER_MATRIX &C = thread_array[kid].C; + const Int leader_idx = S(0)(kid); + BASKER_MATRIX &C = thread_array(kid).C; Int nnz = 0; //Over each blk @@ -724,10 +724,10 @@ namespace BaskerNS // X += B(:, k) { Int bl = l+1; - Int A_col = S[lvl][kid]; + Int A_col = S(lvl)(kid); - Int my_row_leader = S[0][find_leader(kid,lvl-1)]; - Int A_row = S[bl][kid] - my_row_leader; + Int my_row_leader = S(0)(find_leader(kid,lvl-1)); + Int A_row = S(bl)(kid) - my_row_leader; BASKER_MATRIX *Bp; if(A_row != (LU_size(A_col)-1)) @@ -875,13 +875,13 @@ namespace BaskerNS const Int leader_id = find_leader(kid, l); const Int lteam_size = pow(2,l+1); - const Int L_col = S[lvl][leader_id]; - const Int U_col = S[lvl][leader_id]; + const Int L_col = S(lvl)(leader_id); + const Int U_col = S(lvl)(leader_id); Int L_row = 0; Int U_row = LU_size(U_col)-1; - Int X_col = S[0][leader_id]; + Int X_col = S(0)(leader_id); Int X_row = l+1; Int col_idx_offset = 0; //can get rid of? diff --git a/packages/shylu/shylu_node/basker/src/shylubasker_nfactor_col_inc.hpp b/packages/shylu/shylu_node/basker/src/shylubasker_nfactor_col_inc.hpp index ee72c5d32c7b..02fde7c7ccad 100644 --- a/packages/shylu/shylu_node/basker/src/shylubasker_nfactor_col_inc.hpp +++ b/packages/shylu/shylu_node/basker/src/shylubasker_nfactor_col_inc.hpp @@ -83,7 +83,7 @@ namespace BaskerNS ) { - const Int U_col = S[lvl][kid]; + const Int U_col = S(lvl)(kid); Int U_row = 0; //const Int scol = LU(U_col)(U_row).scol; @@ -577,12 +577,12 @@ namespace BaskerNS ) { l = l+1; - Int my_token = S[l][kid]; + Int my_token = S(l)(kid); Int my_loc = kid; while((my_loc > 0)) { my_loc--; - if(S[l][my_loc] != my_token) + if(S(l)(my_loc) != my_token) { my_loc++; break; @@ -615,14 +615,14 @@ namespace BaskerNS //Get needed variables - const Int L_col = S[l][kid]; + const Int L_col = S(l)(kid); // const Int L_row = 0; //NDE - warning: unused - const Int U_col = S[lvl][kid]; + const Int U_col = S(lvl)(kid); Int my_row_leader = find_leader(kid,lvl-1); //Int my_new_row = // L_col - S(0)(my_row_leader); - Int U_row = L_col - S[0][my_row_leader]; + Int U_row = L_col - S(0)(my_row_leader); /* Int U_row = (lvl==1)?(kid%2):S(l)(kid)%LU_size(U_col); @@ -642,7 +642,7 @@ namespace BaskerNS //U_row = my_new_row; - const Int X_col = S[0][kid]; + const Int X_col = S(0)(kid); const Int X_row = l; //X_row = lower(L) //const Int col_idx_offset = 0; //we might be able to remove @@ -664,7 +664,7 @@ namespace BaskerNS } else { - Bp = &(thread_array[kid].C); + Bp = &(thread_array(kid).C); } BASKER_MATRIX &B = *Bp; //if(kid ==0) @@ -920,18 +920,18 @@ namespace BaskerNS if(Options.realloc == BASKER_FALSE) { - thread_array[kid].error_type = + thread_array(kid).error_type = BASKER_ERROR_NOMALLOC; return BASKER_ERROR; } else { //printf("HERE\n"); - thread_array[kid].error_type = + thread_array(kid).error_type = BASKER_ERROR_REMALLOC; - thread_array[kid].error_blk = U_col; - thread_array[kid].error_subblk = U_row; - thread_array[kid].error_info = newsize; + thread_array(kid).error_blk = U_col; + thread_array(kid).error_subblk = U_row; + thread_array(kid).error_info = newsize; return BASKER_ERROR; }//if/else realloc }//if need to realloc @@ -1086,26 +1086,26 @@ namespace BaskerNS // kid, lvl, sl, l); } - const Int L_col = S[sl][my_leader]; + const Int L_col = S(sl)(my_leader); Int L_row = l-sl+1; //Might have to think about th - const Int U_col = S[lvl][kid]; + const Int U_col = S(lvl)(kid); Int my_row_leader = find_leader(kid,lvl-1); Int my_new_row = - L_col - S[0][my_row_leader]; + L_col - S(0)(my_row_leader); // Int U_row = my_new_row; Int U_row = - (lvl==1)?(kid%2):S[sl][kid]%LU_size(U_col); - if((S[sl][kid] > 14) && - (S[sl][kid] > LU_size(U_col)) && + (lvl==1)?(kid%2):S(sl)(kid)%LU_size(U_col); + if((S(sl)(kid) > 14) && + (S(sl)(kid) > LU_size(U_col)) && (lvl != 1)) { //printf("lower offdiag new num, %d %d \n", // S(sl)(kid), LU_size(U_col)); - Int tm = (S[sl][kid]+1)/16; - U_row = ((S[sl][kid]+1) - (tm*16))%LU_size(U_col); + Int tm = (S(sl)(kid)+1)/16; + U_row = ((S(sl)(kid)+1) - (tm*16))%LU_size(U_col); } //printf("UFF kid:%d U: %d %d new: %d leader: %d %d lvl: %d l: %d sl: %d \n", @@ -1116,7 +1116,7 @@ namespace BaskerNS //JDB PASS TEST U_row = my_new_row; - const Int X_col = S[0][my_leader]; + const Int X_col = S(0)(my_leader); Int X_row = l+1; //this will change for us //Int col_idx_offset = 0; @@ -1256,18 +1256,18 @@ namespace BaskerNS return; } - const Int L_col = S[sl][my_leader]; + const Int L_col = S(sl)(my_leader); Int L_row = l-sl+1; //Might have to think about th - const Int U_col = S[lvl][kid]; + const Int U_col = S(lvl)(kid); Int my_row_leader = find_leader(kid,lvl-1); Int my_new_row = - L_col - S[0][my_row_leader]; + L_col - S(0)(my_row_leader); Int U_row = 0; U_row = my_new_row; - const Int X_col = S[0][my_leader]; + const Int X_col = S(0)(my_leader); Int X_row = l+1; //this will change for us Int col_idx_offset = 0; @@ -1276,11 +1276,11 @@ namespace BaskerNS //Need to give them the output pattern - Int U_pattern_col = S[lvl][kid]; + Int U_pattern_col = S(lvl)(kid); Int my_pattern_leader = find_leader_inc_lvl(kid,l); - Int U_pattern_row = S[l+1][my_pattern_leader] - - S[0][my_row_leader]; + Int U_pattern_row = S(l+1)(my_pattern_leader) - + S(0)(my_row_leader); /* printf("Test mypleader: %d myrowleader: %d kid: %d\n", @@ -1292,7 +1292,7 @@ namespace BaskerNS */ - Int L_pattern_col = S[lvl][kid]; + Int L_pattern_col = S(lvl)(kid); Int L_pattern_row = BASKER_MAX_IDX; if(lower == BASKER_TRUE) { @@ -1418,26 +1418,26 @@ namespace BaskerNS return; } - const Int L_col = S[sl][my_leader]; + const Int L_col = S(sl)(my_leader); Int L_row = l-sl+1; //Might have to think about th - const Int U_col = S[lvl][kid]; + const Int U_col = S(lvl)(kid); Int my_row_leader = find_leader(kid,lvl-1); Int my_new_row = - L_col - S[0][my_row_leader]; + L_col - S(0)(my_row_leader); // Int U_row = my_new_row; Int U_row = - (lvl==1)?(kid%2):S[sl][kid]%LU_size(U_col); - if((S[sl][kid] > 14) && - (S[sl][kid] > LU_size(U_col)) && + (lvl==1)?(kid%2):S(sl)(kid)%LU_size(U_col); + if((S(sl)(kid) > 14) && + (S(sl)(kid) > LU_size(U_col)) && (lvl != 1)) { - Int tm = (S[sl][kid]+1)/16; - U_row = ((S[sl][kid]+1) - (tm*16))%LU_size(U_col); + Int tm = (S(sl)(kid)+1)/16; + U_row = ((S(sl)(kid)+1) - (tm*16))%LU_size(U_col); } // printf("lowerspmv kid: %d U: %d %d new %d leader: %d %d lvl: %d %d %d \n", @@ -1448,7 +1448,7 @@ namespace BaskerNS U_row = my_new_row; - const Int X_col = S[0][my_leader]; + const Int X_col = S(0)(my_leader); Int X_row = l+1; //this will change for us Int col_idx_offset = 0; @@ -1538,8 +1538,8 @@ namespace BaskerNS ) { - const Int leader_idx = S[0][kid]; - BASKER_MATRIX &C = thread_array[kid].C; + const Int leader_idx = S(0)(kid); + BASKER_MATRIX &C = thread_array(kid).C; Int nnz = 0; // Int gbrow = 0; //NDE - warning: unused @@ -1549,11 +1549,11 @@ namespace BaskerNS { //Copy B -> C Int bl = l+1; - Int A_col = S[lvl][kid]; + Int A_col = S(lvl)(kid); Int my_row_leader = find_leader(kid,lvl-1); Int my_new_row = - S[bl][kid] - S[0][my_row_leader]; + S(bl)(kid) - S(0)(my_row_leader); Int A_row = 0; A_row = my_new_row; @@ -1653,8 +1653,8 @@ namespace BaskerNS ) { - const Int leader_idx = S[0][kid]; - BASKER_MATRIX &C = thread_array[kid].C; + const Int leader_idx = S(0)(kid); + BASKER_MATRIX &C = thread_array(kid).C; Int nnz = 0; Int gbrow = 0; @@ -1672,24 +1672,24 @@ namespace BaskerNS { //Copy B -> C Int bl = l+1; - Int A_col = S[lvl][kid]; + Int A_col = S(lvl)(kid); Int my_row_leader = find_leader(kid,lvl-1); Int my_new_row = - S[bl][kid] - S[0][my_row_leader]; + S(bl)(kid) - S(0)(my_row_leader); //Int A_row = my_new_row; - Int A_row = (lvl==1)?(2):S[bl][kid]%(LU_size(A_col)); - if((S[bl][kid] > 14) && - (S[bl][kid] > LU_size(A_col)) && + Int A_row = (lvl==1)?(2):S(bl)(kid)%(LU_size(A_col)); + if((S(bl)(kid) > 14) && + (S(bl)(kid) > LU_size(A_col)) && (lvl != 1)) { //printf("test cm %d %d %d \n", // kid, S(bl)(kid), LU_size(A_col)); - Int tm = (S[bl][kid]+1)/16; - A_row = ((S[bl][kid]+1) - (tm*16))%LU_size(A_col); + Int tm = (S(bl)(kid)+1)/16; + A_row = ((S(bl)(kid)+1) - (tm*16))%LU_size(A_col); } @@ -1883,12 +1883,12 @@ namespace BaskerNS ) { //Get needed variables - const Int L_col = S[lvl][kid]; + const Int L_col = S(lvl)(kid); const Int L_row = 0; - const Int U_col = S[lvl][kid]; + const Int U_col = S(lvl)(kid); const Int U_row = LU_size(U_col)-1; - const Int X_col = S[0][kid]; + const Int X_col = S(0)(kid); //Int col_idx_offset = 0; //can we get rid of now? @@ -1905,7 +1905,7 @@ namespace BaskerNS BASKER_MATRIX &L = LL[L_col][L_row]; BASKER_MATRIX &U = LU[U_col][U_row]; - BASKER_MATRIX &B = thread_array[kid].C; + BASKER_MATRIX &B = thread_array(kid).C; #ifdef BASKER_DEBUG_NFACTOR_COL if(kid >= 0) @@ -2201,17 +2201,17 @@ namespace BaskerNS if(Options.realloc == BASKER_FALSE) { - thread_array[kid].error_type = + thread_array(kid).error_type = BASKER_ERROR_NOMALLOC; return BASKER_ERROR; } else { - thread_array[kid].error_type = + thread_array(kid).error_type = BASKER_ERROR_REMALLOC; - thread_array[kid].error_blk = L_col; - thread_array[kid].error_subblk = -1; - thread_array[kid].error_info = newsize; + thread_array(kid).error_blk = L_col; + thread_array(kid).error_subblk = -1; + thread_array(kid).error_info = newsize; return BASKER_ERROR; } } @@ -2229,16 +2229,16 @@ namespace BaskerNS if(Options.realloc == BASKER_FALSE) { - thread_array[kid].error_type = + thread_array(kid).error_type = BASKER_ERROR_NOMALLOC; } else { - thread_array[kid].error_type = + thread_array(kid).error_type = BASKER_ERROR_REMALLOC; - thread_array[kid].error_blk = U_col; - thread_array[kid].error_subblk = U_row; - thread_array[kid].error_info = newsize; + thread_array(kid).error_blk = U_col; + thread_array(kid).error_subblk = U_row; + thread_array(kid).error_info = newsize; return BASKER_ERROR; } } @@ -2462,11 +2462,11 @@ namespace BaskerNS const Int leader_id = find_leader(kid, l); const Int lteam_size = pow(2,l+1); - const Int L_col = S[lvl][leader_id]; + const Int L_col = S(lvl)(leader_id); Int L_row = 0; - const Int U_col = S[lvl][leader_id]; + const Int U_col = S(lvl)(leader_id); Int U_row = LU_size(U_col)-1; - Int X_col = S[0][leader_id]; + Int X_col = S(0)(leader_id); Int X_row = l+1; Int col_idx_offset = 0; //can get rid of? @@ -2585,9 +2585,9 @@ namespace BaskerNS //const Int lteam_size = pow(2,l+1); //NDE - warning: unused // const Int L_col = S(lvl)(leader_id); //NDE - warning: unused // Int L_row = 0; //NDE - warning: unused - const Int U_col = S[lvl][leader_id]; + const Int U_col = S(lvl)(leader_id); Int U_row = LU_size(U_col)-1; - Int X_col = S[0][leader_id]; + Int X_col = S(0)(leader_id); Int X_row = l+1; //Int col_idx_offset = 0; //can get rid of?//NDE - warning: unused @@ -2621,11 +2621,11 @@ namespace BaskerNS const BASKER_BOOL lower ) { - const Int my_idx = S[0][kid]; + const Int my_idx = S(0)(kid); //should remove either as a paramter or here Int team_leader = find_leader(kid, sl); - const Int leader_idx = S[0][team_leader]; + const Int leader_idx = S(0)(team_leader); //If I an not a leader, then need to copy over if(kid != team_leader) @@ -2682,7 +2682,7 @@ namespace BaskerNS - Int U_pattern_col = S[lvl][kid]; + Int U_pattern_col = S(lvl)(kid); Int U_pattern_row = BASKER_MAX_IDX; if(blk == l+1) @@ -2691,11 +2691,11 @@ namespace BaskerNS //S(0)(find_leader(kid,lvl)); //U_pattern_row = S(l+1)(kid) - //S(0)(my_pattern_leader); - U_pattern_row = S[l+1][kid] - - S[0][find_leader(kid,lvl-1)]; + U_pattern_row = S(l+1)(kid) - + S(0)(find_leader(kid,lvl-1)); } - Int L_pattern_col = S[lvl][kid]; + Int L_pattern_col = S(lvl)(kid); Int L_pattern_row = BASKER_MAX_IDX; if(lower == BASKER_TRUE) { @@ -2769,11 +2769,11 @@ namespace BaskerNS //BASKER_MATRIX &B = AVM(A_col)(A_col); - const Int my_idx = S[0][kid]; + const Int my_idx = S(0)(kid); //should remove either as a paramter or here Int team_leader = find_leader(kid, sl); - const Int leader_idx = S[0][team_leader]; + const Int leader_idx = S(0)(team_leader); //Int loop_col_idx = S(l)(kid); NU //#ifdef BASKER_DEBUG_NFACTOR_COL2 diff --git a/packages/shylu/shylu_node/basker/src/shylubasker_nfactor_diag.hpp b/packages/shylu/shylu_node/basker/src/shylubasker_nfactor_diag.hpp index dc59708fe158..b87a0f48eadf 100644 --- a/packages/shylu/shylu_node/basker/src/shylubasker_nfactor_diag.hpp +++ b/packages/shylu/shylu_node/basker/src/shylubasker_nfactor_diag.hpp @@ -294,9 +294,9 @@ namespace BaskerNS printf("Error: NaN diag in single factor\n"); } } - thread_array[kid].error_type = BASKER_ERROR_SINGULAR; - thread_array[kid].error_blk = c; - thread_array[kid].error_info = k; + thread_array(kid).error_type = BASKER_ERROR_SINGULAR; + thread_array(kid).error_blk = c; + thread_array(kid).error_info = k; return BASKER_ERROR; } @@ -373,9 +373,9 @@ namespace BaskerNS Mag rmin_ (0.0); //workspace - Int ws_size = thread_array[kid].iws_size; - INT_1DARRAY ws = thread_array[kid].iws; - ENTRY_1DARRAY X = thread_array[kid].ews; + Int ws_size = thread_array(kid).iws_size; + INT_1DARRAY ws = thread_array(kid).iws; + ENTRY_1DARRAY X = thread_array(kid).ews; Int *color = &(ws(0)); Int *pattern = &(color[ws_size]); @@ -580,9 +580,9 @@ namespace BaskerNS << " Column: " << k << std::endl; } - thread_array[kid].error_type = BASKER_ERROR_NAN; - thread_array[kid].error_blk = c; - thread_array[kid].error_info = k; + thread_array(kid).error_type = BASKER_ERROR_NAN; + thread_array(kid).error_blk = c; + thread_array(kid).error_info = k; return BASKER_ERROR; } absv = abs(value); @@ -714,9 +714,9 @@ namespace BaskerNS pivot = normA_blk * eps; X(maxindex) = pivot; } else { - thread_array[kid].error_type = BASKER_ERROR_SINGULAR; - thread_array[kid].error_blk = c; - thread_array[kid].error_info = k; + thread_array(kid).error_type = BASKER_ERROR_SINGULAR; + thread_array(kid).error_blk = c; + thread_array(kid).error_info = k; return BASKER_ERROR; } } @@ -780,16 +780,16 @@ namespace BaskerNS (long)btf_tabs(c), (long)btf_tabs(c+1), (long)(btf_tabs(c+1)-btf_tabs(c))); } - thread_array[kid].error_blk = c; + thread_array(kid).error_blk = c; if(Options.realloc == BASKER_FALSE) { - thread_array[kid].error_type = BASKER_ERROR_NOMALLOC; + thread_array(kid).error_type = BASKER_ERROR_NOMALLOC; return BASKER_ERROR; } else { - thread_array[kid].error_type = BASKER_ERROR_REMALLOC; - thread_array[kid].error_info = newsize; + thread_array(kid).error_type = BASKER_ERROR_REMALLOC; + thread_array(kid).error_info = newsize; return BASKER_ERROR; } } @@ -804,16 +804,16 @@ namespace BaskerNS printf("blk: %ld column: %ld \n", (long)c, (long)k); } - thread_array[kid].error_blk = c; + thread_array(kid).error_blk = c; if(Options.realloc == BASKER_FALSE) { - thread_array[kid].error_type = BASKER_ERROR_NOMALLOC; + thread_array(kid).error_type = BASKER_ERROR_NOMALLOC; return BASKER_ERROR; } else { - thread_array[kid].error_type = BASKER_ERROR_REMALLOC; - thread_array[kid].error_info = newsize; + thread_array(kid).error_type = BASKER_ERROR_REMALLOC; + thread_array(kid).error_info = newsize; return BASKER_ERROR; } } @@ -991,8 +991,8 @@ namespace BaskerNS ) { //printf("=======LOCAL REACH BTF SHORT CALLED (pattern[top=%d - 1] = %d) =====\n",(int)top, (int)j); - INT_1DARRAY ws = thread_array[kid].iws; - Int ws_size = thread_array[kid].iws_size; + INT_1DARRAY ws = thread_array(kid).iws; + Int ws_size = thread_array(kid).iws_size; Int *color = &(ws(0)); Int *pattern = &(ws(ws_size)); @@ -1014,8 +1014,8 @@ namespace BaskerNS { //printf("=======LOCAL REACH BTF CALLED =====\n"); - INT_1DARRAY ws = thread_array[kid].iws; - Int ws_size = thread_array[kid].iws_size; + INT_1DARRAY ws = thread_array(kid).iws; + Int ws_size = thread_array(kid).iws_size; /*{ printf("ws_size: %d \n", ws_size); @@ -1144,8 +1144,8 @@ namespace BaskerNS ) { - INT_1DARRAY ws = thread_array[kid].iws; - Int ws_size = thread_array[kid].iws_size; + INT_1DARRAY ws = thread_array(kid).iws; + Int ws_size = thread_array(kid).iws_size; /* printf("ws_size: %d \n", ws_size); @@ -1289,9 +1289,9 @@ namespace BaskerNS { const Entry zero (0.0); - INT_1DARRAY ws = thread_array[kid].iws; - ENTRY_1DARRAY X = thread_array[kid].ews; - Int ws_size = thread_array[kid].iws_size; + INT_1DARRAY ws = thread_array(kid).iws; + ENTRY_1DARRAY X = thread_array(kid).ews; + Int ws_size = thread_array(kid).iws_size; Int brow = L.srow; Int *color = &(ws(0)); diff --git a/packages/shylu/shylu_node/basker/src/shylubasker_sfactor.hpp b/packages/shylu/shylu_node/basker/src/shylubasker_sfactor.hpp index d48f0e720a7e..ef9bdb8084ef 100644 --- a/packages/shylu/shylu_node/basker/src/shylubasker_sfactor.hpp +++ b/packages/shylu/shylu_node/basker/src/shylubasker_sfactor.hpp @@ -285,8 +285,8 @@ int Basker::sfactor() for(Int ii=0; ii < split_num; ii++) { BASKER_ASSERT(A.ncol > 0, "Basker symmetric_sfactor assert: A.ncol malloc > 0 failed"); - MALLOC_INT_1DARRAY(gScol[ii], A.ncol); - init_value(gScol[ii], A.ncol, (Int)0); + MALLOC_INT_1DARRAY(gScol(ii), A.ncol); + init_value(gScol(ii), A.ncol, (Int)0); } @@ -298,8 +298,8 @@ int Basker::sfactor() for(Int ii=0; ii < split_num; ii++) { BASKER_ASSERT(A.nrow > 0, "sfactor A.nrow malloc"); - MALLOC_INT_1DARRAY(gSrow[ii], A.nrow); - init_value(gSrow[ii], A.nrow, (Int)0); + MALLOC_INT_1DARRAY(gSrow(ii), A.nrow); + init_value(gSrow(ii), A.nrow, (Int)0); } #ifdef BASKER_TIMER @@ -334,7 +334,7 @@ int Basker::sfactor() for(Int p = 0; p < num_threads; ++p) #endif { - Int blk = S[0][p]; + Int blk = S(0)(p); if(Options.verbose == BASKER_TRUE) { printf(" ============= DOMAIN BLK (p=%d) ============\n",(int)p); @@ -409,18 +409,18 @@ int Basker::sfactor() for(Int p = 0; p < num_threads; ++p) { //Do off diag - Int blk = S[0][p]; + Int blk = S(0)(p); #ifdef SHYLU_BASKER_STREE_LIST auto stree_p = stree_list[p]; #endif for(Int l =0; l < tree.nlvls; l++) { - Int U_col = S[l+1][p]; + Int U_col = S(l+1)(p); //Note: Need to think more about this flow //Should be subtracted by how many times in the //future - Int my_row_leader = S[0][find_leader(p,l)]; + Int my_row_leader = S(0)(find_leader(p,l)); //Int my_new_row = // blk - my_row_leader; Int U_row = blk-my_row_leader; @@ -436,16 +436,16 @@ int Basker::sfactor() Int off_diag = 1; //printf( " U_blk_sfactor(AVM(%d,%d))\n",U_col,U_row ); //U_blk_sfactor(AV[U_col][U_row], stree, - // gScol[l], gSrow[glvl],0); + // gScol(l), gSrow(glvl),0); #ifdef BASKER_TIMER timer1.reset(); #endif #ifdef SHYLU_BASKER_STREE_LIST U_blk_sfactor(AVM[U_col][U_row], stree_p, - gScol[l], gSrow[glvl], off_diag); + gScol(l), gSrow(glvl), off_diag); #else U_blk_sfactor(AVM[U_col][U_row], stree, - gScol[l], gSrow[glvl], off_diag); + gScol(l), gSrow(glvl), off_diag); #endif #ifdef BASKER_TIMER time3 += timer1.seconds(); @@ -533,11 +533,11 @@ int Basker::sfactor() (long)U_col, (long)U_row, (long)lvl, (long)pp); #endif - Int U_col = S[lvl+1][ppp]; + Int U_col = S(lvl+1)(ppp); Int U_row = 0; //S_blk_sfactor(AL[U_col][U_row], stree, - //gScol[lvl], gSrow[pp]); + //gScol(lvl), gSrow(pp)); #ifdef BASKER_TIMER printf( " >>> S_blk_sfactor( ALM(%d)(%d) with %dx%d and nnz=%d) <<<\n",U_col,U_row, ALM[U_col][U_row].nrow,ALM[U_col][U_row].ncol,ALM[U_col][U_row].nnz ); fflush(stdout); @@ -545,10 +545,10 @@ int Basker::sfactor() #ifdef SHYLU_BASKER_STREE_LIST auto stree_p = stree_list[pp]; S_blk_sfactor(ALM[U_col][U_row], stree_p, - gScol[lvl], gSrow[pp]); + gScol(lvl), gSrow(pp)); #else S_blk_sfactor(ALM[U_col][U_row], stree, - gScol[lvl], gSrow[pp]); + gScol(lvl), gSrow(pp)); #endif #ifdef BASKER_TIMER printf( " >>> -> nnz = %d\n",ALM[U_col][U_row].nnz ); fflush(stdout); @@ -592,20 +592,20 @@ int Basker::sfactor() Int ppp; ppp = pp*pow(tree.nparts, lvl+1); - Int U_col = S[lvl+1][ppp]; + Int U_col = S(lvl+1)(ppp); Int U_row = 0; Int inner_blk = U_col; for(Int l = lvl+1; l < tree.nlvls; l++) { //printf( " --- pp = %d/%d, l = %d/%d ---\n",pp,p, l,tree.nlvls ); fflush(stdout); - U_col = S[l+1][ppp]; - U_row = S[lvl+1][ppp]%LU_size(U_col); + U_col = S(l+1)(ppp); + U_row = S(lvl+1)(ppp)%LU_size(U_col); - Int my_row_leader = S[0][find_leader(ppp,l)]; + Int my_row_leader = S(0)(find_leader(ppp,l)); //Int my_new_row = // S(lvl+1)(ppp) - my_row_leader; - U_row = S[lvl+1][ppp] - my_row_leader; + U_row = S(lvl+1)(ppp) - my_row_leader; #ifdef BASKER_DEBUG_SFACTOR printf("offida sep, lvl: %d l: %d U_col: %d U_row: %d \n", lvl, l, U_col, U_row); @@ -615,10 +615,10 @@ int Basker::sfactor() Int off_diag = 1; #ifdef SHYLU_BASKER_STREE_LIST U_blk_sfactor(AVM[U_col][U_row], stree_p, - gScol[l], gSrow[pp], off_diag); + gScol(l), gSrow(pp), off_diag); #else U_blk_sfactor(AVM[U_col][U_row], stree, - gScol[l], gSrow[pp], off_diag); + gScol(l), gSrow(pp), off_diag); #endif //In symmetric will not need @@ -656,8 +656,8 @@ int Basker::sfactor() for(Int ii = 0 ; ii < split_num; ++ii) { //printf("split\n"); - FREE(gScol[ii]); - FREE(gSrow[ii]); + FREE(gScol(ii)); + FREE(gSrow(ii)); } FREE(gScol); FREE(gSrow); @@ -2589,22 +2589,22 @@ int Basker::sfactor() for(Int i = 0 ; i < num_threads; i++) { - thread_array[i].iws_size = max_blk_size; - thread_array[i].ews_size = max_blk_size; + thread_array(i).iws_size = max_blk_size; + thread_array(i).ews_size = max_blk_size; //BASKER_ASSERT((thread_array(i).iws_size*thread_array(i).iws_mult) > 0, "Basker btf_last_dense assert: sfactor threads iws > 0 failed"); //BASKER_ASSERT((thread_array(i).ews_size*thread_array(i).ews_mult) > 0, "Basker btf_last_dense assert: sfactor threads ews > 0 failed"); #ifdef BASKER_TIMER printf("Malloc Thread: %d iws: %d \n", - i, (thread_array[i].iws_size* - thread_array[i].iws_mult)); + i, (thread_array(i).iws_size* + thread_array(i).iws_mult)); printf("Malloc Thread: %d ews: %d \n", - i, (thread_array[i].ews_size* - thread_array[i].ews_mult)); + i, (thread_array(i).ews_size* + thread_array(i).ews_mult)); #endif if (max_blk_size > 0) { - MALLOC_INT_1DARRAY(thread_array[i].iws, thread_array[i].iws_size*thread_array[i].iws_mult); - MALLOC_ENTRY_1DARRAY(thread_array[i].ews, thread_array[i].ews_size*thread_array[i].ews_mult); + MALLOC_INT_1DARRAY(thread_array(i).iws, thread_array(i).iws_size*thread_array(i).iws_mult); + MALLOC_ENTRY_1DARRAY(thread_array(i).ews, thread_array(i).ews_size*thread_array(i).ews_mult); } } } diff --git a/packages/shylu/shylu_node/basker/src/shylubasker_sfactor_inc.hpp b/packages/shylu/shylu_node/basker/src/shylubasker_sfactor_inc.hpp index ec7774a43f13..890bc8a17fca 100644 --- a/packages/shylu/shylu_node/basker/src/shylubasker_sfactor_inc.hpp +++ b/packages/shylu/shylu_node/basker/src/shylubasker_sfactor_inc.hpp @@ -99,20 +99,20 @@ namespace BaskerNS for(Int p=0; p < num_threads; ++p) { - Int blk = S[0][p]; + Int blk = S(0)(p); sfactor_nd_dom_estimate(ALM[blk][0], LL[blk][0], LU[blk][LU_size(blk)-1]); for(Int l=0; l < tree.nlvls; l++) { - Int U_col = S[l+1][p]; + Int U_col = S(l+1)(p); Int my_row_leader = find_leader(p,l); Int my_new_row = - blk - S[0][my_row_leader]; + blk - S(0)(my_row_leader); - Int U_row = (l==0)?(p%2):S[0][p]%LU_size(U_col); + Int U_row = (l==0)?(p%2):S(0)(p)%LU_size(U_col); if((blk > 14) && (blk > LU_size(U_col)) && (l!=0)) @@ -138,7 +138,7 @@ namespace BaskerNS for(Int pp=0; pp < pow(tree.nparts, tree.nlvls-lvl-1); pp++) { Int ppp = pp*pow(tree.nparts, lvl+1); - Int U_col = S[lvl+1][ppp]; + Int U_col = S(lvl+1)(ppp); Int U_row = 0; sfactor_nd_sep_estimate(ALM[U_col][U_row], @@ -148,19 +148,19 @@ namespace BaskerNS Int innerblk = U_col; for(Int l = lvl+1; l < tree.nlvls; l++) { - U_col = S[l+1][ppp]; + U_col = S(l+1)(ppp); Int my_row_leader = find_leader(ppp,l); Int my_new_row = - S[lvl+1][ppp] - S[0][my_row_leader]; + S(lvl+1)(ppp) - S(0)(my_row_leader); - U_row = S[lvl+1][ppp]%LU_size(U_col); - if((S[lvl+1][ppp] > 14) && - (S[lvl+1][ppp] > LU_size(U_col)) + U_row = S(lvl+1)(ppp)%LU_size(U_col); + if((S(lvl+1)(ppp) > 14) && + (S(lvl+1)(ppp) > LU_size(U_col)) ) { - Int tm = (S[lvl+1][ppp]+1)/16; - U_row = ((S[lvl+1][ppp]+1) - + Int tm = (S(lvl+1)(ppp)+1)/16; + U_row = ((S(lvl+1)(ppp)+1) - (tm*16))%LU_size(U_col); } diff --git a/packages/shylu/shylu_node/basker/src/shylubasker_tree.hpp b/packages/shylu/shylu_node/basker/src/shylubasker_tree.hpp index 81e3c78c7f9c..74a478591636 100644 --- a/packages/shylu/shylu_node/basker/src/shylubasker_tree.hpp +++ b/packages/shylu/shylu_node/basker/src/shylubasker_tree.hpp @@ -118,7 +118,7 @@ namespace BaskerNS for(Int i =0; i < tree.nblks+1; i++) { BASKER_ASSERT(num_threads > 0, "tree num_threads"); - MALLOC_INT_1DARRAY(S[i], num_threads); + MALLOC_INT_1DARRAY(S(i), num_threads); } //this will want to be across all threads @@ -335,7 +335,7 @@ namespace BaskerNS l, t, lvl_counter ,lvl_idx, tree.nblks); #endif - S[l][t] = tree.lvlset[lvl_idx]; + S(l)(t) = tree.lvlset[lvl_idx]; if(lvl_counter >= (pow(tree.nparts,l)-1)) { lvl_idx++; @@ -356,7 +356,7 @@ namespace BaskerNS { for(Int t=0; t < num_threads; t++) { - cout << S[l][t] << " , " ; + cout << S(l)(t) << " , " ; }//end over nhreads cout << endl; }//end over nlvls @@ -368,11 +368,11 @@ namespace BaskerNS { for(Int t=0; t < num_threads; t++) { - Int s_element = S[l][t]; + Int s_element = S(l)(t); Int row_size = (tree.row_tabs[s_element+1] - tree.row_tabs[s_element]); - thread_array[t].iws_size += row_size; - thread_array[t].ews_size += row_size; + thread_array(t).iws_size += row_size; + thread_array(t).ews_size += row_size; }//end over threads }//end over lvls @@ -592,7 +592,7 @@ namespace BaskerNS l, t, lvl_counter ,lvl_idx, tree.nblks); #endif - S[l][t] = tree.lvlset[lvl_idx]; + S(l)(t) = tree.lvlset[lvl_idx]; if(lvl_counter >= (pow(tree.nparts,l)-1)) { lvl_idx++; @@ -611,7 +611,7 @@ namespace BaskerNS { for(Int t=0; t < num_threads; t++) { - cout << S[l][t] << " , " ; + cout << S(l)(t) << " , " ; }//end over nhreads cout << endl; }//end over nlvls @@ -624,10 +624,10 @@ namespace BaskerNS { for(Int t=0; t < num_threads; t++) { - Int s_element = S[l][t]; + Int s_element = S(l)(t); Int row_size = (tree.row_tabs[s_element+1] - tree.row_tabs[s_element]); - thread_array[t].iws_size += row_size; - thread_array[t].ews_size += row_size; + thread_array(t).iws_size += row_size; + thread_array(t).ews_size += row_size; }//end over threads }//end over lvls diff --git a/packages/shylu/shylu_node/basker/src/shylubasker_types.hpp b/packages/shylu/shylu_node/basker/src/shylubasker_types.hpp index c55c222ec7c7..193ecb11e24a 100644 --- a/packages/shylu/shylu_node/basker/src/shylubasker_types.hpp +++ b/packages/shylu/shylu_node/basker/src/shylubasker_types.hpp @@ -148,13 +148,13 @@ enum BASKER_INCOMPLETE_CODE #define BOOL_1DARRAY Kokkos::View #define BOOL_2DARRAY Kokkos::View -#define INT_2DARRAY std::vector -#define ENTRY_2DARRAY std::vector -#define MATRIX_1DARRAY std::vector -#define MATRIX_2DARRAY std::vector -#define MATRIX_VIEW_1DARRAY std::vector -#define MATRIX_VIEW_2DARRAY std::vector -#define THREAD_1DARRAY std::vector +#define INT_2DARRAY Kokkos::View +#define ENTRY_2DARRAY Kokkos::View +#define MATRIX_1DARRAY Kokkos::View +#define MATRIX_2DARRAY Kokkos::View +#define MATRIX_VIEW_1DARRAY Kokkos::View +#define MATRIX_VIEW_2DARRAY Kokkos::View +#define THREAD_1DARRAY Kokkos::View #define INT_1DARRAY_PAIRS Kokkos::View*, BASKER_EXE_SPACE> //Macro Memory Calls @@ -163,7 +163,6 @@ enum BASKER_INCOMPLETE_CODE { \ BASKER_ASSERT(s >= 0, "BASKER ASSERT MALLOC malloc_pairs_1d: size to alloc >= 0 fails"); \ if (s > 0) { \ - /*a = INT_1DARRAY_PAIRS(BASKER_KOKKOS_NOINIT("pairs_1d"),s);*/ \ Kokkos::resize(a, s); \ if(a.data() == NULL) \ throw std::bad_alloc(); \ @@ -192,8 +191,7 @@ enum BASKER_INCOMPLETE_CODE { \ BASKER_ASSERT(s >= 0,"BASKER ASSERT MALLOC int_2d: size to alloc >= 0 fails"); \ if (s > 0) { \ - /*a = INT_2DARRAY(Kokkos::view_alloc("int_2d", Kokkos::SequentialHostInit),s);*/ \ - a.resize(s); \ + a = INT_2DARRAY(Kokkos::view_alloc("int_2d", Kokkos::SequentialHostInit),s); \ if(a.data() == NULL) \ throw std::bad_alloc(); \ } \ @@ -202,7 +200,6 @@ enum BASKER_INCOMPLETE_CODE { \ BASKER_ASSERT(s >= 0, "BASKER ASSERT MALLOC entry_1d: size to alloc >= 0 fails"); \ if (s > 0) { \ - /*a = ENTRY_1DARRAY(BASKER_KOKKOS_NOINIT("entry_1d"),s);*/ \ Kokkos::resize(a, s); \ if(a.data() == NULL) \ throw std::bad_alloc(); \ @@ -212,8 +209,7 @@ enum BASKER_INCOMPLETE_CODE { \ BASKER_ASSERT(s >= 0, "BASKER ASSERT MALLOC entry_2d: size to alloc >= 0 fails"); \ if (s > 0) { \ - /*a = ENTRY_2DARRAY("entry_2d",s);*/ \ - a.resize(s); \ + a = ENTRY_2DARRAY(Kokkos::view_alloc("matrix_2d", Kokkos::SequentialHostInit),s); \ if(a.data() == NULL) \ throw std::bad_alloc(); \ } \ @@ -222,7 +218,6 @@ enum BASKER_INCOMPLETE_CODE { \ BASKER_ASSERT(s >= 0, "BASKER ASSERT MALLOC bool_1d: size to alloc >= 0 fails"); \ if (s > 0) { \ - /*a = BOOL_1DARRAY(BASKER_KOKKOS_NOINIT("bool_1d"), s);*/ \ Kokkos::resize(a, s); \ if(a.data() == NULL) \ throw std::bad_alloc(); \ @@ -232,7 +227,6 @@ enum BASKER_INCOMPLETE_CODE { \ BASKER_ASSERT(s >= 0, "BASKER ASSERT MALLOC bool_2d: size to alloc >= 0 fails"); \ if (s > 0) { \ - /*a = BOOL_2DARRAY("bool_2d", s);*/ \ Kokkos::resize(a, s); \ if(a.data() == NULL) \ throw std::bad_alloc(); \ @@ -242,8 +236,8 @@ enum BASKER_INCOMPLETE_CODE { \ BASKER_ASSERT(s >= 0, "BASKER ASSERT MALLOC matrix_1d: size to alloc >= 0 fails"); \ if (s > 0) { \ - /*a = MATRIX_1DARRAY("matrix_1d",s)*/ \ - a.resize(s); \ + a = MATRIX_1DARRAY(Kokkos::view_alloc("matrix_1d", Kokkos::SequentialHostInit),s); \ + Kokkos::resize(a,s); \ if(a.data() == NULL) \ throw std::bad_alloc(); \ } \ @@ -252,8 +246,8 @@ enum BASKER_INCOMPLETE_CODE { \ BASKER_ASSERT(s >= 0, "BASKER ASSERT MALLOC matrix_2d: size to alloc >= 0 fails"); \ if (s > 0) { \ - /*a = MATRIX_2DARRAY("matrix_2d",s);*/ \ - a.resize(s); \ + a = MATRIX_2DARRAY(Kokkos::view_alloc("matrix_2d", Kokkos::SequentialHostInit),s); \ + Kokkos::resize(a,s); \ if(a.data() == NULL) \ throw std::bad_alloc(); \ } \ @@ -262,8 +256,7 @@ enum BASKER_INCOMPLETE_CODE { \ BASKER_ASSERT(s >= 0, "BASKER ASSERT MALLOC matrix_view_1d: size to alloc >= 0 fails"); \ if (s > 0) { \ - /*a = MATRIX_VIEW_1DARRAY("matrix_view_1d",s);*/ \ - a.resize(s); \ + a = MATRIX_VIEW_1DARRAY(Kokkos::view_alloc("matrix_view_1d", Kokkos::SequentialHostInit),s); \ if(a.data() == NULL) \ throw std::bad_alloc(); \ } \ @@ -272,8 +265,7 @@ enum BASKER_INCOMPLETE_CODE { \ BASKER_ASSERT(s >= 0, "BASKER ASSERT MALLOC matrix_view_2d: size to alloc >= 0 fails"); \ if (s > 0) { \ - /*a = MATRIX_VIEW_2DARRAY("matrix_view_2d",s);*/ \ - a.resize(s); \ + a = MATRIX_VIEW_2DARRAY(Kokkos::view_alloc("matrix_view_2d", Kokkos::SequentialHostInit),s); \ if(a.data() == NULL) \ throw std::bad_alloc(); \ } \ @@ -282,26 +274,12 @@ enum BASKER_INCOMPLETE_CODE { \ BASKER_ASSERT(s >= 0, "BASKER ASSERT MALLOC thread_1d: size to alloc >= 0 fails"); \ if (s > 0) { \ - /*a = THREAD_1DARRAY("thread_1d",s);*/ \ - a.resize(s); \ + a = THREAD_1DARRAY(Kokkos::view_alloc("thread_1d", Kokkos::SequentialHostInit),s); \ if(a.data() == NULL) \ throw std::bad_alloc(); \ } \ } -//RESIZE (with copy) -#define RESIZE_1DARRAY(a,os,s) \ - { \ - BASKER_ASSERT(s >= 0, "BASKER ASSERT RESIZE 1D ARRAY: size to alloc >= 0 fails"); \ - Kokkos::resize(a,s); \ - } -#define RESIZE_2DARRAY(a,os1,os2,s1,s2) \ - { \ - BASKER_ASSERT(s1 >= 0 && s2 >= 0, "BASKER ASSERT RESIZE 2D ARRAY: size to alloc >= 0 fails"); \ - Kokkos::resize(a,s1,s2); \ - } -#define RESIZE_INT_1DARRAY(a,os,s) RESIZE_1DARRAY(a,os,s) -#define RESIZE_ENTRY_1DARRAY(a,os,s) RESIZE_1DARRAY(a,os,s) //REALLOC (no copy) #define REALLOC_1DARRAY(a,os,s) \ { \ @@ -315,6 +293,7 @@ enum BASKER_INCOMPLETE_CODE } #define REALLOC_INT_1DARRAY(a,os,s) REALLOC_1DARRAY(a,os,s) #define REALLOC_ENTRY_1DARRAY(a,os,s) REALLOC_1DARRAY(a,os,s) + //Set values #define SET_INT_1DARRAY(a, b, s) \ { \ @@ -341,80 +320,67 @@ enum BASKER_INCOMPLETE_CODE #define FREE_INT_1DARRAY_PAIRS(a) \ { \ - /*a = INT_1DARRAY_PAIRS();*/ \ Kokkos::resize(a,0); \ } #define FREE_INT_1DARRAY(a) \ { \ - /*a = INT_1DARRAY();*/ \ Kokkos::resize(a,0); \ } #define FREE_INT_RANK2DARRAY(a) \ { \ - /*a = INT_RANK2DARRAY();*/ \ Kokkos::resize(a,0); \ } #define FREE_INT_2DARRAY(a,n) \ { \ - /*a = INT_2DARRAY();*/ \ - a.resize(0); \ + Kokkos::resize(a,0); \ } #define FREE_ENTRY_1DARRAY(a) \ { \ - /*a = ENTRY_1DARRAY();*/ \ Kokkos::resize(a,0); \ } #define FREE_ENTRY_2DARRAY(a,n) \ { \ - /*a = ENTRY_2DARRAY();*/ \ - a.resize(0); \ + Kokkos::resize(a,0); \ } #define FREE_BOOL_1DARRAY(a) \ { \ - /*a = BOOL_1DARRAY();*/ \ Kokkos::resize(a,0); \ } #define FREE_BOOL_2DARRAY(a,n) \ { \ - /*a = BOOL_2DARRAY();*/ \ Kokkos::resize(a,0); \ } #define FREE_MATRIX_1DARRAY(a) \ { \ - /*a = MATRIX_1DARRAY();*/ \ - a.resize(0); \ + Kokkos::resize(a,0); \ } #define FREE_MATRIX_2DARRAY(a,n) \ { \ - /*a = MATRIX_2DARRAY();*/ \ - a.resize(0); \ + Kokkos::resize(a,0); \ } #define FREE_MATRIX_VIEW_1DARRAY(a) \ { \ - /*a = MATRIX_VIEW_1DARRAY();*/ \ Kokkos::resize(a,0); \ } #define FREE_MATRIX_VIEW_2DARRAY(a,n) \ { \ - /*a = MATRIX_VIEW_2DARRAY();*/ \ - a.resize(0); \ + Kokkos::resize(a,0); \ } #define FREE_THREAD_1DARRAY(a) \ { \ - /*a = THREAD_1DARRAY();*/ \ - a.resize(0); \ + Kokkos::resize(a,0); \ } #else // not BASKER_KOKKOS @@ -456,11 +422,6 @@ enum BASKER_INCOMPLETE_CODE #define MALLOC_MATRIX_VIEW_1DARRAY(a,s) a = new BASKER_MATRIX_VIEW [s] #define MALLOC_MATRIX_VIEW_2DARRAY(a,s) a = new MATRIX_VIEW_1DARRAY[s] #define MALLOC_THREAD_1DARRAY(a,s) a = new BASKER_THREAD [s] -//Resize (copy old data) (come back and add) -#define RESIZE_1DARRAY(a,os,s) BASKER_NO_OP -#define RESIZE_2DARRAY(a,os1,os2,s1,s2) BASKER_NO_OP -#define RESIZE_INT_1DARRAY(a,os,s) BASKER_NO_OP -#define RESIZE_ENTRY_1DARRAY(a,os,s) BASKER_NO_OP //Realloc (dont copy old data) #define REALLOC_1DARRAY(a,os,s) BASKER_NO_OP #define REALLOC_2DARRAY(a,os1,os2,s1,s2) BASKER_NO_OP diff --git a/packages/shylu/shylu_node/basker/src/shylubasker_util.hpp b/packages/shylu/shylu_node/basker/src/shylubasker_util.hpp index 3691d73c63ba..715ac1c13f5f 100644 --- a/packages/shylu/shylu_node/basker/src/shylubasker_util.hpp +++ b/packages/shylu/shylu_node/basker/src/shylubasker_util.hpp @@ -358,7 +358,7 @@ namespace BaskerNS { if(kid%((Int)pow(2,lvl)) == 0) { - Int b = S[lvl][kid]; + Int b = S(lvl)(kid); for(Int row = 0; row < LL_size(b); row++) { @@ -378,7 +378,7 @@ namespace BaskerNS { if(kid%((Int)pow(2,lvl)) == 0) { - Int b = S[lvl][kid]; + Int b = S(lvl)(kid); #ifdef BASKER_DEBUG_INIT printf("U Factor init: %d %d, nnz: %ld \n", @@ -402,13 +402,13 @@ namespace BaskerNS LU[b][LU_size(b)-1].nnz = LU[b][LU_size(b)-1].mnnz; for(Int l = lvl+1; l < tree.nlvls+1; l++) { - Int U_col = S[l][kid]; + Int U_col = S(l)(kid); Int my_row_leader = find_leader(kid, l-1); Int my_new_row = - b - S[0][my_row_leader]; + b - S(0)(my_row_leader); - Int U_row = (l==1)?(kid%2):S[lvl][kid]%LU_size(U_col); + Int U_row = (l==1)?(kid%2):S(lvl)(kid)%LU_size(U_col); //JDB TEST PASS U_row = my_new_row; @@ -460,7 +460,7 @@ namespace BaskerNS { if(kid%((Int)pow(2,lvl)) == 0) { - Int b = S[lvl][kid]; + Int b = S(lvl)(kid); for(Int row = 0; row < LL_size(b); row++) { @@ -524,7 +524,7 @@ namespace BaskerNS { if(kid%((Int)pow(2,lvl)) == 0) { - Int b = S[lvl][kid]; + Int b = S(lvl)(kid); #ifdef BASKER_DEBUG_INIT printf("U Factor init: %d %d, nnz: %ld \n", @@ -550,13 +550,13 @@ namespace BaskerNS for(Int l = lvl+1; l < tree.nlvls+1; l++) { - Int U_col = S[l][kid]; + Int U_col = S(l)(kid); Int my_row_leader = find_leader(kid, l-1); Int my_new_row = - b - S[0][my_row_leader]; + b - S(0)(my_row_leader); - Int U_row = (l==1)?(kid%2):S[lvl][kid]%LU_size(U_col); + Int U_row = (l==1)?(kid%2):S(lvl)(kid)%LU_size(U_col); if( (b > 14) && // NDE: Why is 14 specifically used here? (b > LU_size(U_col)) && @@ -640,7 +640,7 @@ namespace BaskerNS { if(kid%((Int)pow(2,lvl)) == 0) { - Int b = S[lvl][kid]; + Int b = S(lvl)(kid); for(Int row = 0; row < LL_size(b); row++) { @@ -692,7 +692,7 @@ namespace BaskerNS { if(kid%((Int)pow(2,lvl)) == 0) { - Int b = S[lvl][kid]; + Int b = S(lvl)(kid); #ifdef BASKER_DEBUG_INTI printf("AUM Factor init: %d %d, kid: %d nnz: %d nrow: %d ncol: %d \n", @@ -731,10 +731,10 @@ namespace BaskerNS //TEST Int my_leader = find_leader(kid,l-1); - Int my_leader_row = S[0][my_leader]; + Int my_leader_row = S(0)(my_leader); //Int my_col_size = pow(2,l); Not used Int my_new_row = - (S[lvl][kid] - my_leader_row); + (S(lvl)(kid) - my_leader_row); //my_new_row = my_new_row%my_col_size; /* @@ -745,7 +745,7 @@ namespace BaskerNS my_col_size, my_new_row); */ - Int U_col = S[l][kid]; + Int U_col = S(l)(kid); Int U_row = my_new_row; //Int U_row = (l==1)?(kid%2):S(lvl)(kid)%LU_size(U_col); @@ -823,7 +823,7 @@ namespace BaskerNS { if(kid%((Int)pow(2,lvl)) == 0) { - Int b = S[lvl][kid]; + Int b = S(lvl)(kid); for(Int l = 0; l < LL_size(b); l++) { @@ -885,7 +885,7 @@ namespace BaskerNS //printf("C: size: %d kid: %d \n", // iws_size, kid); - //thread_array[kid].C.init_matrix("cwork", + //thread_array(kid).C.init_matrix("cwork", // 0, iws_size, // 0, 2, // iws_size*2); @@ -895,7 +895,7 @@ namespace BaskerNS } //Also workspace matrix //This could be made smaller - thread_array[kid].C.init_matrix("cwork", 0, max_sep_size, + thread_array(kid).C.init_matrix("cwork", 0, max_sep_size, 0, 2, max_sep_size*2); } //end if btf_tabs_offset != 0 @@ -905,19 +905,19 @@ namespace BaskerNS { // if any left over for BLK factorization if(Options.btf == BASKER_TRUE) { - Int iws_mult = thread_array[kid].iws_mult; - Int iws_size = thread_array[kid].iws_size; - Int ews_mult = thread_array[kid].ews_mult; - Int ews_size = thread_array[kid].ews_size; + Int iws_mult = thread_array(kid).iws_mult; + Int iws_size = thread_array(kid).iws_size; + Int ews_mult = thread_array(kid).ews_mult; + Int ews_size = thread_array(kid).ews_size; for(Int i=0; i < iws_mult*iws_size; i++) { - thread_array[kid].iws[i] = 0; + thread_array(kid).iws[i] = 0; } for(Int i = 0; i < ews_mult*ews_size; i++) { - thread_array[kid].ews[i] = 0.0; + thread_array(kid).ews[i] = 0.0; } } } @@ -928,23 +928,23 @@ namespace BaskerNS { if(btf_tabs_offset != 0) { - INT_1DARRAY &ws = thread_array[kid].iws; - ENTRY_1DARRAY &X = thread_array[kid].ews; - Int iws_size = thread_array[kid].iws_size; - Int iws_mult = thread_array[kid].iws_mult; - Int ews_size = thread_array[kid].ews_size; - Int ews_mult = thread_array[kid].ews_mult; + INT_1DARRAY &ws = thread_array(kid).iws; + ENTRY_1DARRAY &X = thread_array(kid).ews; + Int iws_size = thread_array(kid).iws_size; + Int iws_mult = thread_array(kid).iws_mult; + Int ews_size = thread_array(kid).ews_size; + Int ews_mult = thread_array(kid).ews_mult; } } printf("init_workspace 1d, kid: %d size: %d %d %d %d \n", kid, iws_mult, iws_size, ews_mult, ews_size); for(Int i=0; i< iws_mult*iws_size; i++) { - thread_array[kid].iws[i] = 0; + thread_array(kid).iws[i] = 0; } for(Int i = 0; i < ews_mult*ews_size; i++) { - thread_array[kid].ews[i] = 0; + thread_array(kid).ews[i] = 0; } #endif //endif def basker_2dl //return 0; @@ -2467,12 +2467,12 @@ namespace BaskerNS Int Basker::find_leader(Int kid, Int l) { l = l+1; - Int my_token = S[l][kid]; + Int my_token = S(l)(kid); Int my_loc = kid; while((my_loc > 0)) { my_loc--; - if(S[l][my_loc] != my_token) + if(S(l)(my_loc) != my_token) { my_loc++; break;