First time here? Check out the FAQ!

Ask Your Question
1

Is map_reduce working for parallel computing? How?

asked 5 years ago

updated 5 years ago

The following computation was done on a computer with 16 CPUs.

image description

 sage: seeds = [[]]
....: succ = lambda l: [l+[0], l+[1]] if len(l) <= 22  else []
....: S = RecursivelyEnumeratedSet(seeds, succ,structure='forest', enumeration='depth')
....: map_function = lambda x: 1
....: reduce_function = lambda x,y: x+y
....: reduce_init = 0
....: %time S.map_reduce(map_function, reduce_function, reduce_init)
....:
CPU times: user 15 ms, sys: 47 ms, total: 62 ms
Wall time: 58.4 s
16777215

But it seems that the computation did not exploit the CPUs in parallel, as the following screenshot show.

Question: What's wrong? How to exploit the CPUs in parallel?

image description

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 5 years ago

tmonteil gravatar image

updated 5 years ago

This might be related to trac ticket 24937.

Adding the following before your code should do the work:

import os
os.environ["SAGE_NUM_THREADS"] = '16'
Preview: (hide)
link

Comments

How to use a GPU (for HPC)?

Sébastien Palcoux gravatar imageSébastien Palcoux ( 5 years ago )

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 5 years ago

Seen: 505 times

Last updated: May 30 '19