问题描述:使用pycharm连接服务器运行程序时,可以正常运行。但是使用Termius终端运行时报错(运行时切换到和pycharm相同的路径)。
2024-04-15 14:35:01.663900: I external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:454] Loaded cuDNN version 8902
2024-04-15 14:35:01.747709: I external/local_tsl/tsl/platform/default/subprocess.cc:304] Start cannot spawn child process: No such file or directory
2024-04-15 14:35:01.748957: I external/local_tsl/tsl/platform/default/subprocess.cc:304] Start cannot spawn child process: No such file or directory
2024-04-15 14:35:01.749008: W external/local_xla/xla/stream_executor/gpu/asm_compiler.cc:110] Couldn't get ptxas version : FAILED_PRECONDITION: Couldn't get ptxas/nvlink version string: INTERNAL: Couldn't invoke ptxas --version
2024-04-15 14:35:01.749861: I external/local_tsl/tsl/platform/default/subprocess.cc:304] Start cannot spawn child process: No such file or directory
2024-04-15 14:35:01.749906: W external/local_xla/xla/stream_executor/gpu/redzone_allocator.cc:322] INTERNAL: Failed to launch ptxas
Relying on driver to perform ptx compilation.
Modify $PATH to customize ptxas location.
This message will be only logged once.
2024-04-15 14:35:03.992072: W external/local_tsl/tsl/framework/bfc_allocator.cc:296] Allocator (GPU_0_bfc) ran out of memory trying to allocate 4.66GiB with freed_by_count=0. The caller indicates that this is not a failure, but this may mean that there could be performance gains if more memory were available.
2024-04-15 14:35:04.802350: W external/local_tsl/tsl/framework/bfc_allocator.cc:296] Allocator (GPU_0_bfc) ran out of memory trying to allocate 4.66GiB with freed_by_count=0. The caller indicates that this is not a failure, but this may mean that there could be performance gains if more memory were available.
2024-04-15 14:35:05.606736: W external/local_xla/xla/service/gpu/llvm_gpu_backend/gpu_backend_lib.cc:504] Can't find libdevice directory ${CUDA_DIR}/nvvm/libdevice. This may result in compilation or runtime failures, if the program we try to run uses routines from libdevice.
Searched for CUDA in the following directories:./cuda_sdk_lib/usr/local/cuda-12.2/usr/local/cuda/home/custdev/.local/lib/python3.10/site-packages/tensorflow/python/platform/../../../nvidia/cuda_nvcc/home/custdev/.local/lib/python3.10/site-packages/tensorflow/python/platform/../../../../nvidia/cuda_nvcc.................File "/home/custdev/.local/lib/python3.10/site-packages/keras/src/engine/base_layer.py", line 1149, in __call__File "/home/custdev/.local/lib/python3.10/site-packages/keras/src/utils/traceback_utils.py", line 96, in error_handlerFile "/home/custdev/.local/lib/python3.10/site-packages/keras/src/engine/functional.py", line 515, in callFile "/home/custdev/.local/lib/python3.10/site-packages/keras/src/engine/functional.py", line 672, in _run_internal_graphFile "/home/custdev/.local/lib/python3.10/site-packages/keras/src/utils/traceback_utils.py", line 65, in error_handlerFile "/home/custdev/.local/lib/python3.10/site-packages/keras/src/engine/base_layer.py", line 1149, in __call__File "/home/custdev/.local/lib/python3.10/site-packages/keras/src/utils/traceback_utils.py", line 96, in error_handlerFile "/home/custdev/.local/lib/python3.10/site-packages/keras/src/layers/convolutional/base_conv.py", line 321, in callFile "/home/custdev/.local/lib/python3.10/site-packages/keras/src/activations.py", line 400, in sigmoidFile "/home/custdev/.local/lib/python3.10/site-packages/keras/src/backend.py", line 5915, in sigmoidJIT compilation failed.[[{{node model/conv2d_7/Sigmoid}}]] [Op:__inference_train_function_2045]
查看运行环境时,即使已经切换在目标路径下,但是依旧显示的是总的服务器环境,可是这个环境里边没有我们想要的那些库。
原因是没有真的切换到我们的目标环境下去运行,要在运行命令前加一个 ./ 表示是在当前环境下运行,这时就可以正常运行了。
成功!!!