parallel processing - Get current job number in makefile -


is there way current job number use in makefile rule?

let me give little context. using tool runs on multiple files. naturally use parallel jobs speed things up. real issue here tool spawns multiple threads , them run in single core - since way faster. did tests , runs faster way.

i need job numer set process affinity cpu core.

there no way "job number" because make doesn't track job number. instances of make in single build share list of identical tokens. when make wants start job obtains token. when make finished job adds token list. if tries token , 1 not available sleep until 1 becomes available. there's no distinguishing characteristic tokens there's no way have "job number".

to learn more how gnu make handles parallel builds, can read http://make.mad-scientist.net/jobserver.html

i'm not quite sure how helps anyway. make doesn't know threads, starts processes. if single process consists of multiple threads, make still think of single job.

edit: assuming in single, non-recursive invocation of make can this:

count :=  %.foo :         $(eval count += x)         @echo "$@: number of rules run $(words $(count))"  all: a.foo b.foo c.foo d.foo 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -