void forward_sweep_gauss_seidel_apply( KernelHandle *handle, typename KernelHandle::nnz_lno_t num_rows, typename KernelHandle::nnz_lno_t num_cols, lno_row_view_t_ row_map, lno_nnz_view_t_ entries, scalar_nnz_view_t_ values, x_scalar_view_t x_lhs_output_vec, y_scalar_view_t y_rhs_input_vec, bool init_zero_x_vector = false, bool update_y_vector = true, int numIter = 1){ typedef typename Impl::GaussSeidel <KernelHandle, lno_row_view_t_, lno_nnz_view_t_,scalar_nnz_view_t_ > SGS; SGS sgs(handle, num_rows, num_cols, row_map, entries, values); sgs.apply( x_lhs_output_vec, y_rhs_input_vec, init_zero_x_vector, numIter, true, false,update_y_vector); }
void gauss_seidel_symbolic(KernelHandle *handle, typename KernelHandle::idx_array_type row_map, typename KernelHandle::idx_edge_array_type entries){ typedef typename Impl::GaussSeidel<KernelHandle> SGS; SGS sgs(handle, row_map, entries); sgs.initialize_symbolic(); }
void gauss_seidel_symbolic( KernelHandle *handle, typename KernelHandle::nnz_lno_t num_rows, typename KernelHandle::nnz_lno_t num_cols, lno_row_view_t_ row_map, lno_nnz_view_t_ entries, bool is_graph_symmetric = true){ typedef typename Impl::GaussSeidel<KernelHandle, lno_row_view_t_, lno_nnz_view_t_, typename KernelHandle::in_scalar_nnz_view_t> SGS; SGS sgs(handle,num_rows, num_cols, row_map, entries, is_graph_symmetric); sgs.initialize_symbolic(); }
void gauss_seidel_apply(KernelHandle *handle, typename KernelHandle::idx_array_type row_map, typename KernelHandle::idx_edge_array_type entries, typename KernelHandle::value_array_type values, typename KernelHandle::value_array_type &x_lhs_output_vec, typename KernelHandle::value_array_type y_rhs_input_vec, bool init_zero_x_vector = false, int numIter = 1){ typedef typename Impl::GaussSeidel<KernelHandle> SGS; SGS sgs(handle, row_map, entries, values); sgs.apply( x_lhs_output_vec, y_rhs_input_vec, init_zero_x_vector, numIter); }
int main(int argc,char**argv) { string actid=argv[1]; string basedir=argv[2]; uint32_t vtxnoBeg=strtoul(argv[3],NULL,0); uint32_t vtxnoEnd=strtoul(argv[4],NULL,0); string file=argv[5]; map<string,Action> actions; actions["push"]=&SubgraphSet::push; actions["unshift"]=&SubgraphSet::unshift; Action act=actions[actid]; if (act==NULL){ cout<<"Unknown act '"<<actid<<"'"<<endl; exit(0); } uint32_t sgkeyBeg=vtxnoBeg-vtxnoBeg%SubgraphSet::VERTEX_INTERVAL_WIDTH; SubgraphSet sgs(basedir); struct timeval beg_tv,end_tv; double t; gettimeofday(&beg_tv,NULL); for (uint32_t sgkey=sgkeyBeg;sgkey<vtxnoEnd;sgkey+=SubgraphSet::VERTEX_INTERVAL_WIDTH){ sgs.createSubgraph(sgkey); sgs.attachSubgraph(sgkey); } gettimeofday(&end_tv,NULL); t=((end_tv.tv_sec*1000+end_tv.tv_usec/1000)-(beg_tv.tv_sec*1000+beg_tv.tv_usec/1000))/1000.0; cout<<"create subgraph:["<<vtxnoBeg<<","<<vtxnoEnd<<")"<<endl; cout<<"time usage:"<<t<<endl; ifstream fin(file); vector<string> lines; string line; while(getline(fin,line)){ if (line.size()>CharContent::CONTENT_CAPACITY) line.resize(CharContent::CONTENT_CAPACITY); lines.push_back(line); } Block blk; CharContent *content=blk; gettimeofday(&beg_tv,NULL); for (uint32_t vtxno=vtxnoBeg;vtxno<vtxnoEnd;vtxno++) { for (uint32_t ln=0;ln<lines.size();ln++){ string& line=lines[ln]; content->resize(line.size()); std::copy(line.begin(),line.end(),content->begin()); (sgs.*act)(vtxno,&blk); } } gettimeofday(&end_tv,NULL); t=((end_tv.tv_sec*1000+end_tv.tv_usec/1000)-(beg_tv.tv_sec*1000+beg_tv.tv_usec/1000))/1000.0; cout<<"write vtxno("<<vtxnoEnd-vtxnoBeg<<"): ["<<vtxnoEnd<<","<<vtxnoBeg<<")"<<endl; cout<<"time usage:"<<t<<"s"<<endl; cout<<"vtxno per second="<<(vtxnoEnd-vtxnoBeg)/t<<endl; }