[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gsl] fgsl: single precision float version of gsl

From: Feng Chen
Subject: [Help-gsl] fgsl: single precision float version of gsl
Date: Wed, 8 Feb 2012 15:58:06 -0600

I was looking for a solution similar to the question asked here:

As the original poster pointed out, -Ddouble=float won't work, it stops and
complaining "long float".  After some searches I decide to just do it the
brutal way and it worked for me. So I would like to share it here (and
maybe get better suggestions).

First, cd gsl-1.15,  edit, change

Then, run:
(or, for my case, ./configure --prefix=/home/me/local)

Now, type this one-liner to do search/replace:
find . -print0 | xargs -0 perl -pi -e 's/long

Now you can do:
make install

To use it, instead of
#include <gsl/gsl_linalg.h>
We do:
#include <fgsl/gsl_linalg.h>

When linking, instead of linking with libgsl.a or -lgsl, link with
libfgsl.a or -lfgsl.

It's not a clean solution but if you want float instead of double in a
certain scope, it works quite well.
As someone has warned, certain packages require higher precision to work,
so be wise when using this hack. :)

ps: I also changed the optimization level for gcc when I compile the lib,
instead of using the default -g -O2, when I was in the first step editing, I added a line to make it looks like:
CFLAGS="-O3 -mtune=native -fgraphite-identity -floop-interchange
-floop-strip-mine -floop-block -ftree-loop-distribution"

Here "-O3 -mtune" or "-O3 -msse2" is important to vectorize the loops (most
of us have machines that support SSE2, huge speed difference). Or, use:
-O2 -ftree-vectorize -msse2 -ftree-vectorizer-verbose=5

reply via email to

[Prev in Thread] Current Thread [Next in Thread]