Macha Posted May 24, 2010 Share Posted May 24, 2010 I'm writing a primitive-neighbour-finding script in Python and it's unbearably slow so I had a go at C and it's amazingly faster. At the moment the C code is completely external and uses a *.txt file generated by a Python script. Now that I got the taste for it, can I call that C app from within Houdini? I've read that I need full version of vc8 to work with the HDK, which I don't have. How about calling C from Python. Is that a workable option? Quote Link to comment Share on other sites More sharing options...
petz Posted May 24, 2010 Share Posted May 24, 2010 for using the hdk you need just the vc-compiler which can be downloaded from the microsoft site. its included it the windows sdk. when calling c in python or wrapping modules i would have a look at cython. if you are on windows and python 2.5 you have to go with 32bit or build it for 64bit by your own. for general speedup of python code there is also psyco. again just for 32bit. and if you are not in hurry you can also wait for houdini 10.5. according to the python feature list you can write c++ direct in python and it gets compiled and loaded automatically. this gives you also access to the hdk gu_detail class. hth. petz Quote Link to comment Share on other sites More sharing options...
Macha Posted May 24, 2010 Author Share Posted May 24, 2010 Thanks for the answer Petz. I thought my question was a bit silly at first. I have tried psyco and it's OK but doesn't give anywhere near the performance I gained from pure C. That new c++ feature sounds very very amazing. I can't wait for it! Quote Link to comment Share on other sites More sharing options...
old school Posted May 25, 2010 Share Posted May 25, 2010 If the c app is stand-alone and takes stdin and passes to stdout in bgeo or geo format, you "could" use the Unix SOP for testing. Have a look at it's help. Note that Unix SOP works on all OS'es and not just "Unix". Again a proper first class c++ object would be optimal as was mentioned above. Quote Link to comment Share on other sites More sharing options...
Guest Swann Posted May 25, 2010 Share Posted May 25, 2010 (edited) Ok, is there possibility to use different language than C++ with this unixSOP ? EDIT: Oh wait, it just runs external program and doesn't care about language type, yes ? Edited May 25, 2010 by SWANN Quote Link to comment Share on other sites More sharing options...
old school Posted May 25, 2010 Share Posted May 25, 2010 You can use whatever you want to build the tool: python, c++, c, bash, csh, etc. As long as your stand-alone command-line tool: - can take geo/bgeo geometry as stdin - output geo/bgeo geometry as stdout See the help on the Unix SOP. Quote Link to comment Share on other sites More sharing options...
Guest Swann Posted May 25, 2010 Share Posted May 25, 2010 So what's the advantages of using HDK instead of UnixSOP ? Somebody can have descent tools that can be adapted to use bgeo, and bgeo imports every attributes,groups etc. so he may prefer to not jump into HDK or just simply learn/switch to C++ and use language that he prefers. I'm asking as person who likes Microsoft productes and C# is my language of choice. Not that I have big programming experience but I really like to avoid jumping into C++ that is messy as hell. Quote Link to comment Share on other sites More sharing options...
Guest Swann Posted May 25, 2010 Share Posted May 25, 2010 One advantage is definetely that you can use HDK not only in SOPs, but for SOPs I don't see why somebody should use HDK instead of UnixSOP. Quote Link to comment Share on other sites More sharing options...
TheUsualAlex Posted May 25, 2010 Share Posted May 25, 2010 Well, HDK has the advantage of speed like its native counterparts and as well as doing anything you want. But codes can potentially be difficult to maintain from version to version depends on what you do and the library you use. UnixSOP is definitely far easier because you can use any language of your choice, as long as you can parse the geometry stream. But Unix SOP has overhead, as it is effectively a pipe instead of a native tool. Many many years ago I've seen some long-time Houdini user using Unix SOP to do things outside of Houdini due to certain limitations in Houdini at that time. But these days on a daily production basis, most of what we do can be done in Houdini itself that I hardly see anyone break outside of Houdini to write custom codes (with the exception of some very specific needs and requirements, that is). So I guess your mileage will vary. Unix SOP is a very useful tool when you need it. I guess I just haven't used it in years.... Quote Link to comment Share on other sites More sharing options...
Guest Swann Posted May 25, 2010 Share Posted May 25, 2010 Some great info, another Houdini puzzle to my collection, thanks everyone. Quote Link to comment Share on other sites More sharing options...
Macha Posted June 1, 2010 Author Share Posted June 1, 2010 Does anybody have an example of code that works with with the Unix SOP (on windows), however simple it may be. I want to understand how to get data in and out. A C# example would be welcome but any other language too, perhaps I can work my way through it. Quote Link to comment Share on other sites More sharing options...
edward Posted June 1, 2010 Share Posted June 1, 2010 I've never tried this one myself: http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=7681&highlight=&sid=cd7b5bebe8ff90b58fb6f4948924629a As for some examples ... how about in perl? http://www.sidefx.com/index.php?option=com_mailarchive&Itemid=212&view=WEB&msgid=20011113221503.L14665@sympatico.ca&perpage=20&revdate=off Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.