我最近在家中的机器上安装了第二个GPU(Tesla K40),我的搜索建议第一个PCI插槽成为为CUDA作业选择的默认GPU。一个很棒的链接正在解释它,可以在这里找到:
我最初的GPU是TITAN X,也支持CUDA,但它实际上最适合单精度计算,而Tesla则更适合双精度。对于该小组,我的问题是是否有办法将我的默认CUDA编程设备始终设置为第二个?显然,我每次都可以在代码中指定要使用的设备,但是我希望可以对设备进行配置,使其始终默认使用特斯拉卡。
还是打开包装盒并实际交换设备位置的唯一方法?不知怎么对我来说...
任何建议或相关链接可以跟进。
假设我有一个theano函数:
def my_fun(x, y):
# Create output array for example sake
z = np.asarray(
shape=(x.shape[0], y.shape[1]),
dtype=theano.config.floatX
)
z = x + y
# this is wrong, how should I convert this to a theano
# tensor?
return z
x = theano.tensor.dmatrix("x")
y = theano.tensor.dmatrix("y")
f = function(
inputs=[x, y],
outputs=[my_fun]
)
a = numpy.asarray([[1,2],[3,4]])
b = numpy.asarray([[1,2],[3,4]])
c = my_fun(a,b)
Run Code Online (Sandbox Code Playgroud)
我正在尝试在GTX 970上运行CNN网络"CAFFE".但是我收到了标题中提到的错误.
有人可以帮忙吗?
我发布了关于caffe组的更多细节的问题,但没有得到任何提示/答案!
https://groups.google.com/forum/#!topic/caffe-users/sVOfE0qhf_M
更新1
在我的Makefile.config中,我添加了 -gencode arch=compute_52,code=compute_52
CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
-gencode arch=compute_20,code=sm_21 \
-gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_35,code=sm_35 \
-gencode arch=compute_35,code=sm_35 \
-gencode arch=compute_50,code=compute_50 \
-gencode arch=compute_52,code=compute_52
Run Code Online (Sandbox Code Playgroud)
但是当我尝试制作时,它会返回:
$make
NVCC src/caffe/layers/cudnn_sigmoid_layer.cu
nvcc fatal : Unsupported gpu architecture 'compute_52'
Makefile:531: recipe for target '.build_release/cuda/src/caffe/layers/cudnn_sigmoid_layer.o' failed
make: *** [.build_release/cuda/src/caffe/layers/cudnn_sigmoid_layer.o] Error 1
Run Code Online (Sandbox Code Playgroud)
更新2
NCC版本是:
$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2014 NVIDIA Corporation
Built on Thu_Jul_17_21:41:27_CDT_2014
Cuda compilation tools, release 6.5, V6.5.12
Run Code Online (Sandbox Code Playgroud)
更新3
我正在使用带有346.96驱动程序的CUDA …
由于我正在编程的算法的性质,我需要用一些特定的数学来编写/填充 3D 矩阵,然后从该矩阵(在单独的内核中)读取作为 3D 线性插值纹理。
由于纹理是一种读取模式,我假设我可以以某种方式在全局内存中写入绑定到纹理,并从它单独读取,而无需双内存并将值从写入矩阵复制到读取矩阵。但是我似乎不知道如何做到这一点。
我的问题是我不知道如何定义这个全局读/写数组。在下面的示例中,我创建了一个 3D 纹理,但这是使用带有cudaExtent和 的代码cudaArray。但是我似乎无法使用这种类型在它们上书写,我似乎也无法使用float*或类似的方式创建它们。
我可能无法做到这一点,需要memcpy在中间的某个地方,但由于这些数组通常很大,我想节省内存。
示例代码(不编译,但清楚地定义了我想要做的结构)。因为是的,所以默认使用 100x100x100 3D 内存。
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <cuda_runtime_api.h>
#include <cuda.h>
#define MAXTREADS 1024
cudaError_t addWithCuda(int *c, const int *a, const int *b, unsigned int size);
texture<float, cudaTextureType3D, cudaReadModeElementType> tex;
__global__ void readKernel(float* imageend )
{
int indY = blockIdx.y * blockDim.y + threadIdx.y;
int indX = blockIdx.x * blockDim.x + threadIdx.x;
int indZ = blockIdx.z * …Run Code Online (Sandbox Code Playgroud) 我正在CUDA中编写一个程序,该程序sincos()使用双精度对函数进行了大量调用。恐怕这是代码的最大瓶颈之一,而且我无法减少对该函数的调用次数。
sincos我可以导入的CUDA或库中是否有任何近似的近似值?我也非常关注准确性,因此近似值越好,我的代码就会越快乐。
我也曾考虑过要建立一个查找表或使用taylor系列来近似这些值,但是在寻求这条路之前,我需要一些意见。
我可以在本地安装cuDNN而无需root权限吗?
我没有root访问我正在使用的Linux机器(发行版是openSuse),但我已经安装了CUDA 7.5.
我正在使用Theano,我需要cuDNN来提高GPU上的操作速度.
我cudnn-7.5-linux-x64-v5.1从Nvidia 下载并按照说明我需要将CuDNN存档内容复制到CUDA安装文件夹,即(cuda/lib64 /和cuda/include /).但这需要我具有root访问权限.
我是否有可能在本地提取cudnn存档并为theano提供cudnn库的路径?
我在tensorflow层的几个标准操作中已经看到(例如https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/kernels/maxpooling_op_gpu.cu.cc),代码CUDA_1D_KERNEL_LOOP(index,nthreads)作为前进和后退通行证的一部分...
我认为此处的“索引”以某种方式与底部要素地图的坐标有关,但不确定其确切含义...有谁可以帮助您?
我在试图找出如何安装caffe时失去了一天.最后,我构建了包括pycaffe在内的所有内容.但是当我现在在我的小测试pythons脚本中运行"import caffe"时,我收到以下错误
ImportError: /usr/progtools/anaconda2/bin/../lib/libgomp.so.1: version `GOMP_4.0' not found (required by /usr/lib/x86_64-linux-gnu/libsoxr.so.0)
Run Code Online (Sandbox Code Playgroud)
我发现这个github问题https://github.com/dmlc/mxnet/issues/1225 在底部有人说它是因为anaconda中的gcc版本是4.*而我用5.4编译了所有内容.我正在使用CUDA 8.0,因此它不应该与gcc 4.8.5(即cuda 7.5)有问题,因为支持5.*.
我正在尝试使用以下内联程序集编译 CUDA 代码:
static __device__ uint get_smid(void) {
uint ret;
asm("mov.u32 %0, %smid;" : "=r"(ret) );
return ret;
}
Run Code Online (Sandbox Code Playgroud)
nvcc带有标志的代码编译得很好-Xptxas -v。
当我尝试使用clang++(版本 4.0)和相应的标志-Xcuda-ptxas -v(我认为这是正确的,但我可能错了)编译它时,出现以下错误:
../../include/cutil_subset.h:23:25: error: invalid % escape in inline assembly string asm("mov.u32 %0, %smid;" : "=r"(ret) );
它指向%smid.
我想我应该链接正确的库,但我也有这个:L/cuda/install/lib.
另一种可能是 NVPTX asm 不兼容。在这个页面上,解释了 LLVM 对所有 PTX 变量都有不同的定义(smid 和 warpid 也有一些)。现在,如果提到的代码必须单独(不是内联)编写和编译,我会迷失方向。
有没有人以前处理过类似的问题?欢迎提出建议。
我也在我的机器上安装了cuda 8.0(Linux SL7),我已经下载了推力1.8.1并用新的1.8.1替换了现有的推力库.
据我所知,从推力1.8开始支持并可以在内核中使用.我引用他们的网站:
Thrust 1.8.0引入了对CUDA __device__代码的算法调用的支持,对CUDA流的支持以及算法性能的改进.用户现在可以从CUDA __device__代码调用Thrust算法
但是,当我使用Nsight eclipse构建应用程序时,它会向我显示以下错误:
不允许从__global__函数("mykernel")调用__host__函数("thrust :: sort").
请问有什么建议吗?
这是我的代码:
#include <iostream>
#include <numeric>
#include <stdlib.h>
#include <stdio.h>
#include <cuda_runtime.h>
#include <cuda.h>
#include <thrust/sort.h>
#include <thrust/execution_policy.h>
__global__ void mykernel(int* a, int* b)
{
thrust::sort(a, a + 10);
}
int main(void)
{
int a[10] = { 0, 9, 7, 3, 1, 6, 4, 5, 2, 8 };
int b[10];
int *d_a, *d_c;
cudaMalloc((void**)&d_a, 10 * sizeof(int));
cudaMalloc((void**)&d_c, 10 * sizeof(int));
std::cout << "A\n";
for (int i …Run Code Online (Sandbox Code Playgroud) cuda ×6
c++ ×2
caffe ×2
python ×2
anaconda ×1
gcc ×1
gpu ×1
linux ×1
llvm-clang ×1
numpy ×1
nvidia ×1
pycaffe ×1
tensorflow ×1
theano ×1
theano-cuda ×1
thrust ×1
trigonometry ×1