Loading ...
Sorry, an error occurred while loading the content.

A new program for Unix/Mac users

Expand Messages
  • Yves Gallot
    The C source code of GeneFer can be downloaded at http://perso.wanadoo.fr/yves.gallot/primes/download.html
    Message 1 of 6 , Jul 1, 2001
    • 0 Attachment
      The C source code of "GeneFer" can be downloaded at
      http://perso.wanadoo.fr/yves.gallot/primes/download.html
      http://perso.wanadoo.fr/yves.gallot/primes/genefer.c

      A probable test of generalized Fermat numbers is implemented: a DWT and a
      Four Step FFT with no transposition and no bit reversal are used to test
      quickly large numbers. A test and a bench is included in.
      A on PC, the test is between 50% and 100% slower than the test included in
      Proth.exe. The main reason is that the code generated by C compilers on PC
      is not fast with floating point numbers because of the small number of FP
      registers of the x86 architecture. Proth also uses some tricks that require
      some 80-bit FP registers and that could not be translated to C.

      The code was written to run on any platform. You can try to compile it if
      you have a Unix workstation or a Mac: on a processor with a large number of
      registers and a large cache memory, the code should be fast, maybe faster
      than the code in assembler on a PC at the same clock. Today, only the
      algorithm was optimized. If you find some tricks for a particular processor
      thanks to give a feedback to me (it is important to write a fast round()
      function for each processor type). Also, I would be interesting in the
      result of the bench on different processors.

      Yves
    • d.broadhurst@open.ac.uk
      Thanks Yves I downloaded genefer.c and typed ... But then I got: ld: Unresolved: ceil cos fabs floor log pow sin sqrt Excuse my extreme naivety, but how do do
      Message 2 of 6 , Jul 1, 2001
      • 0 Attachment
        Thanks Yves

        I downloaded genefer.c and typed

        > cc genefer.c

        But then I got:

        ld:
        Unresolved:
        ceil
        cos
        fabs
        floor
        log
        pow
        sin
        sqrt

        Excuse my extreme naivety, but how do
        do I tell my alpha's C compiler to get
        hold these elementary functions.

        David (unix ignoramus)
      • Yves Gallot
        ... You should link with the mathematical library: cc genefer.c -lm and it is better to optimize the code: cc genefer.c -O -lm Yves
        Message 3 of 6 , Jul 1, 2001
        • 0 Attachment
          > Thanks Yves
          >
          > I downloaded genefer.c and typed
          >
          > > cc genefer.c

          You should link with the mathematical library:

          cc genefer.c -lm

          and it is better to optimize the code:

          cc genefer.c -O -lm

          Yves
        • d.broadhurst@open.ac.uk
          ... That compiles, thanks! But it appears that the executable has problems on a DecAlpha. Yves and I hope that maybe Phil will fix these while he is reducing
          Message 4 of 6 , Jul 1, 2001
          • 0 Attachment
            Yves Gallot wrote:
            > cc genefer.c -O -lm
            That compiles, thanks!
            But it appears that the executable has problems
            on a DecAlpha. Yves and I hope that
            maybe Phil will fix these while he is
            reducing the number of lines in the code:-?
            David
          • Phil Carmody
            ... (Reading mail in reverse order, as always) David mentioned something about Alpha problems. #ifdef _MSC_VER typedef __int32 Int32; typedef unsigned __int32
            Message 5 of 6 , Jul 2, 2001
            • 0 Attachment
              On Sun, 01 July 2001, "Yves Gallot" wrote:
              > The C source code of "GeneFer" can be downloaded at
              > http://perso.wanadoo.fr/yves.gallot/primes/download.html
              > http://perso.wanadoo.fr/yves.gallot/primes/genefer.c

              (Reading mail in reverse order, as always)

              David mentioned something about Alpha problems.

              #ifdef _MSC_VER
              typedef __int32 Int32;
              typedef unsigned __int32 UInt32;
              typedef unsigned __int64 UInt64;
              #else
              typedef long Int32;
              typedef unsigned long UInt32;
              typedef unsigned long long UInt64;
              #endif


              If length is important, then all of the above types are 64bit on the alpha. Only int is 32 bits. Note also, however, that 64 bit is the native register size anyway, so the only reason you'd want to use 32 bits is for reducing memory footprints, 64bits often tends to be faster in some situations.
              I'll not get a chance to look at the code for a short while, but the above did appear to be one place that might be a problem point on the alpha.

              Phil

              Mathematics should not have to involve martyrdom;
              Support Eric Weisstein, see http://mathworld.wolfram.com
              Find the best deals on the web at AltaVista Shopping!
              http://www.shopping.altavista.com
            • Phil Carmody
              ... David, it appears that Yves has fixed the problem already, and again I ve cast my eye over the code, but not taken a compiler to it yet. Are you using ccc
              Message 6 of 6 , Jul 2, 2001
              • 0 Attachment
                On Sun, 01 July 2001, d.broadhurst@... wrote:
                > But it appears that the executable has problems
                > on a DecAlpha. Yves and I hope that
                > maybe Phil will fix these while he is
                > reducing the number of lines in the code:-?

                David, it appears that Yves has fixed the problem already, and again I've cast my eye over the code, but not taken a compiler to it yet. Are you using ccc (the compaq c compiler)? If so, can you crank up optimisations to the max (-O6 should do it) and run a profiler over it?
                I've seen a few things that might be slow in the alpha, but I can't tell which are most likely to be in vital areas. There is an address generation issue in the middle of the FFT/squares for example (array[a*b] type references, which probably require a multiply per memory access, which is a no-no on an Alpha).
                I don't mind having a peek at either optimising this (in a "won't harm other architectures" type way), or at least advising on simple expression rewrites that others might want to try out, if there's interest. However, I'm guessing that non-x86 is a minority thing, and that most people will run Proth.exe.

                Phil


                Mathematics should not have to involve martyrdom;
                Support Eric Weisstein, see http://mathworld.wolfram.com
                Find the best deals on the web at AltaVista Shopping!
                http://www.shopping.altavista.com
              Your message has been successfully submitted and would be delivered to recipients shortly.