[Python 2] SUB = string.maketrans("0123456789","Ο12 26 5")
此代码产生错误:
ValueError: maketrans arguments must have same length
Run Code Online (Sandbox Code Playgroud)
我不确定为什么会发生这种情况,因为字符串长度相同.我唯一的想法是下标文本长度与标准大小的字符有某种不同,但我不知道如何解决这个问题.
使用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)