Ask Your Question
0

Run differents scripts in different cpu-cores

asked 2013-08-05 19:28:58 +0200

mresimulator gravatar image

updated 2015-01-14 14:35:46 +0200

FrédéricC gravatar image

Hi experts!

Im a newby user of linux, python and sage.

I have a 4-core CPU (intel i3) and a 2-cores cpu in other laptop (intel atom N2600). I wanna run 6 different sage-scripts simultaneously ussing the 6 cores, i.e.: run one script for cpu-core.

I use Linux mint 13 in one laptop (2 cores-cpu) and Ubuntu 13.04 in the other laptop (4 cores).

How can i do that? (without using @parallel decotertor or other difficult stuff).

Waiting for your answers.

Thanks a lot!!

edit retag flag offensive close merge delete

4 Answers

Sort by » oldest newest most voted
2

answered 2013-08-05 20:20:29 +0200

vdelecroix gravatar image

You can open 6 consoles and launch the scripts. You can also learn how to use bash (one of the language used in console) and launch the process in background using the amperssand &.

Note that @parallel is easier stuff than managing yourself the processors usage.

edit flag offensive delete link more
0

answered 2013-08-23 11:55:43 +0200

vdelecroix gravatar image

A process is not affected to a core. During its life it will switch between them. To control interactively the CPU usage of your processes you may use the console tool "top" or the more fancy "htop". The latter is generally not installed by default on linux distribution.

edit flag offensive delete link more
0

answered 2013-08-23 12:53:29 +0200

johnjohn gravatar image

You can use taskset

But read what it says: "Note that the Linux scheduler also supports natural CPU affinity: the scheduler attempts to keep processes on the same CPU as long as practical for performance reasons"

This means that you don't have to do anything. Just launch 4 scripts on 1 pc and 2 scripts on the other and the kernel will set the affinity as required.

edit flag offensive delete link more
-1

answered 2013-08-05 21:56:06 +0200

mresimulator gravatar image

Thanks for your answer vdelecroix!

Two more things:

  1. How can I do for check that, in effect, the 6 scripts are running in 6 different cores?

  2. Im a really newby user and i wanna know how to integrate @parallel decoretor in my script:

    N=[N1, N2, ..., N20]
    for n in N:
         execute 100 times the algorithm related with 'n'
         append some value (mean of the 100 times executed algorithm) in a output-numpy array LALALA (LALALA(n)))
    

Waiting for your answers.

Thanks a lot

edit flag offensive delete link more

Comments

1

You should use comment instead of writing an answer. Moreover, it is a duplicate of http://ask.sagemath.org/question/2875/parallel-multiple-cores-algorithm

vdelecroix gravatar imagevdelecroix ( 2013-08-05 23:53:22 +0200 )edit

My bad! Any help? Thanks a lot

mresimulator gravatar imagemresimulator ( 2013-08-06 19:11:50 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-08-05 19:28:58 +0200

Seen: 2,972 times

Last updated: Aug 23 '13