在CUDA中,
__shared__
内存似乎需要在编译时知道其大小。然而,在我的问题中,__shared__
内存的大小只有在运行时才能确定,即:int size=get_size();
__shared__ mem[size];
这将导致 "错误:常量值未知",我不确定如何解决这个问题。