pokche
pokche

Reputation: 1149

what is the command line argument for running process in multiple cores (linux)

I am trying to run my program in more than one core. I have 12 cores in my desktop and want the computer to use 1,2,3,4,......,11,12 one by one and want to test how the program performs in different number of cores. I tried using -t4 or -t 4 after the executable like.

./a.out -t4 

but I cannot make sure whether its using exactly 4 or not. Can anyone please help me out understand this or point me in right direction.

Upvotes: 0

Views: 1685

Answers (2)

jmf
jmf

Reputation: 1

You should check out the libnuma library.

You can either set which cores you want different threads to run on programmatically or by running it with a command line option. Here's a link to some detailed documentation: http://www.halobates.de/numaapi3.pdf

Upvotes: 0

Intrepidd
Intrepidd

Reputation: 20858

Your program has to be multi-threaded to use several cores of your machines.

This means that the actual code of the program has to be aware of threads and use them efficiently.

You cannot simply ask a program to run on a given number of threads.

You have to use a thread library such as pthread to spawn threads and distribute work over them.

Upvotes: 3

Related Questions