tech-srl / code2vec

TensorFlow code for the neural network presented in the paper: "code2vec: Learning Distributed Representations of Code"
https://code2vec.org
MIT License
1.11k stars 286 forks source link

Error when predicting "Failed to get device properties, error code: 3" #135

Closed lyriccoder closed 3 years ago

lyriccoder commented 3 years ago

Thank you for providing the source code to your paper.

Could you pelase help to solve the issue? When I predict a function name, the model is not responding here (it stucks at the line below):

batch_path_strings, batch_path_target_strings, batch_code_vectors = self.sess.run(
                    [self.predict_top_words_op, self.predict_top_values_op, self.predict_original_names_op,
                     self.attention_weights_op, self.predict_source_string, self.predict_path_string,
                     self.predict_path_target_string, self.predict_code_vectors],
                    feed_dict={self.predict_placeholder: line})

I see that my gpu is visible in tensorflow.

I have the following config: tf=2.0.0 Cuda compilation tools, release 10.0, V10.0.130 cudaNN 7.5

The error is the following:

  0%|          | 0/1 [00:00<?, ?it/s]2021-10-19 15:07:25.494718: E tensorflow/core/grappler/clusters/utils.cc:87] Failed to get device properties, error code: 3
web_1    | 2021-10-19 15:07:26.422131: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10.0
web_1    | 2021-10-19 15:07:26.432147: E tensorflow/stream_executor/cuda/cuda_blas.cc:238] failed to create cublas handle: CUBLAS_STATUS_NOT_INITIALIZED
web_1    | 2021-10-19 15:07:26.432260: E tensorflow/stream_executor/cuda/cuda_blas.cc:238] failed to create cublas handle: CUBLAS_STATUS_NOT_INITIALIZED
web_1    | 2021-10-19 15:07:26.432375: E tensorflow/stream_executor/cuda/cuda_blas.cc:238] failed to create cublas handle: CUBLAS_STATUS_NOT_INITIALIZED

Also, I tried to multiply matrices with tensorflow, it worked correctly with GPU enabled. Any ideas?

Could you please tell me where you set up the GPU device? I cannot find it

urialon commented 3 years ago

Hi @lyriccoder , Thank you for your interest in our work.

If I remember correctly, in TF there is no need to set up the GPU device, it is supposed to be detected automatically.

I don't know why does it say failed to create cublas handle: CUBLAS_STATUS_NOT_INITIALIZED. It looks like a software/drivers version mismatch.

Anyway, I recommend using code2seq instead.

Best, Uri

lyriccoder commented 3 years ago

Thank you very much for help. The problem was in tensorflow, it couldn't find device since it was used it in a separate process. Tensorflow can't work with multiprocess (uwsgi)