|
|
@ -39,8 +39,8 @@ __global__ void FillFirstColumn(T* dist, const int M, const int N) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
template <typename T>
|
|
|
|
__global__ void Levenshtein(T* dist, const int* x1, const int* x2, const int M,
|
|
|
|
__global__ void Levenshtein(T* dist, const int64_t* x1, const int64_t* x2,
|
|
|
|
const int N, const int start) {
|
|
|
|
const int M, const int N, const int start) {
|
|
|
|
int idx = blockDim.x * blockIdx.x + threadIdx.x;
|
|
|
|
int idx = blockDim.x * blockIdx.x + threadIdx.x;
|
|
|
|
int offset = N;
|
|
|
|
int offset = N;
|
|
|
|
int index = start + idx * offset;
|
|
|
|
int index = start + idx * offset;
|
|
|
@ -113,8 +113,8 @@ class EditDistanceGPUKernel : public framework::OpKernel<T> {
|
|
|
|
dist_t.Resize({m + 1, n + 1});
|
|
|
|
dist_t.Resize({m + 1, n + 1});
|
|
|
|
dist_t.mutable_data<T>(ctx.GetPlace());
|
|
|
|
dist_t.mutable_data<T>(ctx.GetPlace());
|
|
|
|
auto dist = dist_t.data<T>();
|
|
|
|
auto dist = dist_t.data<T>();
|
|
|
|
auto x1 = x1_t->data<int>() + hyp_lod[num];
|
|
|
|
auto x1 = x1_t->data<int64_t>() + hyp_lod[num];
|
|
|
|
auto x2 = x2_t->data<int>() + ref_lod[num];
|
|
|
|
auto x2 = x2_t->data<int64_t>() + ref_lod[num];
|
|
|
|
|
|
|
|
|
|
|
|
FillFirstColumn<T><<<1 + m / PADDLE_CUDA_NUM_THREADS,
|
|
|
|
FillFirstColumn<T><<<1 + m / PADDLE_CUDA_NUM_THREADS,
|
|
|
|
PADDLE_CUDA_NUM_THREADS, 0, stream>>>(dist, m, n);
|
|
|
|
PADDLE_CUDA_NUM_THREADS, 0, stream>>>(dist, m, n);
|
|
|
|