小编Aar*_*ron的帖子

Python 2 maketrans()函数不适用于Unicode:"参数是不同的长度",当它们实际上是

[Python 2] SUB = string.maketrans("0123456789","Ο12 26 5")

此代码产生错误:

ValueError: maketrans arguments must have same length
Run Code Online (Sandbox Code Playgroud)

我不确定为什么会发生这种情况,因为字符串长度相同.我唯一的想法是下标文本长度与标准大小的字符有某种不同,但我不知道如何解决这个问题.

python string unicode translate python-2.x

8
推荐指数
1
解决办法
3953
查看次数

内核调用产生错误“错误:无法配置主机函数调用”。调用有什么问题?

使用nvcc -c mag_cuda.cu编译以下代码时:

//Standard Libraries
#include <iostream>
#include <math.h>
#include <vector>

//Project Specific Header
#include "mag.hpp"

 __global__
  void indv_B_components(int *self_coords, int pole_coords[][3], double *indv_B[][3], int No_poles, int counter_1)
  {
    some code......
  }

  //----------------------------------------------------------
  //------- Function to Calculate B Field at Each Pole -------
  //----------------------------------------------------------
  void calc_indv_B()
  {
    //declare namepspace for internal variables
    using namespace mag::internal;

    int *ppole_coords = &pole_coords[0][0];
    double *pindv_B;
    int self_coords[3];

    int num_threads_in_block = 256;
    int num_blocks = 32*2;

    cudaMallocManaged(&pindv_B, No_poles*3*sizeof(int));  


    //first loop to go over all poles …
Run Code Online (Sandbox Code Playgroud)

c++ cuda compiler-errors

-2
推荐指数
1
解决办法
360
查看次数

标签 统计

c++ ×1

compiler-errors ×1

cuda ×1

python ×1

python-2.x ×1

string ×1

translate ×1

unicode ×1