Summary:
- Enable openMP option in project properties
- Don't use Visual Studio Express/Standard
- Switch to Release in "Solution Configuration" to use the plug-in (.mll) on other PCs
Detailed explanation:
Writing the code is fairly straightforward (it's not a lot) and the Autodesk Maya API Guide and Reference explain openMP really well. (Check out the splatDeformer devkit example)
Now I will write the steps necessary to get the splatDeformer running (I am using Visual Studio 2008 and Maya 2010, 2011, 2012 all 64bit):
- Open the splatDeformer.sln in the Maya devkit folder (if you copy it somewhere else you have to fix the \lib and \include paths)
- You should be able to compile the solution already. (If not, there is probably something non-openMP related not working)
- It's compiling because openMP is actually disabled by default in the solution and the openMP code is not used. To enable it you have to set splatDeformer: Properties > Configuration Properties > C/C++ > Language > OpenMP Support > Yes (/openmp)
- If you are using the Express or Standard edition of Visual Studio you will get the following error:
fatal error C1083: Cannot open include file: 'omp.h': No such file or directory
- That's because the Express/Standard edition do not support openMP. You can find some tutorials on how to install openMP manually. But I can not confirm that they are working in this case, because I switched to the professional version at my school.
- So with a Visual Studio version, that supports openMP, you should be able to compile the plug-in successfully. And maybe it will work on your PC, but most likely not on other PCs. The error should be:
Error: The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.
- To fix this you have to switch your Visual Studio "Solution Configuration" from Debug to Release. (Note: Release may have different Configuration Properties, so you may have to enable OpenMP Support again and set output file, etc). More experienced Visual Studio users will know this error, because it also happens if you don't use the Release mode and try to load your output file with Maya on another PC (that does not have Visual Studio installed). More information on that point (bug report)
For a more complex deformer example than splatDeformer, that is using openMP, check out my prAttractNode. I noticed an increase in performance of 10-30% from openMP. You can find the open source download link in the Vimeo description of this video:
prAttractNode - deformer (Maya API, plug-in, Python)