2022-07-14 03:20:04 +0100 | received badge | ● Popular Question (source) |

2021-04-24 17:28:31 +0100 | received badge | ● Famous Question (source) |

2021-04-24 17:28:31 +0100 | received badge | ● Notable Question (source) |

2020-11-26 13:04:04 +0100 | received badge | ● Popular Question (source) |

2020-05-27 04:36:10 +0100 | commented answer | Python MultiProcessing module stuck for long outputs Thank you for your answer! Now I have found that someone had the same problem with Python. [https://stackoverflow.com/questions/3...] |

2020-05-27 04:31:50 +0100 | received badge | ● Supporter (source) |

2020-05-27 04:31:48 +0100 | received badge | ● Scholar (source) |

2020-05-26 16:39:05 +0100 | commented question | Python MultiProcessing module stuck for long outputs @tmonteil Thank you for your suggestion. I have attached my code with an example. |

2020-05-26 16:38:06 +0100 | received badge | ● Editor (source) |

2020-05-24 15:38:40 +0100 | asked a question | Python MultiProcessing module stuck for long outputs I am using SageMath 9.0 and I tried to do paralle computation in two ways 1) parallel decoration built in SageMath; 2) the MultiProcessing module of Python. When using paralell decoration, everything works fine. When using MultiProcessing module for the same problem with the same input, everything works fine for short output, but there is a problem when the output is long. SageMath gets stuck after the computation if the output is long. I monitored the CPU usage, it peaks at first and then returns to zero, which means that the computation is complete. However, the output still does not appear. What puzzles me is that the problem depends on the length of output, not the time of computation. For the same computation, once I add a line to manually set the output to be something short, or extract a small part of the original output, then the computation no longer gets stck in the end, and that small part agrees with the original answer. I would like to know if there is any hidden parameter to prevent the Python MultiProcessing module from producing long outputs in Sagemath. P.S. Following the suggestion of @tmonteil, I attached my code with an example. On my computer, the command works fine but the command gets stuck. On the other hand, the command works fine. Note that the function g does strictly more jobs than f, but its answers are much shorter. |

2020-02-21 13:58:13 +0100 | received badge | ● Student (source) |

2020-02-21 13:15:35 +0100 | asked a question | Parallel computation for different functions For a single function with a list of inputs, the @parallel decoration can be used to do parallel computation. I am wandering whether it is possible to do parallel computation for different functions. A simple is example is to calculate the difference f-g of two independent functions f and g. How can I ask SageMath to simultaneously compute the values of f and g, and then calculate the difference? My time measurements suggest that when calculating the difference f-g, SageMath actually calculates f and g one after another, and then take the difference. I can think of a naive approach using the @parallel decoration. I can create a function whose input variable is the name of the functions I want to compute simultaneously. Then I use a list of function names as input to get a generator of outputs. This may work if the final result doesn't depend on the order of the outputs, but does not work if the order matters, for example when taking the difference. In general, suppose I have a flow chart for the computation, in other words, I already know which jobs can be parallelized and how the information flows to the next stage. Then what is the best way to implement the flow chart? |

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.