Is it possible to use cmake implement multi-core? - cmake

I am working on some cv algorithm code which is very computationally expensive. And the original code is not applied the multi-core or multi-threads tech. Is it possible to use cmake to recompile it and make it able to use multi-core?
Kind Regards,
Patrick

Related

Alternatives for Using MATLAB Files and Deploying Them into DLL's

I have some source code for the BaNa Noise Resilient Pitch Detection Algorithm downloaded here, and I am planning to use the code they provided as a library for a mobile app I'm making. It's written in Objective-C for MATLAB and so I'd probably need to deploy it to a DLL to be able to use it for external applications.
The only thing is that I'm a student, and I don't really have the funds to purchase MATLAB just to be able to work with this algorithm, and so I'm downloading Octave, which was a suggested alternative. This should be able to make working and editing the code for my research possible, but my concern is if I can deploy the code into usable libraries for the application in which I'm going to make using the Unity Game Engine.
I'm not sure if the direction I'm going at will bring me to a dead-end or not, so I'd like to ask for insights regarding this.
What I have now:
1) Source code in MATLAB (.m files)
2) Octave (currently downloading, I'm not even sure if it has the built-in methods I need)
What I plan to do:
1) Use Octave to edit code and test out if the code I have works
2) Deploy it to a DLL file (Is this even possible with Octave?)
3) Use that DLL in Unity3D
Would you guys have any suggestions, alternative workarounds, or foreseeable problems I may encounter with this? Any advice would be greatly appreciated.
Thank you in advance,
Justin
Depending on what functionality from MATLAB (and especially toolboxes), the code should run just fine in Octave, maybe with some minor modifications. If however, the code relies heavily on some toolbox functionality that has not been implemented in Octave, then you have a fair amount of recoding to do.
There is not easy way that I know of to generate a DLL from Octave. Having said that, have a look at How do I create a simple Octave distributable without installing Octave and this section of the Octave documentation on the subject of generating standalone programs from Octave, it might point you in the right direction.

plotting robot path

I am writing code for rrt(rapidly exploring random trees) which is a sampling based motion planning algorithm.I wrote the code in MATLAB but now i am writing it in c++.
I want to know how can we plot the robot path in real time with all the obstacles.
What I want is this: I want to see my robot traversing the space.So basically it's about the graphics.I am trying to use sfml but I am having problems with it.Some people suggested using opencv or opengl but I think they are not easy to use.I am looking for a simple to use library.
If opencv or opengl is the answer then please tell me what specifically i need to use in these libraries.I am working on linux(ubuntu 11.10)
You might want too look into using the internal matlab compiler for generating a standalone application directly from your M-code. That way you don't have to rewrite everything form scratch.
I have used the following link a couple of times just to refresh my memory
http://technologyinterface.nmsu.edu/5_1/5_1f/5_1f.html
Eg if you have made an M function with the following content(Example from link):
function y=PolyValue(poly,x)
poly=[1 2 -1 4 -5];
x=[5, 6];
y=polyval(poly, x)
you could use the command
mcc -m PolyValue
to compile the program.
This command would then give you the files necessary for implementation in a larger c++ program.
It should even support Gui elements and graphs.
Something like http://www.ros.org/news/2011/01/open-motion-planning-library-ompl-released.html
may be what you are looking for.
I've worked in both OpenCV for some image recognition projects and OpenGL for rendering displays and whether you go with a library like above or render it yourself is really up to how complex the display needs to be. Ask yourself some questions about how many different obstacle scenarios you are looking at. Are there a large multitude of possible shapes for the obstacles and the robot? Is the problem deterministic (in terms of both the robot's movement and the environment)?
In terms of OpenGL and OpenCV being not easy to use for those new to them, this is very much the case, but choosing to work in C++ makes the problem more difficult for beginners. As another user has mentioned, wrapping your Matlab code instead of throwing it away may be a viable option. Even running the matlab engine in the background to run your scripts through C++ may be viable, if speed is not a critical factor. See http://au.mathworks.com/help/matlab/matlab_external/introducing-matlab-engine.html for more information.

Decompiling Objective-C libraries

I've just finished a library in Objective-C that I compiled as a Static Library for distribution.
I'd wanted to know what chances to get this decompiled are out there.
Do you know any software that can do this?
If so, how could I protect me better?
EDIT: My static lib is made for iPhone / ARM
I created an algorithm that depending on the some parameters of the app, it can run as demo or as full code. You init the object with X variables and unlock the full version. I was wondering if they'll be able to see this algorithm so they can create a key generator.
If it executes, it can be decompiled. Objective-C is particularly easy to decompile into readable code thanks to its dynamic features. If you want to make things a little bit harder, you could write most of your code in plain C and strip the executable — which of course has the tradeoff of making your application design harder to manage. But be honest with yourself: If somebody wants to crack your code, you are not going to be able to stop them. Crackers have practically unlimited amounts of time and enthusiasm and will actually be excited by any novel efforts you put in to stop them. Nobody has yet made uncrackable software, and the biggest corporations in the world have tried. You're not going to do better than them, especially if you need to ask about it on Stack Overflow.
Take the time that you would have put into thwarting decompilation and use it to make your product better — that will have a much better ROI.
It's not clear what you are trying to protect yourself from. Yes, it can be reverse engineered. The simplest tool is otool, part of the standard developer distribution:
otool -tV <library>
From that they run up to things like IDA Pro, which has iPhone support and is very nice for this kind of work. In between, I'm really surprised that I haven't seen a rework of otx for iPhone/ARM yet. I wouldn't be surprised to see one show up eventually. And of course there's gdb if you're trying to work out how things flow and what the data is at various points.
If you have more details about what you're trying to protect yourself from, there may be some targeted answers. Beyond that, read Chuck's comments.
ChanceGetsDecompiled = ExpectedGainFromBeingDecompiled / PopularityOfLibrary
Well if you REALLY want to know I would try decompiling it your self. You don't say if this is for PPC, Intel, or ARM which makes a difference. Here is a decompiler for Intel
i386 Decompiler
I don't know what you could do (I don't think there is much) to limit this. Code can always be reverse engineered. Be happy that your not using java or .net. Their decompilation is so nice.

What is a good VM for developing a hobby language?

I'm thinking about writing my own little language.
I found a few options, but feel free to suggest more.
JVM
Parrot
OSA
A lot of languages are using the JVM, but unless you write a Java-ish language, all the power the stdlib gives you is going to feel ugly; It's not very good at dynamic stuff either.
Parrot seems a good VM for developing languages, but it has a little abandoned/unfinished/hobby project smell to it.
OSA is what powers Applescript, not a particularly well known VM, but I use Mac, and it offers good system integration.
CLR+Mac doesn't seem a good combination...
My language is going to be an object orientated functional concurrent dataflow language with strong typing and a mix of Python and Lisp syntax.
Sounds good, eh?
[edit]
I accepted Python for now, but I'd like to hear more about OSA and Parrot.
One approach I've played with is to use the Python ast module to build an abstract syntax tree representing the code to run. The Python compile function can compile an AST into Python bytecode, which exec can then run. This is a bit higher level than directly generating bytecode, but you will have to deal with some quirks of the Python language (for example, the fundamental difference between statements and expressions).
In doing this I've also written a "deparse" module that attempts to convert an AST back to equivalent Python source code, just for debugging. You can find code in the psil repository if you're interested.
Have a look at LLVM. It's not a pure VM as such, more a framework with it's own IR that allows you to build high level VMs. Has nice stuff like static code analysis and JIT support
Lua has a small, well-written and fast VM
Python VM - you can really attach a new language to it if you want. Or write (use?) something like tinypy which is a small and simple implementation of the Python VM.
Both options above have access to useful standard libraries that will save you work, and are coded in relatively clean and modular C, so they shouldn't be hard to connect to.
That said, I disagree that Parrot is abandoned/hobby. It's quite mature, and has some very strong developers working on it. Furthermore, it's specifically a VM designed to be targeted by multiple dynamic languages. Thus, is was designed with flexibility in mind.
Have you considered Pypy? From what I've read, in addition to being a Python JIT Compiler, it also has the capability to handle other languages. For example there is a tutorial which explains how to create a Brainfuck JIT compiler using Pypy.

Improved Perlin Noise module for Lua

I need Improved Perlin Noise in my Lua code.
Are there any decent open-source Lua C modules available?
Or is there any nice C library that I can write a wrapper for (perhaps with other noise functions)?
I know that it is not hard to write one myself (reference code in Java is trivial to port), but I do not want to reinvent the wheel here.
Ah, well, I'll have to roll my own then: http://github.com/agladysh/lua-noise/