在"正常"状态下evil-mode,光标移动模拟了vim的标准行为.我希望通过以下两种方式使其更类似于标准的emacs行为.
我希望垂直运动发生在视觉线内,而不是逻辑线.即如果一条线被包裹,按下j或<down>应该移动到同一条线的下一部分.
我希望水平移动不会停留在换行符上.即如果光标位于一行的末尾,则按l或<right>应移至下一行.
我怎样才能做到这一点?
在以前的CUDA版本中,atomicAdd没有实现双精度,所以通常在这里实现这一点.使用新的CUDA 8 RC,当我尝试编译包含这样一个函数的代码时,我遇到了麻烦.我想这是因为使用Pascal和Compute Capability 6.0,添加了原生双重版本的atomicAdd,但不知何故,以前的Compute Capabilities没有正确忽略.
下面的代码用于编译和运行以前的CUDA版本,但现在我得到此编译错误:
test.cu(3): error: function "atomicAdd(double *, double)" has already been defined
Run Code Online (Sandbox Code Playgroud)
但是,如果我删除我的实现,我会得到此错误:
test.cu(33): error: no instance of overloaded function "atomicAdd" matches the argument list
argument types are: (double *, double)
Run Code Online (Sandbox Code Playgroud)
我应该补充一点,如果我编译-arch=sm_35或类似,我只会看到这个.如果我编译-arch=sm_60我获得预期的行为,即只有第一个错误,并在第二种情况下成功编译.
编辑:此外,它是特定的atomicAdd- 如果我更改名称,它运作良好.
它看起来像编译器错误.其他人可以确认是这种情况吗?
示例代码:
__device__ double atomicAdd(double* address, double val)
{
unsigned long long int* address_as_ull = (unsigned long long int*)address;
unsigned long long int old = *address_as_ull, assumed;
do {
assumed = …Run Code Online (Sandbox Code Playgroud) 由于我没有能够找到这样的功能(错误?),我试图做一个编译时功能(constexpr)函数,该函数std::array<T,n> arr和T t,并返回一个新的std::array<T,n+1>以t添加到年底arr.我开始用这样的东西:
template <typename T, int n>
constexpr std::array<T,n+1> append(std::array<T,n> a, T t);
template <typename T>
constexpr std::array<T,1> append(std::array<T,0> a, T t)
{
return std::array<T,1>{t};
}
template <typename T>
constexpr std::array<T,2> append(std::array<T,1> a, T t)
{
return std::array<T,2>{a[0], t};
}
Run Code Online (Sandbox Code Playgroud)
在这里我卡住了.我需要的是一种在初始化列表a的第一个n位置展开的方法,然后添加t添加结束.那可能吗?还是有另一种方法吗?
这是我一直在尝试编译的一段代码:
#include <cstdio>
#define N 3
struct Data {
int A[N][N];
int B[N];
};
int foo(int uloc, const int A[N][N], const int B[N])
{
for(unsigned int j = 0; j < N; j++) {
for( int i = 0; i < N; i++) {
for( int r = 0; r < N ; r++) {
for( int q = 0; q < N ; q++) {
uloc += B[i]*A[r][j] + B[j];
}
}
}
}
return uloc;
}
int apply(const …Run Code Online (Sandbox Code Playgroud) 在下面的代码中,我尝试A在模板参数T具有值时为基本情况专门化类B<m>.
#include <array>
#include <iostream>
template <std::size_t m>
struct B
{
std::array<double,m> arr;
};
template <std::size_t n, typename T>
struct A
{
std::array<T,n> arr;
const static int inner_dim = T::inner_dim;
};
template <std::size_t n >
template <std::size_t m>
struct A<n,B<m>>
{
std::array<B<m>,n> arr;
const static int inner_dim = m;
};
int main(int argc, char *argv[])
{
A<5,A<4,B<3>>> a;
std::cout << a.inner_dim << std::endl;
A<5,B<4>> b;
std::cout << b.inner_dim << std::endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
但是,在main中的实例化中,当我用g …