是提高压缩矩阵线程的安全性

Is boost compressed matrix thread safety?

本文关键字:线程 安全性 压缩 高压缩      更新时间:2023-10-16

我在boost压缩矩阵容器上使用openMP。我想知道以这种方式使用是否线程安全?

int noOfUser=2649429;//2649429
    int noOfItem=17770;//17770;
    boost::numeric::ublas::compressed_matrix<int> ratingMatrix(noOfItem,noOfUser,110000000);
#pragma omp parallel for schedule(dynamic)
for(int i=0;i<noOfItem;i++)
{
  for(int j=0;j<noOfUser;j++)
  {
    ratingMatrix(i,j)= #some rating
  }
}

我的测试结果表明,如果使用坐标

插入,则线程安全。