Hi, I have a related question to the topic in
https://github.com/tensorflow/tensorflow/issues/56927
but am using Ubuntu 22.04
After a fresh installation (I was using 18.04 until a cataclysmic event), I seem to be having a similar issue
I am trying to use deepxde with tensorflow backend.
(a lot of what follows is unnecessary background)
I am trying to compile one of their examples and my attention is drawn to the portion where “nvvm” is mentioned.
chaztikov@priority:~/git/deepxde/examples/pinn_forward$ python3 Burgers_RAR.py
Using backend: tensorflow
Enable just-in-time compilation with XLA.
2022-09-10 23:10:14.449892: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2022-09-10 23:10:15.157727: W tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.cc:42] Overriding orig_value setting because the TF_FORCE_GPU_ALLOW_GROWTH environment variable is set. Original config value was 0.
2022-09-10 23:10:15.157784: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1532] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 10113 MB memory: → device: 0, name: NVIDIA GeForce GTX 1080 Ti, pci bus id: 0000:03:00.0, compute capability: 6.1
Compiling model…
‘compile’ took 0.000428 s
Training model…
WARNING:tensorflow:AutoGraph could not transform <function at 0x7f736f697250> and will run it as-is.
Cause: could not parse the source code of <function at 0x7f736f697250>: no matching AST found among candidates:
coding=utf-8
lambda x, on: np.array([on_boundary(x[i], on[i]) for i in range(len(x))])
To silence this warning, decorate the function with @tf.autograph.experimental.do_not_convert
WARNING:tensorflow:AutoGraph could not transform <function at 0x7f736f697490> and will run it as-is.
Cause: could not parse the source code of <function at 0x7f736f697490>: no matching AST found among candidates:
coding=utf-8
lambda x, on: np.array([on_boundary(x[i], on[i]) for i in range(len(x))])
To silence this warning, decorate the function with @tf.autograph.experimental.do_not_convert
2022-09-10 23:10:16.768843: I tensorflow/compiler/xla/service/service.cc:170] XLA service 0x55a2ebd8d3a0 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2022-09-10 23:10:16.768872: I tensorflow/compiler/xla/service/service.cc:178] StreamExecutor device (0): NVIDIA GeForce GTX 1080 Ti, Compute Capability 6.1
2022-09-10 23:10:16.797603: I tensorflow/compiler/mlir/tensorflow/utils/dump_mlir_util.cc:263] disabling MLIR crash reproducer, set env var MLIR_CRASH_REPRODUCER_DIRECTORY
to enable.
2022-09-10 23:10:17.433963: I tensorflow/core/platform/default/subprocess.cc:304] Start cannot spawn child process: No such file or directory
2022-09-10 23:10:17.434943: I tensorflow/core/platform/default/subprocess.cc:304] Start cannot spawn child process: No such file or directory
2022-09-10 23:10:17.434971: W tensorflow/stream_executor/gpu/asm_compiler.cc:80] Couldn’t get ptxas version string: INTERNAL: Couldn’t invoke ptxas --version
2022-09-10 23:10:17.435713: I tensorflow/core/platform/default/subprocess.cc:304] Start cannot spawn child process: No such file or directory
2022-09-10 23:10:17.435784: W tensorflow/stream_executor/gpu/redzone_allocator.cc:314] INTERNAL: Failed to launch ptxas
Relying on driver to perform ptx compilation.
Modify PATHtocustomizeptxaslocation.Thismessagewillbeonlyloggedonce.2022−09−1023:10:17.440252:Itensorflow/core/platform/default/subprocess.cc:304]Startcannotspawnchildprocess:Nosuchfileordirectory2022−09−1023:10:17.440280:Wtensorflow/streamexecutor/gpu/asmcompiler.cc:80]Couldn′tgetptxasversionstring:INTERNAL:Couldn′tinvokeptxas−−version2022−09−1023:10:17.441066:Itensorflow/core/platform/default/subprocess.cc:304]Startcannotspawnchildprocess:Nosuchfileordirectory2022−09−1023:10:17.441134:Wtensorflow/compiler/xla/service/gpu/buffercomparator.cc:640]INTERNAL:FailedtolaunchptxasRelyingondrivertoperformptxcompilation.SettingXLAFLAGS=−−xlagpucudadatadir=/path/to/cudaormodifyingPATHtocustomizeptxaslocation.Thismessagewillbeonlyloggedonce.2022−09−1023:10:17.440252:Itensorflow/core/platform/default/subprocess.cc:304]Startcannotspawnchildprocess:Nosuchfileordirectory2022−09−1023:10:17.440280:Wtensorflow/streamexecutor/gpu/asmcompiler.cc:80]Couldn′tgetptxasversionstring:INTERNAL:Couldn′tinvokeptxas−−version2022−09−1023:10:17.441066:Itensorflow/core/platform/default/subprocess.cc:304]Startcannotspawnchildprocess:Nosuchfileordirectory2022−09−1023:10:17.441134:Wtensorflow/compiler/xla/service/gpu/buffercomparator.cc:640]INTERNAL:FailedtolaunchptxasRelyingondrivertoperformptxcompilation.SettingXLAFLAGS=−−xlagpucudadatadir=/path/to/cudaormodifyingPATH can be used to set the location of ptxas
This message will only be logged once.
2022-09-10 23:10:17.534116: W tensorflow/compiler/xla/service/gpu/nvptx_helper.cc:56] 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-11.2
/usr/local/cuda
.
You can choose the search directory by setting xla_gpu_cuda_data_dir in HloModule’s DebugOptions. For most apps, setting the environment variable XLA_FLAGS=–xla_gpu_cuda_data_dir=/path/to/cuda will work.
2022-09-10 23:10:17.721031: I tensorflow/core/platform/default/subprocess.cc:304] Start cannot spawn child process: No such file or directory
2022-09-10 23:10:17.721072: W tensorflow/stream_executor/gpu/asm_compiler.cc:80] Couldn’t get ptxas version string: INTERNAL: Couldn’t invoke ptxas --version
2022-09-10 23:10:17.721699: I tensorflow/core/platform/default/subprocess.cc:304] Start cannot spawn child process: No such file or directory
2022-09-10 23:10:17.722104: F tensorflow/compiler/xla/service/gpu/nvptx_compiler.cc:456] ptxas returned an error during compilation of ptx to sass: ‘INTERNAL: Failed to launch ptxas’ If the error message indicates that a file could not be written, please verify that sufficient filesystem space is provided.
Aborted (core dumped)
chaztikov@priority:/git/deepxde/examples/pinn_forwardCO/git/deepxde/examples/pinn_forwardCO
COLORTERMCOLORTERMCOLUMNS $COMP_WORDBREAKS
chaztikov@priority:
COLORTERMCOLORTERMCOLUMNS COMPWORDBREAKSchaztikov@priority: /git/deepxde/examples/pinnforwardCOMPWORDBREAKSchaztikov@priority: /git/deepxde/examples/pinnforward COCOCOLORTERM COLUMNSCOLUMNSCOMP_WORDBREAKS
I did not “conda init bashrc” because I found that doing so interfered with an otherwise successful installation of nvidia cuda cudatoolkit etc.
(though I am afraid to break anything, I welcome suggestions on this point and on all points)
I see that I do have nvvm as indicated below
chaztikov@priority:/git/deepxde/examples/pinn_forward$ locate /nvvm/libdevice/git/deepxde/examples/pinn_forward$
/home/chaztikov/anaconda3/nvvm/libdevice
/home/chaztikov/anaconda3/nvvm/libdevice/libdevice.10.bc
/home/chaztikov/anaconda3/pkgs/cuda-nvcc-11.7.99-0/nvvm/libdevice
/home/chaztikov/anaconda3/pkgs/cuda-nvcc-11.7.99-0/nvvm/libdevice/libdevice.10.bc
chaztikov@priority:
so I will set in ~/.bashrc
export CUDA_DIR=“/home/chaztikov/anaconda3/pkgs/cuda-nvcc-11.7.99-0/”
I tried the above, and it didn’t work, still getting the same error message,
Note: before and after that change (export CUDA_DIR etc) to my ~/.bashrc, I still seem to have tensorflow locating the GPU.
chaztikov@priority:~/git/deepxde/examples/pinn_forward$ python3
Python 3.10.4 (main, Jun 29 2022, 12:14:53) [GCC 11.2.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.
import tensorflow
tensorflow.device(‘GPU’)
2022-09-11 21:07:57.423925: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2022-09-11 21:07:57.966877: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1532] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 9858 MB memory: → device: 0, name: NVIDIA GeForce GTX 1080 Ti, pci bus id: 0000:03:00.0, compute capability: 6.1
<tensorflow.python.eager.context._EagerDeviceContext object at 0x7fbd3557d9c0>
torch also seems to work as a side note
chaztikov@priority:~/git/deepxde/examples/pinn_forward$ python3
Python 3.10.4 (main, Jun 29 2022, 12:14:53) [GCC 11.2.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.
import torch;torch.cuda.is_available()
True
EDIT: I re-read the output when importing tensorflow, is this indicating that the GPU is found but somehow not using the GPU? It doesn’t seem that way, it seems to be indicating that tensorflow was compiled on my system without the proper optimization flags.