Jump to content
Flavien

GPU

Recommended Posts

Hi,

 

I have a Python script that trains a TensorFlow model. Python is installed in a Conda environment.

 

When the Python script is run from a command prompt, the model is trained on GPU. But when the script is run from Delphi PythonEngine, the model is trained on CPU instead.

 

Would anyone has an idea why I am not able to use GPU with Python4Delphi?

 

Thanks.

Share this post


Link to post

the first thing that comes to mind is that some configuration settings are "lost" due to the fact that the current directory may be different

(or some logic related to this is broken)

 

also check this: https://www.tensorflow.org/guide/gpu

you can do some diagnostic this way

Edited by KoRiF

Share this post


Link to post

Process monitor from Sysinternals is your friend here. Trace the startup and see where the file is not found.

 

Python at the command prompt is built with vcruntime, and Delphi does not. Put a copy of msvcp140.dll and vcruntime140_1.dll in the directory that has your EXE and then see if works correctly.

Share this post


Link to post

Thank you for your advice.

 

Despite using the same working directory, TensorFlow is indeed loading CUDA DLLs from a different location with Python4Delphi.

Share this post


Link to post
On 8/12/2022 at 11:14 PM, Flavien said:

Thank you for your advice.

 

Despite using the same working directory, TensorFlow is indeed loading CUDA DLLs from a different location with Python4Delphi.

i met a same problem like yours , have you fix it?

Share this post


Link to post

The wrong DLLs have been uninstalled from the computer so Delphi can only find the right ones and training is now performed on GPU.

But if you need both DLLs, I guess you can fix it by modifying the order of the search path.

Share this post


Link to post
32 minutes ago, Flavien said:

The wrong DLLs have been uninstalled from the computer so Delphi can only find the right ones and training is now performed on GPU.

But if you need both DLLs, I guess you can fix it by modifying the order of the search path.

i fix it, due to a wrong version has been installed. 😞

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×