Tag: gpu

如何让我的GPU上的IDCT运行得更快?

我正在尝试从GPU的代码中优化IDCT。 我在NVIDIA Tesla k20c系统上使用的GPU。 原始代码中编写的IDCT函数如下所示: void IDCT(int32_t *input, uint8_t *output) { int32_t Y[64]; int32_t k, l; for (k = 0; k < 8; k++) { for (l = 0; l < 8; l++) Y(k, l) = SCALE(input[(k << 3) + l], S_BITS); idct_1d(&Y(k, 0)); } for (l = 0; l < 8; l++) { int32_t […]

针对VS2010在CUDA C中编译计算能力2.x.

我是这样的: 在__device / global__ CUDA内核中动态分配内存 但它仍然无法编译。 error : calling a host function(“_malloc_dbg”) from a __device__/__global__ function(“kernel”) is not allowed error MSB3721: The command “”C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA \v4.1\bin\nvcc.exe” -gencode=arch=compute_20,code=\”sm_20,compute_20\” –use-local-env –cl-version 2010 -ccbin “c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64″ -I”..\..\..\Source\Include” -G0 –keep-dir “x64\Debug” -maxrregcount=0 –machine 64 –compile -g -Xcompiler “/EHsc /nologo /Od /Zi /MDd […]

OpenCL有效地分组下三角矩阵

我确定之前有人遇到过这个问题,基本上我有一个2D优化网格NxM,其约束条件是n_i <= m_i,即我只想计算矩阵下三角形部分的对。 目前我天真地只在M个工作组的N个本地组中实现所有NxM组合(然后使用localGroupID和workGroupID来标识该对),然后如果约束无法保存计算则返回-inf。 但有没有更好的方法来设置线程并索引它们,所以我只需要生成(NXM)/ 2线程而不是完整的NxM。 非常感谢Sam

将多分支树复制到GPU内存

我有一个节点树,我试图将其复制到GPU内存。 Node看起来像这样: struct Node { char *Key; int ChildCount; Node *Children; } 我的复制function如下所示: void CopyTreeToDevice(Node* node_s, Node* node_d) { //allocate node on device and copy host node cudaMalloc( (void**)&node_d, sizeof(Node)); cudaMemcpy(node_d, node_s, sizeof(Node), cudaMemcpyHostToDevice); //test printf(“ChildCount of node_s looks to be : %d\n”, node_s->ChildCount); printf(“Key of node_s looks to be : %s\n”, node_s->Key); Node *temp; […]

GPU卡在2秒后重置

我正在使用NVIDIA geforce卡,如果我尝试在其上运行一些CUDA程序,则会在2秒后发出错误。 我在这里读到你可以使用HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\GraphicsDrivers的TDRlevel键。 但是,我在注册表中看不到任何此类密钥。 是否需要自己添加? 有其他人遇到过这个问题。 如果是这样,你是如何解决的? 谢谢。

C中的Malloc内存损坏

我使用malloc时遇到问题。 我有一个名为jacobi_gpu的函数,它被多次调用: int main(int argc, char* argv[]){ /* … */ int totalrot=0; while(nrot>0){ iter++; nrot=jacobi_gpu(a,q, tol, dimmat); totalrot+=nrot; printf(“iter =%3d nrot=%3d\n”,iter, nrot); } /* … */ } 参数a,q,tol和dimmat被正确初始化。 A和Q是2平方矩阵,dimmat是它们的维数。 这是我的代码: int jacobi_gpu(double A[], double Q[], double tol, long int dim){ int nrot, p, q, k, tid; double c, s; double *mc, *vc; printf(“jacobi begins \n”); […]

cuPrintf问题

我正在尝试将一个struct数组复制到device.I我正在使用一个GPU atm,我有一个cuPrintf函数的问题,我用它来调试我的代码。 我的结构定义如下: struct Node { char Key[25]; char ConsAlterKey[25]; char MasterKey[3]; int VowelDeletion; char Data[6]; char MasterData[6]; int Children[35]; int ChildCount; }; 为了测试目的,我填充struct数组,如下所示: void FillArray(Node *NodeArray) { for(int i=0;i<TotalNodeCount;i++) { strcpy(NodeArray[i].Key,"Key"); strcpy(NodeArray[i].ConsAlterKey,"ConsAlterKey"); strcpy(NodeArray[i].MasterKey,"Mk"); NodeArray[i].VowelDeletion=0; strcpy(NodeArray[i].Data,"Data"); strcpy(NodeArray[i].MasterData,"Mdata"); NodeArray[i].ChildCount=5; for(int j =0;j<NodeArray[i].ChildCount;j++) { NodeArray[i].Children[j]=i+j; } } } 我的主要function如下: int main() { Node *NodeArray; Node *GpuTree; int […]

CUDA Primes Generation

当数据大小增加超过260k时,我的CUDA程序停止工作(它什么都不打印)。 有人能告诉我为什么会这样吗? 这是我的第一个CUDA计划。 如果我想要更大的素数,如何在CUDA上使用大于long long int的数据类型? 显卡是GT425M。 #include #include #include #define SIZE 250000 #define BLOCK_NUM 96 #define THREAD_NUM 1024 int data[SIZE]; __global__ static void sieve(int *num,clock_t* time){ const int tid = threadIdx.x; const int bid = blockIdx.x; int tmp=bid*THREAD_NUM+tid; if(tid==0) time[bid] = clock(); while(tmp<SIZE){ int i=1; while(((2*tmp+3)*i+tmp+1)<SIZE){ num[(2*tmp+3)*i+tmp+1] = 0; i++; } tmp+=BLOCK_NUM*THREAD_NUM; } if(tid==0) […]

使用GPU随机数

我正在研究使用nvidia GPU进行蒙特卡罗模拟。 但是,我想使用gsl随机数生成器以及并行随机数生成器,如SPRNG。 有谁知道这是否可能? 更新 我使用GPU玩过RNG。 目前还没有一个很好的解决方案。 SDK附带的Mersenne Twister并不适合(我的)Monte-Carlo模拟,因为生成种子需要相当长的时间。 NAG库更有前途。 您可以批量生成RN,也可以在单个线程中生成RN。 但是,目前仅支持少数分布 – Uniform,exponential和Normal。

Fortran接口调用返回指针的C函数

我有一个C函数, double* foofunc() { /* Function Body */ } 我不知道如何在Fortran声明一个接口来调用这个C函数。 此外,如果指针应该指向GPU device memory ,我怎么能在Fortran界面中定义它? 我是否需要使用DEVICE属性。 请使用Fortran支持的function,直到2003年。 有什么建议?