我试图从主机ubuntu机器上运行远程Ubuntu机器上的CUDA粒子样本.我遵循了这个教程:http: //devblogs.nvidia.com/parallelforall/remote-application-development-nvidia-nsight-eclipse-edition/它在我的主机上运行,但不在我的远程机器上运行.
我在Nsight中得到以下输出:
CUDA Particles Simulation Starting...
grid: 64 x 64 x 64 = 262144 cells
particles: 16384
No protocol specified
freeglut (/users/path/particles/Debug/particles): failed to open display ':0'
logout
Run Code Online (Sandbox Code Playgroud)
如果我从终端运行程序,我得到:
CUDA Particles Simulation Starting...
grid: 64 x 64 x 64 = 262144 cells
particles: 16384
CUDA error at ../src/particleSystem_cuda.cu:85 code=79(cudaErrorInvalidGraphicsContext) "cudaGraphicsGLRegisterBuffer(cuda_vbo_resource, vbo, cudaGraphicsMapFlagsNone)"
Run Code Online (Sandbox Code Playgroud)
是否可以在我的主机上显示粒子模拟,而计算是在远程系统上进行的?
它是通过X11Forwarding实现的,还是完全不同的错误?
我写了一个类,其中堆中的构造函数内存是用 cudaMallocHost() 和 cudaMalloc() 分配的。
如果我尝试释放内存 cudaFree() 或 cudaFreeHost(),GPUassert 会抱怨:
GPUassert:无效的设备指针 ../src/main.cu 97
或者
GPUassert:无效参数../src/main.cu 95
我在具有计算能力 2.1 的设备上使用 CUDA TK 7.0。
我想我错过了一些基本的东西。我可以创建在设备上分配内存的对象吗?
class FreeMe {
public:
FreeMe(int size);
~FreeMe(void);
private:
float *A, *dA;
int size;
};
FreeMe::FreeMe(int size) :
size(size) {
gpuErrchk(cudaMallocHost((void** ) &A, sizeof(float) * size));
gpuErrchk(cudaMalloc((void** ) &dA, sizeof(float) * size));
}
FreeMe::~FreeMe(void) {
std::cout << "FreeMe obj deleted: Free ..." << std::endl;
gpuErrchk(cudaFreeHost(A));
gpuErrchk(cudaFree(dA));
}
int main(int argc, char **argv) {
int size = 3;
FreeMe …
Run Code Online (Sandbox Code Playgroud)