SERIAL , MUTLI-THREAD , CUDA
Hey guys , whats up?
Long time since last post I know , so much happened in the last months.
I finished my work in Brussels and I moved to London in order to start working as creature TD at Double Negative.
Wooah guys that place is amazing , I love it , I do hope to stay there for a while.
Whit that said other stuff needs to be told.
The MG_tools are no longer available , they are currently used for a bigger project which I cannot tell yet , so thanks for supporting it so far and using it, stay tuned for more news.
Lately I have been interested on the gpu and multi thread computation.
Of course ultimate goal is to be able to write some plugins for maya running on GPU. Unluckily that s not easy at all , there are several reasons for that like :
- GPU memory needs to be cleaned at every run , reason is simple , I am not the only one using the GPU , a lot of computation in the 3d is going to the GPU so I cannot afford to use all the memory for myself , also because GPU memory cannot swap to disc.
- Maya and Cuda fight each other at low-level , what I mean by that? Cuda and Maya implement some data type that fight each other like float4 and such ( I didn’t dig into that much but I will give you more accurate information as soon as I will know more ). This means I cannot copy straight on GPU maya data but need to convert it in basic standard data ( Low performance)
- GPU computing is a HUUUUUUGE world , main problem is not make your algorithm running on gpu , problem is making it going fast , that is not simple at all. I have been watching webinar by nvidia about optimizing and stuff and there is so much to take care about , memory alignment etc.
My first goal was a blendshape running on gpu I wrote already the blendshape node then I will try make it run on GPU.
I am not sure I will get good performance though, as said I would have so much data to convert and copy and gpu and computation is not much at all , then I will need to get it back again and convert it to maya data.
Yes for now all the value I get from maya are MPoint , MVector , MPointArray which as said before I cannot use on the GPU.
I am computing already the delta inside the node so that could be converted into std::vector and should do the trick but I will have to convert again into an MPointArray in order to set the positions out.
Let s get back about my cuda experience .
First problem I faced of course was about compiling … MY NIGHTMARE.
I decided to face the beast so I started working on a standalone program in c++.
I started by compiling with GNU compiler and make file then when I learned better how compiling and linking worked I moved to visual studio because makes everything easier.
The program will be a simple image elaboration program, I will apply some filters on the images.
This simple program gave me a lot of opportunities to learn which are :
- Using Qt , I used for a long time pyqt and lately pyside and always wanted to use Qt c++ .
- Working on image processing is a good way to learn parallelism computing since most of the time you can process every pixel independently .
- I will implement the different filets (for now just grayscale and blur) in different ways :
- - serial computing
- - multi- thread computing
- - GPU computing
For now I was able to set up the VS project create the UI , add some functionality to the UI and apply the first serial processing
For now I implemented only the serial grayscale , It was not that easy as I hoped could be .
I had to google around a lot in order to find an easy way to read in an images.
Initially I thought to use a jpeg then I found this nice BMP lib :
I still have to see if more processing on the data will be needed in order to run on the gpu but we will see.
So this is the result on the current processing :
Nothing fancy , but I am already quite pleased about the result , next will be the implementation on multi thread , I think I will go with OpenMP but I would love to use also TBB by intel.
That s it for now folks !
Let s see how it goes hope to get something done in maya soon!