Ask Your Question

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

asked 2010-08-19 01:06:30 +0200

ccanonc gravatar image

updated 2011-04-28 18:32:57 +0200

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-19 02:16:57 +0200

William Stein gravatar image

updated 2010-08-19 02:17:13 +0200

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-19 02:20:05 +0200 )edit

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

ccanonc gravatar imageccanonc ( 2010-08-19 13:36:58 +0200 )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-30 06:35:16 +0200 )edit

answered 2016-08-26 17:12:08 +0200

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

answered 2010-08-19 12:50:11 +0200

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 12:59:39 +0200 )edit

answered 2010-08-19 02:09:48 +0200

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-19 02:14:45 +0200 )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



Asked: 2010-08-19 01:06:30 +0200

Seen: 5,090 times

Last updated: Aug 26 '16