Author Topic: Yeppp! High performance mathematical library  (Read 26406 times)

Gunther

  • Member
  • *****
  • Posts: 4070
  • Forgive your enemies, but never forget their names
Yeppp! High performance mathematical library
« on: October 08, 2013, 12:28:08 PM »
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
Get your facts first, and then you can distort them.

dedndave

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: Yeppp! High performance mathematical library
« Reply #1 on: October 09, 2013, 04:45:21 AM »
this is an ASM forum, Gunther
we try to make our own stuff    :biggrin:

Gunther

  • Member
  • *****
  • Posts: 4070
  • Forgive your enemies, but never forget their names
Re: Yeppp! High performance mathematical library
« Reply #2 on: October 09, 2013, 05:01:29 AM »
Hi Dave,

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
Get your facts first, and then you can distort them.

dedndave

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: Yeppp! High performance mathematical library
« Reply #3 on: October 09, 2013, 06:30:11 AM »
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

  • Member
  • *****
  • Posts: 4070
  • Forgive your enemies, but never forget their names
Re: Yeppp! High performance mathematical library
« Reply #4 on: October 09, 2013, 07:10:59 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
Get your facts first, and then you can distort them.

qWord

  • Member
  • *****
  • Posts: 1475
  • The base type of a type is the type itself
    • SmplMath macros
Re: Yeppp! High performance mathematical library
« Reply #5 on: October 09, 2013, 09:58:09 AM »
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

  • Member
  • *****
  • Posts: 4070
  • Forgive your enemies, but never forget their names
Re: Yeppp! High performance mathematical library
« Reply #6 on: October 09, 2013, 10:21:37 AM »
Hi qWord,

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
Get your facts first, and then you can distort them.

qWord

  • Member
  • *****
  • Posts: 1475
  • The base type of a type is the type itself
    • SmplMath macros
Re: Yeppp! High performance mathematical library
« Reply #7 on: October 09, 2013, 10:30:10 AM »
Do 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

  • Member
  • *****
  • Posts: 4070
  • Forgive your enemies, but never forget their names
Re: Yeppp! High performance mathematical library
« Reply #8 on: October 09, 2013, 11:33:45 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
Get your facts first, and then you can distort them.

dedndave

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: Yeppp! High performance mathematical library
« Reply #9 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"

anta40

  • Member
  • ***
  • Posts: 315
Re: Yeppp! High performance mathematical library
« Reply #10 on: October 09, 2013, 02:46:08 PM »
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

  • Member
  • *****
  • Posts: 4070
  • Forgive your enemies, but never forget their names
Re: Yeppp! High performance mathematical library
« Reply #11 on: October 09, 2013, 10:07:09 PM »
Dave,

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
Get your facts first, and then you can distort them.

KeepingRealBusy

  • Member
  • ***
  • Posts: 426
Re: Yeppp! High performance mathematical library
« Reply #12 on: October 10, 2013, 05:45:49 AM »
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

  • Member
  • *****
  • Posts: 4070
  • Forgive your enemies, but never forget their names
Re: Yeppp! High performance mathematical library
« Reply #13 on: October 10, 2013, 05:50:53 AM »
Hi 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'm not sure. What they have done is the Resume (abstract) in French. The text is probably written in English.

Gunther
Get your facts first, and then you can distort them.

KeepingRealBusy

  • Member
  • ***
  • Posts: 426
Re: Yeppp! High performance mathematical library
« Reply #14 on: October 10, 2013, 05:53:48 AM »
Gunther,

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

Dave.