ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 26 Aug 2016 10:12:08 -0500What are my best options for taking advantage of multiple cores?https://ask.sagemath.org/question/7578/what-are-my-best-options-for-taking-advantage-of-multiple-cores/What are my best options for taking advantage of multiple cores?
For the pure python case?
For working with sets of particular libraries which sage interfaces?
Note: Apple just started offering 12-core mac-pros (24 virtual cpus with hyper-threading). Since the transistors are getting about as small as they can, parallel computing is impacting the entire technology stack. Please note I'm not asking how to categorize algorithms, I'm aware that some naturally parallelize better than others. This is a recipes/examples question.
Does Sage already comprehensively address this, and if not, does the Sage roadmap address it?Wed, 18 Aug 2010 18:06:30 -0500https://ask.sagemath.org/question/7578/what-are-my-best-options-for-taking-advantage-of-multiple-cores/Answer by Dan Drake for <p>What are my best options for taking advantage of multiple cores?</p>
<p>For the pure python case?</p>
<p>For working with sets of particular libraries which sage interfaces?</p>
<p>Note: Apple just started offering 12-core mac-pros (24 virtual cpus with hyper-threading). Since the transistors are getting about as small as they can, parallel computing is impacting the entire technology stack. Please note I'm not asking how to categorize algorithms, I'm aware that some naturally parallelize better than others. This is a recipes/examples question.</p>
<p>Does Sage already comprehensively address this, and if not, does the Sage roadmap address it?</p>
https://ask.sagemath.org/question/7578/what-are-my-best-options-for-taking-advantage-of-multiple-cores/?answer=11393#post-id-11393As a start, check out the @parallel decorator, and the @fork decorator (which I think is not yet in Sage; it was briefly merged on the way to 4.5.2, and then pulled because of doctest failures); see [#9501](http://trac.sagemath.org/sage_trac/ticket/9501) and [#9631](http://trac.sagemath.org/sage_trac/ticket/9631).Wed, 18 Aug 2010 19:09:48 -0500https://ask.sagemath.org/question/7578/what-are-my-best-options-for-taking-advantage-of-multiple-cores/?answer=11393#post-id-11393Comment by ccanonc for <p>As a start, check out the @parallel decorator, and the @fork decorator (which I think is not yet in Sage; it was briefly merged on the way to 4.5.2, and then pulled because of doctest failures); see <a href="http://trac.sagemath.org/sage_trac/ticket/9501">#9501</a> and <a href="http://trac.sagemath.org/sage_trac/ticket/9631">#9631</a>.</p>
https://ask.sagemath.org/question/7578/what-are-my-best-options-for-taking-advantage-of-multiple-cores/?comment=23082#post-id-23082Thanks. Thumbs-Up IOU.Wed, 18 Aug 2010 19:14:45 -0500https://ask.sagemath.org/question/7578/what-are-my-best-options-for-taking-advantage-of-multiple-cores/?comment=23082#post-id-23082Answer by William Stein for <p>What are my best options for taking advantage of multiple cores?</p>
<p>For the pure python case?</p>
<p>For working with sets of particular libraries which sage interfaces?</p>
<p>Note: Apple just started offering 12-core mac-pros (24 virtual cpus with hyper-threading). Since the transistors are getting about as small as they can, parallel computing is impacting the entire technology stack. Please note I'm not asking how to categorize algorithms, I'm aware that some naturally parallelize better than others. This is a recipes/examples question.</p>
<p>Does Sage already comprehensively address this, and if not, does the Sage roadmap address it?</p>
https://ask.sagemath.org/question/7578/what-are-my-best-options-for-taking-advantage-of-multiple-cores/?answer=11394#post-id-11394> Does Sage already comprehensively address this, and if not,
Sage certainly doesn't comprehensively address this -- in fact, parallel techniques are only used a tiny bit.
> does the Sage roadmap address it?
The Sage roadmap, such as it is, doesn't address parallel computing.
> This is a recipes/examples question.
1. Type
sage: parallel?
2. Check out the [multiprocessing module][1] in Python but watch out -- sometimes you really have to understand how certain things in Sage works to safely use it.
3. Learn about [mpi4py][2], if you are really, really serious about fine-grained parallel computing.
4. Try out David Harvey's multithreaded bernoulli number code. Type bernoulli? for details.
[1]: http://docs.python.org/library/multiprocessing.html
[2]: http://code.google.com/p/mpi4py/Wed, 18 Aug 2010 19:16:57 -0500https://ask.sagemath.org/question/7578/what-are-my-best-options-for-taking-advantage-of-multiple-cores/?answer=11394#post-id-11394Comment by ccanonc for <blockquote>
<p>Does Sage already comprehensively address this, and if not, </p>
</blockquote>
<p>Sage certainly doesn't comprehensively address this -- in fact, parallel techniques are only used a tiny bit. </p>
<blockquote>
<p>does the Sage roadmap address it?</p>
</blockquote>
<p>The Sage roadmap, such as it is, doesn't address parallel computing. </p>
<blockquote>
<p>This is a recipes/examples question.</p>
</blockquote>
<ol>
<li><p>Type </p>
<p>sage: parallel?</p></li>
<li><p>Check out the <a href="http://docs.python.org/library/multiprocessing.html">multiprocessing module</a> in Python but watch out -- sometimes you really have to understand how certain things in Sage works to safely use it. </p></li>
<li><p>Learn about <a href="http://code.google.com/p/mpi4py/">mpi4py</a>, if you are really, really serious about fine-grained parallel computing.</p></li>
<li><p>Try out David Harvey's multithreaded bernoulli number code. Type bernoulli? for details. </p></li>
</ol>
https://ask.sagemath.org/question/7578/what-are-my-best-options-for-taking-advantage-of-multiple-cores/?comment=23075#post-id-23075Does Cython have multicore plans? Cython seems very important for custom code.Thu, 19 Aug 2010 06:36:58 -0500https://ask.sagemath.org/question/7578/what-are-my-best-options-for-taking-advantage-of-multiple-cores/?comment=23075#post-id-23075Comment by v_2e for <blockquote>
<p>Does Sage already comprehensively address this, and if not, </p>
</blockquote>
<p>Sage certainly doesn't comprehensively address this -- in fact, parallel techniques are only used a tiny bit. </p>
<blockquote>
<p>does the Sage roadmap address it?</p>
</blockquote>
<p>The Sage roadmap, such as it is, doesn't address parallel computing. </p>
<blockquote>
<p>This is a recipes/examples question.</p>
</blockquote>
<ol>
<li><p>Type </p>
<p>sage: parallel?</p></li>
<li><p>Check out the <a href="http://docs.python.org/library/multiprocessing.html">multiprocessing module</a> in Python but watch out -- sometimes you really have to understand how certain things in Sage works to safely use it. </p></li>
<li><p>Learn about <a href="http://code.google.com/p/mpi4py/">mpi4py</a>, if you are really, really serious about fine-grained parallel computing.</p></li>
<li><p>Try out David Harvey's multithreaded bernoulli number code. Type bernoulli? for details. </p></li>
</ol>
https://ask.sagemath.org/question/7578/what-are-my-best-options-for-taking-advantage-of-multiple-cores/?comment=22214#post-id-22214I have searched the "python parallel programming" string in Google and it gives the links to several different libraries and approaches to parallelization in python programs. But I would like to know if there is a preferred way of parallelizing the Sage scripts and whether Sage will provide such functionality out-of-the-box some day? (or maybe Python itself will?)Sat, 29 Jan 2011 23:35:16 -0600https://ask.sagemath.org/question/7578/what-are-my-best-options-for-taking-advantage-of-multiple-cores/?comment=22214#post-id-22214Comment by ccanonc for <blockquote>
<p>Does Sage already comprehensively address this, and if not, </p>
</blockquote>
<p>Sage certainly doesn't comprehensively address this -- in fact, parallel techniques are only used a tiny bit. </p>
<blockquote>
<p>does the Sage roadmap address it?</p>
</blockquote>
<p>The Sage roadmap, such as it is, doesn't address parallel computing. </p>
<blockquote>
<p>This is a recipes/examples question.</p>
</blockquote>
<ol>
<li><p>Type </p>
<p>sage: parallel?</p></li>
<li><p>Check out the <a href="http://docs.python.org/library/multiprocessing.html">multiprocessing module</a> in Python but watch out -- sometimes you really have to understand how certain things in Sage works to safely use it. </p></li>
<li><p>Learn about <a href="http://code.google.com/p/mpi4py/">mpi4py</a>, if you are really, really serious about fine-grained parallel computing.</p></li>
<li><p>Try out David Harvey's multithreaded bernoulli number code. Type bernoulli? for details. </p></li>
</ol>
https://ask.sagemath.org/question/7578/what-are-my-best-options-for-taking-advantage-of-multiple-cores/?comment=23081#post-id-23081Thanks very much, these are good answers.Wed, 18 Aug 2010 19:20:05 -0500https://ask.sagemath.org/question/7578/what-are-my-best-options-for-taking-advantage-of-multiple-cores/?comment=23081#post-id-23081Answer by doom for <p>What are my best options for taking advantage of multiple cores?</p>
<p>For the pure python case?</p>
<p>For working with sets of particular libraries which sage interfaces?</p>
<p>Note: Apple just started offering 12-core mac-pros (24 virtual cpus with hyper-threading). Since the transistors are getting about as small as they can, parallel computing is impacting the entire technology stack. Please note I'm not asking how to categorize algorithms, I'm aware that some naturally parallelize better than others. This is a recipes/examples question.</p>
<p>Does Sage already comprehensively address this, and if not, does the Sage roadmap address it?</p>
https://ask.sagemath.org/question/7578/what-are-my-best-options-for-taking-advantage-of-multiple-cores/?answer=34596#post-id-34596Meanwhile your high end gaming GPU might have 1500 cores in it. NVIDIA has a pretty good blas library that runs on their gpu's using CUDA. You can get access to CUDA through PyCuda
https://mathema.tician.de/software/pycuda/
I believe that numba has a more direct link to cublas
http://numba.pydata.org/
Of course this is for numerics. Wouldn't it be nice to write some opencl or cuda backends for some of the symbolic processing? I'd have to think that theorem proving or term rewriting is embarrassingly parallel based on the pure combinatorial searches that it entails.Fri, 26 Aug 2016 10:12:08 -0500https://ask.sagemath.org/question/7578/what-are-my-best-options-for-taking-advantage-of-multiple-cores/?answer=34596#post-id-34596Answer by mvngu for <p>What are my best options for taking advantage of multiple cores?</p>
<p>For the pure python case?</p>
<p>For working with sets of particular libraries which sage interfaces?</p>
<p>Note: Apple just started offering 12-core mac-pros (24 virtual cpus with hyper-threading). Since the transistors are getting about as small as they can, parallel computing is impacting the entire technology stack. Please note I'm not asking how to categorize algorithms, I'm aware that some naturally parallelize better than others. This is a recipes/examples question.</p>
<p>Does Sage already comprehensively address this, and if not, does the Sage roadmap address it?</p>
https://ask.sagemath.org/question/7578/what-are-my-best-options-for-taking-advantage-of-multiple-cores/?answer=11421#post-id-11421You could install [parallel Python][1] using your Sage installation and then use functionalities of parallel Python to run some computation that exploits a multi-core system.
[1]: http://www.parallelpython.com/Thu, 19 Aug 2010 05:50:11 -0500https://ask.sagemath.org/question/7578/what-are-my-best-options-for-taking-advantage-of-multiple-cores/?answer=11421#post-id-11421Comment by ccanonc for <p>You could install <a href="http://www.parallelpython.com/">parallel Python</a> using your Sage installation and then use functionalities of parallel Python to run some computation that exploits a multi-core system.</p>
https://ask.sagemath.org/question/7578/what-are-my-best-options-for-taking-advantage-of-multiple-cores/?comment=23076#post-id-23076What's the command, or set of commands to use different python distros with sage?Thu, 19 Aug 2010 05:59:39 -0500https://ask.sagemath.org/question/7578/what-are-my-best-options-for-taking-advantage-of-multiple-cores/?comment=23076#post-id-23076