Ask Your Question
1

Is map_reduce working for parallel computing? How?

asked 2019-05-30 13:39:40 +0100

updated 2019-05-30 13:44:28 +0100

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

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2019-05-30 14:26:31 +0100

tmonteil gravatar image

updated 2019-05-30 14:35:13 +0100

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'
edit flag offensive delete link more

Comments

How to use a GPU (for HPC)?

Sébastien Palcoux gravatar imageSébastien Palcoux ( 2019-05-30 22:03:41 +0100 )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

1 follower

Stats

Asked: 2019-05-30 13:39:40 +0100

Seen: 477 times

Last updated: May 30 '19