对于我的学士论文,我必须评估多核系统的常见问题.
在一些书中,我读到了关于虚假共享的内容以及其他有关缓存行乒乓的书籍.具体问题听起来很熟悉,这些问题是否同样存在,但还有其他名称?有人可以给我详细讨论这些主题的书名吗?(我已经有Darry Glove,Tanenbaum的文献......)
caching multicore processor computer-architecture false-sharing
对于我的学士论文,我必须分析虚假共享对多核系统的影响.因此,我在维基百科上看到了不同的缓存一致性协议类型,英特尔已经开发出MESIF缓存一致性协议,但英特尔也没有使用此信息.
查看手册英特尔®64和IA-32架构开发人员手册:Vol.3A我找不到任何关于MESIF但是MESI协议的内容.所以问题是,英特尔不使用自己的缓存一致性协议.或者我在错误的文件中搜索它.
multithreading caching multicore state-machine false-sharing
我正在尝试为复杂<float>的向量定义自己的减少,在对OpenMP中的数组减少问题的答案之后.
但是我的向量的大小在编译时并不固定,所以我不确定如何在declare reductionpragma中为向量定义初始化器.也就是说,我不能拥有
initializer( omp_priv=TComplexVector(10,0) )
Run Code Online (Sandbox Code Playgroud)
但是矢量需要初始化器.
如何在运行时传递我需要的向量大小的初始化子句?我到目前为止的内容如下:
typedef std::vector<complex<float>> TCmplxVec;
void ComplexAdd(TCmplxVec & x,TCmplxVec & y){
for (int i=0;i<x.size();i++)
{
x.real()+= y.real();
//... same for imaginary part and other operations
}
}
#pragma omp declare reduction(AddCmplx: TCmplxVec: \
ComplexAdd(&omp_out, &omp_in)) initializer( \
omp_priv={TCmplxVec(**here I want a variable length**,0} )
void DoSomeOperation ()
{
//TCmplxVec vec is empty and anotherVec not
//so each thread runs the inner loop serially
#pragma omp parallel for reduction(AddCmplx: …Run Code Online (Sandbox Code Playgroud) 当我尝试decltype()在私有方法函数上使用时,我得到私有方法的错误error: 'm1' has not been declared in this scope
#include <stdint.h>
class C
{
public:
C()=default;
~C()=default;
auto masterMethod(int opMode) ->decltype(m1())
{
switch(opMode)
{
case 1:
return m1(); break;
case 2:
return m2(); break;
default:
return m1(); break;
}
}
private:
int m1() {return 1;}
int m2() {return 2;}
};
Run Code Online (Sandbox Code Playgroud)
现在我的问题是,为什么编译器不在类的私有部分中查找,因为删除尾随返回类型或将私有部分放在顶部masterMethod解决了问题(decltype(auto)[如果允许C++ 14]也是正确的自动返回类型扣除).
此外,当删除decltype(m1())when m1()并m2()具有相同的返回类型时,它是不好的行为,因为这也适合我吗?