Max Alekseyev on Mon, 14 Oct 2013 04:12:53 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
simple parallelization |
Dear pari-developers, Would it be possible to implement an optional threading that would automatically parallelize execution of any for*/sum*/vector/matrix loops (i.e. all loops with predetermined number of iterations)? I mean something like default( threads, 4 ); vector( 100, i, f(i)); which would run the 'vector' loop in four threads, each with its own value of i and computing its own f(i). Of course, not every loop is parallelizable this way but this feature would be off by default (threads = 1) and the user will take responsibility for code's correctness (independence of iterations, order of output, or whatever other related issues) when threading is on. Moreover, it would be possible to turn threading on and off as needed within a single program. Personally, in many cases I have independent loop iterations that may easily run in parallel (say, on 4 cores) but currently I can do parallezation only either by explicitly by running several PARI/GP's in parallel or by writing C code using pari library and threading, which is rather inconvenient and troublesome. The proposed approach appears to me rather universal and may greatly simplify parallelization with PARI/GP. Regards, Max