Post Reply 
Best programming language for handling array calculations in parallel?
04-18-2019, 03:00 AM
Post: #1
Best programming language for handling array calculations in parallel?
I have some experience in just about every major programming language.

I built some software in python for fun, but I want to now take the project in a more serious direction.

Basically, the program does calculations on what is essentially a 100x7 array (100 rows x 7 columns). I want to speed up the python code significantly. I was thinking of rewriting it in FORTRAN using GPU acceleration for parallel calculation (like CUDA cores on my NVIDIA GPU).

I have never done parallel programming. Basically, my program does math on this 100x7 array (100 rows x 7 columns) and not much else.

I want the fastest possible way to do calculations, would running FORTRAN with GPU support be the fastest way to do this?

My code is already very fast in python, but I want to speed it up more.
Find all posts by this user
Quote this message in a reply
04-18-2019, 02:58 PM
Post: #2
RE: Best programming language for handling array calculations in parallel?
I am going to guess Matlab with the Parallel processing toolbox:
https://www.mathworks.com/products/paral...uting.html
Find all posts by this user
Quote this message in a reply
04-18-2019, 03:57 PM
Post: #3
RE: Best programming language for handling array calculations in parallel?
There are Python packages for parallel processing including GPU acceleration but I have no experience with them. May be worth a try before you switch languages.

Also some matrix operations are much easier to parallelize than others so the amount of speedup you will get depends strongly on the nature of the calculations.
Find all posts by this user
Quote this message in a reply
04-18-2019, 07:00 PM
Post: #4
RE: Best programming language for handling array calculations in parallel?
"Basically, my program does math on this 100x7 array (100 rows x 7 columns) and not much else."

what does it do? We may take it as input to push our calculators, you know it may be fun!

(Although a 100x7 matrix on the 50g can already take some time)

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
04-18-2019, 07:36 PM
Post: #5
RE: Best programming language for handling array calculations in parallel?
I'm guessing that if the OP is finding Python on (presumably) a PC to be too slow, a calculator isn't going to cut it. Smile OTOH, since we are talking about non-square matrices it might be beneficial to write custom code to solve the problem(s) rather than using standard linear algebra packages etc.

Further speculation would be pointless without further information.
Find all posts by this user
Quote this message in a reply
04-20-2019, 01:59 AM
Post: #6
RE: Best programming language for handling array calculations in parallel?
Each matrix location will only have basic math applied to it +-*/.

Is there any website that benchmarks parallel performance and compares languages?

In python it takes about 2 to 3 minutes for my program to run, I'd like to speed this up considerably by moving to a language that is focused on matrix math as well is compatible with parallel GPU computation. I do not know much about parallel computing at the moment, from what I have seen it is not much more difficult than regular programming you just have to learn it.

My code base isn't even quite 2000 lines of code yet, so rewriting in a better language would be bothersome but not impossible. It has high-level science and engineering ideas in it, but most of the thinking for those parts of the code has already been done in python and would only need to be converted to whichever language I chose next.

Maybe for fun, I would port this code to the DM42, but it would likely take a very long time to run.
Find all posts by this user
Quote this message in a reply
04-20-2019, 10:39 AM
Post: #7
RE: Best programming language for handling array calculations in parallel?
APL anyone?
Find all posts by this user
Quote this message in a reply
04-20-2019, 12:29 PM
Post: #8
RE: Best programming language for handling array calculations in parallel?
(04-20-2019 10:39 AM)Paul Dale Wrote:  APL anyone?
Agreed that APL is ideal for parallelism.
I have not touched APL for more than 30 years, but as far as I know, it is normally implemented in a interpreter and thus slower than compiled code.
Find all posts by this user
Quote this message in a reply
04-20-2019, 02:48 PM
Post: #9
RE: Best programming language for handling array calculations in parallel?
(04-20-2019 12:29 PM)Sylvain Cote Wrote:  Agreed that APL is ideal for parallelism.
I have not touched APL for more than 30 years, but as far as I know, it is normally implemented in a interpreter and thus slower than compiled code.

Common misconception. See The Interpretive Advantage
https://tv.dyalog.com/Dyalog18/?v=-6no6N3i9Tg

There's a good reason the only data structure APL supports is the array. See Rectangles All The Way Down
https://tv.dyalog.com/Dyalog18/?v=mK2WUDIY4hk

Who decides?
Find all posts by this user
Quote this message in a reply
04-20-2019, 09:32 PM
Post: #10
RE: Best programming language for handling array calculations in parallel?
There is also j, which was invented by the inventor of APL, here is a place to start:
http://jsoftware.com/#/README . Sorry cannot insert a link from a Kindle Fire.

Many of the advantages of APL but with regular keyboard characters.
Find all posts by this user
Quote this message in a reply
04-21-2019, 05:22 AM
Post: #11
RE: Best programming language for handling array calculations in parallel?
I hardly see the point of using obsolete/hard to maintain (Fortran, APL) or exotic languages if one wants to use GPU.

C/C++ is very commonly used, so is Python on top of the existing C librairies. Of course, a programmer fluent in Fortran has a good reason to choose it but that's all IMHO.

Choosing the most common languages means tutorials, supports, less time wasted understanding the subtleties of the library binding in another environment...
Find all posts by this user
Quote this message in a reply
04-23-2019, 10:37 AM
Post: #12
RE: Best programming language for handling array calculations in parallel?
More original :

RPL/2 for numerical algorithms or symbolic computations on parallel calulators
Find all posts by this user
Quote this message in a reply
04-23-2019, 12:07 PM
Post: #13
RE: Best programming language for handling array calculations in parallel?
If you are working in C++, the Eigen library used to be very good. Essentially, it is a template library that attempts to optimise operations at compile time. It special cases small matrices and allows a trade off between performance and accuracy.

If I were rewriting the 34S firmware and the flash permitted it, this is what I'd use. Writing fast and accurate matrix code is tricky.


Pauli
Find all posts by this user
Quote this message in a reply
04-23-2019, 09:52 PM
Post: #14
RE: Best programming language for handling array calculations in parallel?
(04-20-2019 01:59 AM)gomefun2 Wrote:  Each matrix location will only have basic math applied to it +-*/.

Is there any website that benchmarks parallel performance and compares languages?

Not that I know, the closest is: https://benchmarksgame-team.pages.debian...marksgame/

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)