Ask Your Question

What are my best options for taking advantage of multiple cores?

asked 2010-08-18 18:06:30 -0500

ccanonc gravatar image

updated 2011-04-28 11:32:57 -0500

Kelvin Li gravatar image

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?

edit retag flag offensive close merge delete

4 answers

Sort by ยป oldest newest most voted

answered 2010-08-18 19:16:57 -0500

William Stein gravatar image

updated 2010-08-18 19:17:13 -0500

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 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, 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.

edit flag offensive delete link more


Thanks very much, these are good answers.

ccanonc gravatar imageccanonc ( 2010-08-18 19:20:05 -0500 )edit

Does Cython have multicore plans? Cython seems very important for custom code.

ccanonc gravatar imageccanonc ( 2010-08-19 06:36:58 -0500 )edit

I 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?)

v_2e gravatar imagev_2e ( 2011-01-29 23:35:16 -0500 )edit

answered 2010-08-18 19:09:48 -0500

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 #9501 and #9631.

edit flag offensive delete link more


Thanks. Thumbs-Up IOU.

ccanonc gravatar imageccanonc ( 2010-08-18 19:14:45 -0500 )edit

answered 2010-08-19 05:50:11 -0500

mvngu gravatar image

You could install parallel Python using your Sage installation and then use functionalities of parallel Python to run some computation that exploits a multi-core system.

edit flag offensive delete link more


What's the command, or set of commands to use different python distros with sage?

ccanonc gravatar imageccanonc ( 2010-08-19 05:59:39 -0500 )edit

answered 2016-08-26 10:12:08 -0500

doom gravatar image

Meanwhile 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

I believe that numba has a more direct link to cublas

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.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools



Asked: 2010-08-18 18:06:30 -0500

Seen: 2,231 times

Last updated: Aug 26 '16