本文整理汇总了C++中LocalVector::info方法的典型用法代码示例。如果您正苦于以下问题:C++ LocalVector::info方法的具体用法?C++ LocalVector::info怎么用?C++ LocalVector::info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LocalVector
的用法示例。
在下文中一共展示了LocalVector::info方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[]) {
if (argc == 1) {
std::cerr << argv[0] << " <matrix> [Num threads]" << std::endl;
exit(1);
}
init_paralution();
if (argc > 2) {
set_omp_threads_paralution(atoi(argv[2]));
}
info_paralution();
LocalVector<double> x;
LocalVector<double> rhs;
LocalMatrix<double> mat;
mat.ReadFileMTX(std::string(argv[1]));
mat.info();
x.Allocate("x", mat.get_nrow());
rhs.Allocate("rhs", mat.get_nrow());
x.info();
rhs.info();
rhs.Ones();
mat.Apply(rhs, &x);
std::cout << "dot=" << x.Dot(rhs) << std::endl;
mat.ConvertToELL();
mat.info();
mat.MoveToAccelerator();
x.MoveToAccelerator();
rhs.MoveToAccelerator();
mat.info();
rhs.Ones();
mat.Apply(rhs, &x);
std::cout << "dot=" << x.Dot(rhs) << std::endl;
stop_paralution();
return 0;
}
示例2: main
int main(int argc, char* argv[]) {
if (argc == 1) {
std::cerr << argv[0] << " <matrix> [Num threads]" << std::endl;
exit(1);
}
init_paralution();
if (argc > 2) {
set_omp_threads_paralution(atoi(argv[2]));
}
info_paralution();
// int ii;
LocalVector<double> x;
LocalVector<double> rhs;
LocalMatrix<double> mat;
struct timeval ti1,ti2;//timer
mat.ReadFileMTX(std::string(argv[1]));
mat.info();
x.Allocate("x", mat.get_nrow());
rhs.Allocate("rhs", mat.get_nrow());
x.info();
rhs.info();
rhs.Ones();
gettimeofday(&ti1,NULL); /* read starttime in t1 */
mat.Apply(rhs, &x);
gettimeofday(&ti2,NULL); /* read endtime in t2 */
fflush(stderr);
fprintf(stderr, "\nTime cost host spmv code microseconds: %ld microseconds\n",
((ti2.tv_sec - ti1.tv_sec)*1000000L
+ti2.tv_usec) - ti1.tv_usec
);
std::cout << "\ndot=" << x.Dot(rhs) << std::endl;
mat.ConvertToBCSR();
mat.info();
mat.MoveToAccelerator();
x.MoveToAccelerator();
rhs.MoveToAccelerator();
mat.info();
rhs.Ones();
// exit(1);
gettimeofday(&ti1,NULL); /* read starttime in t1 */
mat.Apply(rhs, &x);
gettimeofday(&ti2,NULL); /* read endtime in t2 */
fflush(stderr);
fprintf(stderr, "\nTime cost for accelerator spmv microseconds: %ld microseconds\n",
((ti2.tv_sec - ti1.tv_sec)*1000000L
+ti2.tv_usec) - ti1.tv_usec
);
std::cout << "\ndot=" << x.Dot(rhs) << std::endl;
stop_paralution();
return 0;
}