CUDA安装完成后测试部分报错bash: ./nbody: No such file or directory

在遵循NVIDIA官方CUDA快速启动指南并尝试运行nbody测试时遇到'bash: ./nbody: No such file or directory'的错误。通过错误排查,最终在TomGroves的帮助下解决问题。在终端执行特定命令后,成功显示CUDA安装完成的动画窗口。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

根据nvidia官方给出的安装教程《CUDA Quick Start Guide》,其中测试部分的进行步骤为:

7. Install a writable copy of the samples then build and run the nbody sample:


cuda-install-samples-9.0.sh ~
cd ~/NVIDIA_CUDA-9.0_Samples/5_Simulations/nbody
make
./nbody


即在CUDA上运行nbody示例,make部分报错:

>>> WARNING - libGLU.so not found, refer to CUDA Getting Started Guide for how to find and install them. <<<
>>> WARNING - libX11.so not found, refer to CUDA Getting Started Guide for how to find and install them. <<<
>>> WARNING - gl.h not found, refer to CUDA Getting Started Guide for how to find and install them. <<<
>>> WARNING - glu.h not found, refer to CUDA Getting Started Guide for how to find and install them. <<<
>>> WARNING - Xlib.h not found, refer to CUDA Getting Started Guide for how to find and install them. <<<
[@] /usr/local/cuda-8.0/bin/nvcc -ccbin g++ -I../../common/inc -m64 -ftz=true -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_60,code=compute_60 -o bodysystemcuda.o -c bodysystemcuda.cu
[@] /usr/local/cuda-8.0/bin/nvcc -ccbin g++ -I../../common/inc -m64 -ftz=true -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_60,code=compute_60 -o nbody.o -c nbody.cpp
[@] /usr/local/cuda-8.0/bin/nvcc -ccbin g++ -I../../common/inc -m64 -ftz=true -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_60,code=compute_60 -o render_particles.o -c render_particles.cpp
[@] /usr/local/cuda-8.0/bin/nvcc -ccbin g++ -m64 -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_60,code=compute_60 -o nbody bodysystemcuda.o nbody.o render_particles.o -L/usr/lib/nvidia-367 -lGL -lGLU -lX11 -lglut
[@] mkdir -p ../../bin/x86_64/linux/release
[@] cp nbody ../../bin/x86_64/linux/release

自然的,接下来的./nbody部分找不到对应的文件:

bash: ./nbody: No such file or directory


经过几番错误排查,最后在TomGroves的答案帮助下解决了问题,( thanks for TomGroves ) :

首先在终端中依次敲下:

sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev libglfw3-dev libgles2-mesa-dev
GLPATH=/usr/lib make

就会跳出这样的动画窗口:

表示CUDA安装成功。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值