I am reading the documentation on how to parallelize recursive-enumeration computations, and I cannot for thenlife of me get RESetMapReduce
to use more than one core of my machine.
I am using the example immediately before the bulleted item titled Generating series on that page, with a minor modification:
sage: from sage.parallel.map_reduce import RESetMapReduce
sage: S = RESetMapReduce(
....: roots=[[]],
....: children=lambda l: [l + [0], l + [1]] if len(l) < 32 else [],
....: map_function=lambda x: 1,
....: reduce_function=lambda x, y: x + y,
....: reduce_init=0)
sage: S.run()
I changed the length to 32 to make the computation heftier. If I run this, I can watch the process with htop
, using only one of my 8 cores to 100%
capacity, but ignoring the others.
I have even tried passing the argument max_proc=8
to the .run()
method, to no effect.