News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Yeppp! High performance mathematical library

Started by Gunther, October 08, 2013, 12:28:08 PM

Previous topic - Next topic

Gunther

The Intel Math Kernel Library - or short - MKL is well known, but not so cheap. Of course, there are alternatives. For example, AMD has a similar solution. But both libraries work perfectly with the corresponding CPU. This is a clear disadvantage.

There is a relative new, cross-platform alternative: Yeppp! It's used by the CERN data department and seems to be not so bad. Interesting enough: The Yeppp! kernel is written in assembly language (with a bit Python help). They have 3 simple design principles:

  • Avoid Table Lookups, because these are hard to use with SIMD instructions.
  • Avoid division and square roots. Use polynomial approximations and Newton-Raphson approximation instead.
  • Avoid  piecewise approximations and branches in the primary code paths.
Very interesting and the results speak for themselves.

Gunther
You have to know the facts before you can distort them.

dedndave

this is an ASM forum, Gunther
we try to make our own stuff    :biggrin:

Gunther

Hi Dave,

Quote from: dedndave on October 09, 2013, 04:45:21 AM
this is an ASM forum, Gunther
we try to make our own stuff    :biggrin:

Good idea. We can try to make our own HPC library. Why not? Any ideas?

Gunther
You have to know the facts before you can distort them.

dedndave

not at the moment - lol
(brain fart)

over time, forum members have introduced a number of routines, though
the old forum archive is full of great code and information

Gunther

Quote from: dedndave on October 09, 2013, 06:30:11 AM
over time, forum members have introduced a number of routines, though
the old forum archive is full of great code and information

Right, let's think about that.

Gunther
You have to know the facts before you can distort them.

qWord

A while back I've played a lot with table based function approximations, especially of exp(x) and log2(x). What I've found is that there is (IMO) no way around table based methods to get acceptable precision and speed. After taking a quick look to Yeppp's source, I currently have doubts on the efficient of used algorithms, because they use polynomials of 1xth degree.

BTW, a good book on this subject is "Elementary Functions Algorithms and Implementation" by Jean-Michel Muller.
An also interesting paper is "An Accurate Elementary Mathematical Library for the IEEE Floating Point Standard" by S. Gal and B. Bachells. I've used the accurate tables method they descripted for exp(x). After implementing it, I did a compare to the FPU and HPALIB (112 bit precision) with the disillusioning result that the relative error is less than 4E-14 over the whole range (REAL8). However, I've noticed that the MSVCRT use exact the same method (=same error) thus I stay with it  :biggrin:.
MREAL macros - when you need floating point arithmetic while assembling!

Gunther

Hi qWord,

Quote from: qWord on October 09, 2013, 09:58:09 AM
BTW, a good book on this subject is "Elementary Functions Algorithms and Implementation" by Jean-Michel Muller.
An also interesting paper is "An Accurate Elementary Mathematical Library for the IEEE Floating Point Standard" by S. Gal and B. Bachells. I've used the accurate tables method they descripted for exp(x). After implementing it, I did a compare to the FPU and HPALIB (112 bit precision) with the disillusioning result that the relative error is less than 4E-14 over the whole range (REAL8). However, I've noticed that the MSVCRT use exact the same method (=same error) thus I stay with it  :biggrin:.

An interesting point of view. Do you have a link to the paper by Gal and Bachells?

Gunther
You have to know the facts before you can distort them.

qWord

Quote from: Gunther on October 09, 2013, 10:21:37 AMDo you have a link to the paper by Gal and Bachells?
I'm afraid is not free downloadable. IIRC I've got  from the ACM Digital Library database (or maybe IEEE Xplore).
MREAL macros - when you need floating point arithmetic while assembling!

Gunther

Quote from: qWord on October 09, 2013, 10:30:10 AM
I'm afraid is not free downloadable. IIRC I've got  from the ACM Digital Library database (or maybe IEEE Xplore).

That's bad luck. I would be interested to read the paper.

Gunther
You have to know the facts before you can distort them.

dedndave

http://en.wikipedia.org/wiki/Gal%27s_accurate_tables

at the bottom of the page is a link to a PDF: "Gal's Accurate Tables Method Revisited"

anta40

Quote
Yeppp! binaries for Windows, Android, Mac OS X, and Linux.
Bindings for Java, .Net/Mono, and FORTRAN.

Whoa. This is awesome.
But wait... my numerical analysis skill is already rusty  :redface:
Need some refreshing, I guess  :biggrin:

Gunther

Dave,

Quote from: dedndave on October 09, 2013, 01:07:33 PM
http://en.wikipedia.org/wiki/Gal%27s_accurate_tables

at the bottom of the page is a link to a PDF: "Gal's Accurate Tables Method Revisited"

Thank you for the link. It's an interesting article.

Gunther
You have to know the facts before you can distort them.

KeepingRealBusy

Dave,

What I saw was a (I believe) a French paper that was being automatically being translated into English (if you jump from one  page past the next page, the displayed page is blank and is filled in line by line).

I wonder how accurate the translation is?

Dave.

Gunther

Hi Dave,

Quote from: KeepingRealBusy on October 10, 2013, 05:45:49 AM
What I saw was a (I believe) a French paper that was being automatically being translated into English (if you jump from one  page past the next page, the displayed page is blank and is filled in line by line).

I'm not sure. What they have done is the Resume (abstract) in French. The text is probably written in English.

Gunther
You have to know the facts before you can distort them.

KeepingRealBusy

Gunther,

I guess with a math paper, the translation would probably be accurate in any case.

Dave.