Is there any possible way to accelerate the python's script execution inside of blender using GPU ?
-
1$\begingroup$ As in execute a CUDA or OpenCL program from Python? $\endgroup$– Fire LancerCommented Aug 13, 2018 at 15:27
-
1$\begingroup$ Well you can install any module if im not mistaken so you could install Tensorflow-gpu therefore you could accelerate the script $\endgroup$– WhatAMeshCommented Aug 13, 2018 at 15:49
-
$\begingroup$ Yes as an execute of cuda $\endgroup$– A bouCommented Aug 13, 2018 at 18:41
-
$\begingroup$ Yes , you can install modules like pycuda , but is it possible to use the utilities of pycuda for example to accelerate the script $\endgroup$– A bouCommented Aug 13, 2018 at 18:47
-
2$\begingroup$ I hate when questions like this are bumped $\endgroup$– WhatAMeshCommented Sep 14, 2018 at 19:53
1 Answer
You should be able to using existing python libraries, such as pycuda, which can be installed into blender's built in python (for installing libs you could setup pip or whatever: How to install Pip for Blender's bundled Python?). You can also link an C/C++ program from your script and do it there.
You will always, however, be limited by the speed in which you can use python to transfer data too and from blender's internal format, so this may or may not provide much speedup depending on your use case.
Gpus can provide a speedup to some kinds of operations. In general, code for that operation needs to be specifically written for use on a gpu to take advantage of it. If you wanted to accelerate existing blender functionality you would have to rewrite it to run on the gpu, you can't just magically tell cpu code to run on the gpu instead.
In general, only tasks with many repetitive, independent, but similar math operations work well on GPUs. Because of these restrictions, GPU code and algorithms are generally more difficult to create than just for the CPU.
-
$\begingroup$ Yeah , I am already familiar with that .But can i use pycuda to speed up for example the split function in blender ? $\endgroup$– A bouCommented Aug 14, 2018 at 13:37