解决cuda-samples仓库中自带测试用例simpleVulkan运行过程中出现的错误

cuda-samples编译完成后,会生成如下二进制:
/opt/cuda-samples-12.5/bin/x86_64/linux/release/simpleVulkan

执行的时候会提示加载libglfw.so.3错误
[root@localhost simpleVulkan]# ./simpleVulkan
./simpleVulkan: error while loading shared libraries: libglfw.so.3: cannot open shared object file: No such file or directory

把libglfw.so.3假如链接器的搜索路径,关于安装glfw在另外一个帖子有说明:
[root@localhost simpleVulkan]# echo $LD_LIBRARY_PATH
/home/storage/bshang-home/vulkansdk/1.3.296.0/x86_64/lib::/usr/local/cuda-12.6/lib64

[root@localhost simpleVulkan]# export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH
[root@localhost simpleVulkan]# echo $LD_LIBRARY_PATH
/usr/local/lib64:/home/storage/bshang-home/vulkansdk/1.3.296.0/x86_64/lib::/usr/local/cuda-12.6/lib64

再次运行时会提示XDG_RUNTIME_DIR目录没有设置:
[root@localhost simpleVulkan]# ./simpleVulkan
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
GPU Device 0: “Tesla T4” with compute capability 7.5
Average FPS (over 5.00 seconds): 26.18
Average FPS (over 5.02 seconds): 26.30
Average FPS (over 5.01 seconds): 26.97
Average FPS (over 5.03 seconds): 25.86
Average FPS (over 5.03 seconds): 26.65

[root@localhost simpleVulkan]# cd /tmp/
[root@localhost tmp]# ls
2024_316.svg dde-network-dialog0dock hsperfdata_root runtime-root systemd-private-a4cf2d6a38224844a5c487af4ad155de-chronyd.service-jVkVfr systemd-private-a4cf2d6a38224844a5c487af4ad155de-systemd-logind.service-sNBcnU
dbus-nx2KCpMEfZ GrabKeyboard_lock_root pulse-HwQ1dOaXZSEg startdde-login-sound-mark systemd-private-a4cf2d6a38224844a5c487af4ad155de-polkit.service-hNCJt8
[root@localhost tmp]# cd runtime-root/
[root@localhost runtime-root]# ls

设置该目录为XDG_RUNTIME_DIR=/tmp/runtime-root
[root@localhost ~]# export XDG_RUNTIME_DIR=/tmp/runtime-root
[root@localhost ~]# echo $XDG_RUNTIME_DIR
/tmp/runtime-root

再次运行,没有出现问题:
[root@localhost simpleVulkan]# ./simpleVulkan
GPU Device 0: “Tesla T4” with compute capability 7.5
Average FPS (over 5.11 seconds): 10.37
Average FPS (over 5.22 seconds): 4.79
Average FPS (over 5.01 seconds): 19.35
Average FPS (over 5.12 seconds): 8.99
Average FPS (over 5.01 seconds): 3.79
Average FPS (over 5.01 seconds): 9.98
^C
[root@localhost simpleVulkan]#