yusuf
yusuf

Reputation: 3781

Running an app with multicores on ubuntu

I am running an app on ubuntu like the following:

"oni2avi --depth-peng=yes Captured.oni output.avi"

The computer has 47 cores. How can I run this app by using 47 cores without making a change on the code?

Thanks,

Upvotes: 0

Views: 59

Answers (1)

johntellsall
johntellsall

Reputation: 15170

To run a program on many cores, write a simple loop to start up multiple copies of the program.

The next example runs a program which outputs a number, waits one second, then exits:

multiprocessing three commands

for num in {1..3} ; do (echo $num ; sleep 1 ) & done

Output

1
2
3

Linux tends to put different processes on different cores. So for your example, starting the program on 47 cores:

for num in {1..47} ; do (echo $num ; oni2avi --depth-peng=yes Captured.oni output.avi) & done

However: your program won't run 47x faster; it'll the same work 47 times. To make your program run faster, by using multiple cores, you'll have to rewrite the program.

Upvotes: 1

Related Questions