小编Jam*_*mes的帖子

CUDA __constant__尊重全球记忆.哪个缓存?

我没有将大量参数传递给内核,而是使用__constant__变量.这个变量是一个结构数组,它包含许多指向全局数据的指针(这些指针是一个参数列表); 一个数组,用于调用内核的多个不同数据集.然后,内核访问此数组并取消引用全局适当的数据.我的问题是,这些数据是通过L2还是常量缓存缓存的?而且,如果后者和(如果加载的__ldg()话)通过L1或仍然是常量高速缓存?

更具体地说,数据本身位于全局中,但内核取消引用__constant__变量以获取它.这会对缓存产生负面影响吗?

c caching cuda

0
推荐指数
1
解决办法
452
查看次数

c ++(不是> = 11),初始化地图中的嵌套对

在我不应该用-std = c ++ 11编译的限制下,我想在以下变量中添加一个额外的变量,

std::map<unsigned,
  std::map<unsigned,
    std::pair<
      std::pair<int, int>,
      std::pair<bool, bool>
    >
  >
>
temp;
Run Code Online (Sandbox Code Playgroud)

并据此调整其初始化:

for (int i=0; i<100; ++i)
  {
    temp[i][i]=
      std::pair<
        std::pair<int, int>,
        std::pair<bool, bool>
        >
      > (
          std::pair<int, int> (intsX[i], intsY[i]),
          std::pair<bool, bool> (boolsX[i], boolsY[i])
        );
  }
Run Code Online (Sandbox Code Playgroud)

我想将结构更改为:

std::map<unsigned,
  std::map<unsigned,
    std::pair<
      std::pair<int, int>,
      std::pair<
        std::pair<bool, bool>,
        double
      >
    >
  >
>
temp;
Run Code Online (Sandbox Code Playgroud)

现在,我不知道如何更改初始化,例如......

for (int i=0; i<100; ++i)
  {
    temp[i][i]=
      std::pair<
        std::pair<int, int>,
        std::pair<
          std::pair<bool, bool>,
          double
        >
      > (
          std::pair<int, int> (intsX[i], intsY[i]),
          std::pair<std::pair, …
Run Code Online (Sandbox Code Playgroud)

c++ stdmap c++03 std-pair

0
推荐指数
1
解决办法
144
查看次数

标签 统计

c ×1

c++ ×1

c++03 ×1

caching ×1

cuda ×1

std-pair ×1

stdmap ×1