public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
* Re: gsl Development Query
@ 2000-09-01 18:58 E. Robert Tisdale
  2000-09-02  0:12 ` Eleftherios Gkioulekas
  2000-09-02 15:12 ` Gerard Jungman
  0 siblings, 2 replies; 36+ messages in thread
From: E. Robert Tisdale @ 2000-09-01 18:58 UTC (permalink / raw)
  To: gsl-discuss

Gerard Jungman wrote:

> Randall Judd wrote:
> 
> > Part of the specification is the interface
> > which allows people
> > to bring data into or export data from VSIPL.
> 
> This is an important point.
> It may be that data interchange is issue number
> one for this kind of library.  Certainly, I feel that
> it is the number one issue for vector/matrix/etc.
> implementations in numerical libraries.
> No library can afford to act as an island fortress.
> As a general comment, I think that generic programming
> (which for all practical purposes
>  means algorithm templates in C++)
> offers the best hope at this point for freeing ourselves
> from the details of data representations, in the wide sense.
> I see no real solution,
> when restricted to the context of a C library like GSL;
> we just have to find the right compromise,
> given the right set of restrictions on the problem domain.
> 
> By the way, I looked at the VSIPL draft
> to see what you were doing about this,
> but I wasn't sure what the appropriate section was.
> From what I did see,
> I guessed that your block/view separation was the key
> to data interchange, allowing conformant views
> to be layered over imported data blocks.
> Is this what you meant,
> or did you have something more specific in mind?
> 
> I certainly agree with this approach.
> GSL actually works this way as well
> (contrary to whatever Tisdale seems to be going on about),
> though it is not as complete.
> Certainly I hope that by the time we are done
> we will have a similar level of completeness,
> addressing such issues as views
> layered over different underlying complex array types.
> It's not hard to do, and it fits in with what we have so far.
> Brian, are you listening?

The VSIPL API was designed to accommodate
embedded Digital Signal Processors (DSPs).
These machines typically have memory spaces
which can't be accessed through a standard ANSI C pointer.
The memory may be in vector registers, cache,
program memory space, data memory space,
other processing nodes in a multiprocessor system, etc.
A VSIPL block object allows VSIPL functions
to reference these non standard memory spaces
as well as the memory space that can be referenced
through an ordinary ANSI C pointer.
Apparently, GSL blocks can only reference memory
that can be referenced through an ordinary ANSI C pointer.
You can always obtain an ordinary ANSI C pointer
to the underlying data array from a GSL block or view object
but you can't always get such a pointer
from a VSIPL block object.

I assume that you expect all of the GSL users
are like the users at LANL who mainly program
super computers and high performance workstations.
If so, you will probably get away with the "flat"
virtual memory model that the GSL currently supports.
But if you think that GSL users might want to port
applications to some of the new high performance DSPs,
you might want to reconsider the VSIPL architecture.

> Of course, there are many hidden problems.
> Especially that, in principle,
> one needs to optimize algorithms differently
> if using a certain type of view
> implies a poor strategy for memory accesses.
> This rapidly becomes complicated, parametrizing
> both the data layouts and algorithms together.
> But that makes it interesting too.
> 
> > The main problem with FFTW is that
> > they use an array of complex.
> > Most of the time an array of complex
> > looks like interleaved complex
> > (which is, I think, what GSL uses for complex arrays).
> > For the user interface,
> > VSIPL supports both interleaved or split arrays
> > (internally a complex block is just a block of complex).
> 
> Just a minor technical note,
> for readers who may not be aware of the details.
> As I'm sure you know, this layout of complex numbers
> (coincident values of underlying type, like double x[2])
> is standard in fortran and (I believe) the C99 draft.
> From a practical standpoint, I think there is no other way to go,
> because you have to be able to inter-operate with old code,
> especially old fortran code.
> The fact that C++ does not specify the implementation details
> for std::complex is, I believe, a deficiency of the C++ standard.
> Eventually they will have to come around and fix this;
> we can't glide along forever, relying on the the fact that
> most compiler/platform combinations end up with
> 
> 	struct { double x; double y; }
> 
> and
> 
> 	struct { double x[2]; }
> 
> aligned "by accident" on the same boundaries.
> 
> If anybody wants to clarify
> what is going on with this issue out there,
> I would like to know myself.
> This was one of the stickier points
> that Brian and I had to make a decision on.

Application programmers who aren't particularly concerned
about the portability of their code needn't worry about this.
Actually, virtually every ANSI C compiler
will store both of these types in exactly the same way.
The problem is that the ANSI C standard does not guarantee
that they will be stored in exactly the same way
so the second type is safer.

The C++ standard does not distinguish
Cartesian complex numbers from polar complex numbers
or any other representation of complex numbers.
High performance numerical computing, on the other hand, has always
used Cartesian complex numbers represented by a pair of real numbers
in an array of two elements with the imaginary part following
immediately after the real part (with unit stride between them.)
This representation of complex numbers predates Fortran
as does the notion of real and complex multidimensional views
of a one dimensional array of real numbers.
These notions of views were incorporated into the design
of the Fortran programming language using the EQUIVALENCE declaration.

> > I guess my point is that you probably should have your own FFT's.
> 
> Yes, I can't disagree.
> If somebody wants to drop multi-dim FFTs in our lap,
> that would be great. I just don't want to have to do it.
> And if we take source code from somewhere else, we have a choice.
> We can figure out how to create an appropriate layer
> that insulates us, or we can apply the old copy/paste methodology.
> Now, I find copy/paste to be the most revolting form of reuse,
> as I'm sure most people do.
> On the other hand, it all boils down to two questions:
> 
>   (1) Is the source you are snarfing stable enough?
>   (2) Can you imagine ever wanting to swap something else in?
> 
> In the cases at hand, the answer to (1) is probably yes.
> But I have never yet found a case where the answer to (2) was no.
> That's somewhat subjective, but that's how I feel about it.
> 
> Now, Brian may object to the copy/paste statement. After all,
> what one of us would really do would be to read about it,
> look at a couple different implementations,
> and then code something up as cleanly as possible.
> But in my book this is just a more sophisticated
> (and not necessarily more intelligent) form of copy/paste.
> 
> > It may not be reasonable to make an interface to FFTW
> > and keep the other interfaces in your library coherent.
> 
> My feeling is that, in this case, it won't be hard.
> Similarly, it would not be hard to use
> an underlying fortran implementation for the BLAS library.
> All you have to do
> is specify an appropriate middle layer in each case.

Maybe.  Maybe not.  You can never be sure that
you will have compatible Fortran and C compilers
on any given platform.
You might need to write an interface in assembler
to call Fortran subroutines from a C program.

> What I can say for sure is that
> if we create an appropriate middle layer first,
> then we have options, and if we don't
> then it could end up being very difficult
> for us or anyone else to put something new in later.
> 
> In this regard, this is a question about modularity
> with respect to the implementations.
> If you can make things more flexible
> without sacrificing simplicity
> at the highest level of abstraction
> (where most users will live),
> and it doesn't cost too much to do so, then why not?
> 
> > If somebody really needs FFTW speed
> > and also wants to use your library,
> > then they should figure out how to make them interface.
> > Hopefully, you give them enough information so they can do this.
> 
> Well, maybe we can kill all these birds
> by making the appropriate middle layer work ourselves.
> It can help us, because we get to link in
> a working implementation with minimal effort,
> and it can help other people if it saves them the effort.

I don't think that you need to get bogged down
in the GSL implementation details.
It may seem like a huge project to you now
but eventually you will get some perspective
and realize that they really are just details.
A portable version of the GSL is certainly a good idea
but there will never be
just one really good implementation of the GSL.
If the GSL is to survive, then, just like the VSIPL,
there must be several implementations each tailored
to a specific platform or class of computer architectures
and/or application domains.

^ permalink raw reply	[flat|nested] 36+ messages in thread
* Re: gsl Development Query
@ 2000-09-04 13:10 E. Robert Tisdale
  0 siblings, 0 replies; 36+ messages in thread
From: E. Robert Tisdale @ 2000-09-04 13:10 UTC (permalink / raw)
  To: gsl-discuss

Steve ROBBINS wrote:

> OK, then why do you care to improve the API?  
> 
> Are you using GSL or do you plan to?
> That seems unlikely,
> as your previous message stated that
> you have already "done GSL right". 
> 
> I'm just wondering what your interest in GSL is.

I think that I've said this before.
I'm interested in a good general purpose numerical library
just like all of the other contributors to this discussion.
I had hoped that the GSL would be that library.  It isn't.
And it may be too late to get it turned around
and headed in the right direction.  I don't know.

^ permalink raw reply	[flat|nested] 36+ messages in thread
* Re: gsl Development Query
@ 2000-09-04 13:00 E. Robert Tisdale
  0 siblings, 0 replies; 36+ messages in thread
From: E. Robert Tisdale @ 2000-09-04 13:00 UTC (permalink / raw)
  To: gsl-discuss

Brian Gough wrote:

> Randall Judd writes:
> 
> > In VSIPL every view contains a pointer to the block. 
> 
> I think we can accomodate this in GSL
> by not setting the block field to NULL for views
> and having a separate field in the struct to indicate ownership
> of the memory instead.  Then one would always be able
> to determine the underlying block for any view.
> 
> This seems straightforward to support, so I will do that --
> it only needs a change in the struct definition
> and a few associated routines.

Do you really need to tell us these details?
It's your implementation.  Do what you want.
But give us library functions that return

  1.) a pointer to the block,
  2.) the offset from the beginning of the block
      to the first element of the vector,
  3.) the length (extent) of the vector and
  4.) the stride between elements of the vector.

You can implement them as inline functions
or even C preprocessor macros if you like.
Take a look at
The ANSI C Numerical Class Library

	http://www.netwood.net/~edwin/svmt/

and read cncl/src/vector/vector.hP for an example
of how you might implement them.

^ permalink raw reply	[flat|nested] 36+ messages in thread
* Re: gsl Development Query
@ 2000-09-04 12:38 E. Robert Tisdale
  2000-09-04 13:00 ` Steve ROBBINS
  0 siblings, 1 reply; 36+ messages in thread
From: E. Robert Tisdale @ 2000-09-04 12:38 UTC (permalink / raw)
  To: gsl-discuss

Steve ROBBINS wrote:

> ... so remind us again why you subscribed to gsl-discuss
> and proceeded to berate the developers of GSL?
> 
> -S
> 
>         "you catch more flies with honey than with vinegar"

I do not berate the GSL developers.
I berate the GSL API.
Professional people must learn
not to take criticism of their work personally.
My work (and Randy's work) on the VSIPL API standard
received a great deal of criticism
but I think it helped me and it made the VSIPL API better.
I only hope that the GSL API will benefit as much
from the criticism that I offer.
Just try to think of it as peer review.

^ permalink raw reply	[flat|nested] 36+ messages in thread
* Re: gsl Development Query
@ 2000-09-03 17:34 E. Robert Tisdale
  0 siblings, 0 replies; 36+ messages in thread
From: E. Robert Tisdale @ 2000-09-03 17:34 UTC (permalink / raw)
  To: gsl-discuss

Randall Judd wrote:

> I don't attach VSIPL blocks to GSL views.
> The idea is to associate (a word I prefer to attach)
> VSIPL blocks with GSL blocks (not views).
> Then define VSIPL vector and/or matrix views
> which map the block data space
> the same way that the GSL views map the GSL blocks data space.

A VSIPL block is like a C++ valarray.
The are both pure abstractions.
You can read what Kent Budge (kgbudge@valinor.sandia.gov)
has to say about valarray in his article
"Re: OONSTD: to early for standards?" at

	http://www.oonumerics.org/oon/oonstd/archive/0018.html

Both the VSIPL block and the C++ valarray
give the application programmer the "illusion"
that the underlying data array
is a contiguous block of real numbers
regardless of how they are actually stored in memory.
The C++ compiler may actually conspire
with the operating system and the computer architecture
to create this illusion for application programmers
who use valarray and return a "pointer" to an element
in a valarray
The ANSI C compiler is not expected to participate
in this illusion for VSIPL block objects.
The actual data representation of VSIPL block objects
is hidden from the application programmer
and, in general, elements can only be accessed
through VSIPL functions.

A GSL block isn't abstract at all.
It is defined to be

        struct gsl_block_struct {
          size_t size;
          double* data;
          };
        
        typedef struct gsl_block_struct gsl_block;

Aplication programmers are permitted to access
the double* data member directly and they are guaranteed that
they can always obtain a pointer to the underlying data array.
This means that the GSL can never distribute the data array
among the nodes of a multiprocessor system for example.

> As I understand it, your GSL block contains some data space.
> Then you slice this data space up.
> The first of your vector views creates
> the block, data space, and a vector.

All this does is to combine two VSIPL operations.
The first vector object "owns" the block.
The block should never be destroyed
until just before the owner is destroyed.

> The vector view contains a pointer to the block
> plus a pointer to the beginning of the data.
> When you take of subview of the vector,
> you set the block pointer to NULL,

This is just a precaution to help ensure
that the block is never destroyed
until just before the owner is destroyed.

> get a pointer to the beginning of the subviews data space

Essentially, they just precompute vector.data = block.data + offset
They could obtain the offset = vector.data - block.data
if they hadn't discarded the pointer to the block.
It's too bad really.  If they had retained the pointer to the block,
they could have used it to help determine
whether source and destination views overlap or not.

> and then set the attributes of the subview
> to the proper stride and length for the new vector
> which must not exceed the data space of the block.
> 
> In VSIPL every view contains a pointer to the block.
> The block contains the entire possible data space.
> For a GSL vector view attached to a block,
> the view contains a pointer to the beginning of data,
> a length equal to the data space length,
> and a stride equal to one.
> The corresponding VSIPL vector view contains
> an offset of zero, a stride of one
> and a length equal to the length of the block.
> 
> So, when I create a block,
> I would want the block to encompass the entire GSL block.
> 
> Now I could create a new block to do the GSL subview,
> but the new block would encompass some of the same data space
> as the previous VSIPL block.
> This would be an error from VSIPL's point of view.
> What I do in VSIPL is set an offset into the data space
> so my subview points to the same data space as the GSL subview.
> Then the stride and length would be the same as GSL.

^ permalink raw reply	[flat|nested] 36+ messages in thread
* Re: gsl Development Query
@ 2000-09-03 16:20 E. Robert Tisdale
  2000-09-03 17:22 ` Randall Judd
  0 siblings, 1 reply; 36+ messages in thread
From: E. Robert Tisdale @ 2000-09-03 16:20 UTC (permalink / raw)
  To: gsl-discuss

Randall Judd wrote:

> The Core, and Core Lite documents are what are called profiles.
> No vendor, except perhaps SKY, has completed all of VSIPL yet.
> But they wanted to be able to say they are VSIPL compliant.
> So we defined profiles to give them a starting point
> and a way to claim compliance to something.
> Core Lite is only about 129 function
> and is a very easy starting point for most vendors.
> A great many, surprisingly so, current Navy applications
> appear to be mappable to just a core lite implementation.
> The core profile has about 500 or so functions
> and include more complicated things.
> In the future, there may be more profiles.
> A profile is basically a defined set of functions
> that has been approved by the VSIPL forum.

It is important to distinguish between
what a standard specifies and what it mandates.
The problem with the BLAS library API standard, for example,
is that it mandates everything that it specifies.
You can't implement part of the BLAS library API standard and
say that you have implemented the BLAS library API standard.
Somebody would get upset and accuse you of fraud.
The BLAS library API standard designers couldn't get
BLAS library developers to implement everything
that they wanted in the BLAS library API standard
so they compromised.  They left out a lot of functionality.
The result was a much impoverished API design
from the numerical application programmers point of view.
You can check this out by reading
"A Set of Level 3 Basic Linear Algebra Subprograms,"
by Jack Dongarra, Jeremy Croz, Iain Duff and Sven Hammarling,
Section 8 Rationale which you can download
as a PostScript file blas3-paper.ps from

	http://www.netlib.org/blas/

The VSIPL profiles decouple specifications from mandates.
They "partition" the VSIPL library into manageable chunks
which depend upon each other in a natural way.
Matrix objects depend upon vector objects,
linear algebra depends upon matrix objects,
tensor objects depend upon matrix objects, etc.
so library developers can build a complete VSIPL library
in increments over time.

Still, the VSIPL API standard is limited in scope.
The vector part includes some linear algebra
but it is mainly intended for digital signal processing.
Eventually, it is supposed to include
digital image processing as well.
It was never really intended to be
a general purpose Scientific Computing library
as I (and Randy I suppose) hoped the GSL was supposed to be.

^ permalink raw reply	[flat|nested] 36+ messages in thread
* Re: gsl Development Query
@ 2000-09-02 16:31 E. Robert Tisdale
  2000-09-04 11:39 ` Steve ROBBINS
  0 siblings, 1 reply; 36+ messages in thread
From: E. Robert Tisdale @ 2000-09-02 16:31 UTC (permalink / raw)
  To: gsl-discuss

Gerard Jungman wrote:

> Uhh... exactly how many lines of code
> have you contributed to GSL lately,
> that you are in a position to measure anything
> related to my effort?

Well, now that you brought it up,
exactly where did you get the idea
for the GSL block, vector view and matrix view objects.
I first proposed the VSIPL block, vector view,
matrix view and tensor view objects
in a presentation before the VSIP Forum in April, 1997.
I implemented the original VSIP portable reference library
which served as the starting point for the implementation
by Randy Judd which you can get on the internet today

    http://www.vsipl.org/

I am the author of
The C++ Matrix class library

    http://www.netwood.net/~edwin/Matrix/

which has been available free of charge on the internet
for over a decade now.  Hundreds of people use it.

I am the author of
The C++ Scalar, Vector, Matrix and Tensor class library

    http://www.netwood.net/~edwin/svmt/

which has been available free of charge in the internet
for over two years now.   Hundreds of people use it.

I am the author of
The ANSI C Numerical Class Library

    http://www.netwood.net/~edwin/svmt/

which is basically the GSL done correctly.

I've contributed.
I've written many more lines of code than you have
and distributed them free of charge for well over a decade now.
If you choose to ignore them, that's your problem not mine.

It isn't any wonder that you have trouble
getting people to contribute to the GSL.
You have no plan.  You have no design.  You have no goals.
At least none that you have or can articulate.
I have very little confidence in the GSL right now.
I don't think that it is going anywhere.
And I don't think anyone else does either.
I don't want to waste my time on a project
that is doomed from the start
and I don't think that anyone else does either.

Please, if you are serious about the GSL,
go back and read my earlier posts to this discussion
and try to answer some of the questions that I asked.
It really will help.


^ permalink raw reply	[flat|nested] 36+ messages in thread
* Re: gsl Development Query
@ 2000-09-02  9:22 E. Robert Tisdale
  0 siblings, 0 replies; 36+ messages in thread
From: E. Robert Tisdale @ 2000-09-02  9:22 UTC (permalink / raw)
  To: gsl-discuss

Eleftherios Gkioulekas wrote:

> At worst, you can fall back onto f2c as a last-resort backup.

Provided that you have the Fortran source code.
You might not be able to use the proprietary high performance version
of the BLAS library that is available on your platform.
You might be obliged to fall back onto the BLAS portable reference library
and take an unacceptable performance hit.

^ permalink raw reply	[flat|nested] 36+ messages in thread
* Re: gsl Development Query
@ 2000-09-01 15:18 E. Robert Tisdale
  0 siblings, 0 replies; 36+ messages in thread
From: E. Robert Tisdale @ 2000-09-01 15:18 UTC (permalink / raw)
  To: gsl-discuss

Gerard Jungman wrote:

"E. Robert Tisdale" wrote:

> Actually, counting by man years of effort,
> most of the "programmers at LANL"
> spend their lives writing very expensive,
> large, and nondisposable applications.
> 
> It's fairly rude to tell other people what they do.

I'm familiar with LANL.
Most of the programmers at LANL are scientists and engineers.
They don't think of themselves as programmers.
They don't get paid to write programs
but they do write programs to help them do their own work.
They seldom write programs that other people use.
Usually, their programs are of no use once they have completed
the task that their programs were written to perform.
Their programs are usually archived for a while
and then deleted when nobody can remember what they do
and the storage space is needed for something else.

> Apparently you consider yourself a "professional programmer",
whatever that is.

Someone who gets paid
specifically to write programs for other people to use.

> Ok, why don't you put a little substance behind your mouth
> and contribute some "professional code" to this project?
> Maybe you could earn the right to badmouth the people
> who have actually done something.

Take a look at
The C++ Scalar, Vector, Matrix and Tensor class library

	http://www.netwood.net/~edwin/svmt/

Take a look at
The ANSI C Numerical Class Library on the same page.

Take a look at
The Vector, Signal and Image Processing Library

	http://www.vsipl.org/

I've contributed.

> I think most "professional programmers"
> would fail to find their own assholes in the dark.
> I can't be expected to account for their behavior.
> 
> The question at issue here is not one of API design.
> The main point of this discussion
> is how to most efficiently implement the functionality
> that is required to reach the stated goals of the project.
> Don't change the subject, and don't insult the people
> who are actually doing something.

Personally,
I don't see anything wrong with Brian's implementation.
It's his implementation and he should be left alone
to develop it as he sees fit.
If you don't like it, you should re-implement it yourself.
The problem is that Brian isn't simply implementing
a standard API like the BLAS library API.
He is inventing a new API and
his API is designed around his implementation.
Eventually, he will discover that he has made mistakes.
Everybody makes mistakes but if application programmers
start using the GSL, it will soon be practically impossible
to correct those mistakes without breaking
all of the existing application programs
that depend upon the GSL.

> Finally, I apologize to the readers of this list
> for even bothering to reply to these messages.
> Perhaps doing so is simply a waste of everybody's time.
> If somebody out there has something intelligent to say
> about the implementation policies for this project,
> please do not be discouraged by this exchange from doing so.

If you invite discussion in an open Forum like this,
you are bound to read things that you don't like.
Right now the GSL API is pretty awful.
The so-called error handling is ineffective
and the API provides many more opportunities
to make programming errors than any error handling scheme
could ever hope to deal with.
It is difficult and dangerous to use.
It adds unnecessary overhead to numerical functions.
There doesn't appear to be any design rationale
behind the GSL that anyone can articulate.
In short, the GSL API stinks.
Numerical application programmers should avoid the GSL
until the GSL designers get their act together
and publish a document which specifies the GSL API
and the rationale behind their design decisions.

^ permalink raw reply	[flat|nested] 36+ messages in thread
* Re: gsl Development Query
@ 2000-09-01 14:26 E. Robert Tisdale
  0 siblings, 0 replies; 36+ messages in thread
From: E. Robert Tisdale @ 2000-09-01 14:26 UTC (permalink / raw)
  To: gsl-discuss

Gerard Jungman wrote:

> Look, we can all sit and play C++ compiler.  But there's no point.
> The implementation language for this project does not make a distinction
> and nobody at this end is going to make pedantic distinctions.
> People who use C libraries have to apply some common sense.
> That is a fact (unfortunate perhaps) of the language.
>
> And he did it because it was useful to write it down somewhere.
> Don't quibble about where he wrote it down.
>
> Nobody is painting any corners
> and nobody is obliged to do anything.

You are wrong.
The documentation specifies each of the data members in

        typedef struct {
          size_t n;
          size_t nf;
          size_t factor[64];
          gsl_complex *twiddle[64];
          gsl_complex *trig;
          double *scratch;
          } gsl_fft_wavetable_complex;

Application programmers can reference and modify
the private data members
of a gsl_fft_wavetable_complex object directly.
Apparently, the documentation guarantees
that a gsl_fft_wavetable_complex object
will always have this data representation and
the data members will always have this interpretation.
That means that the GSL developers
can never change the data representation
or the implementation of the GSL FFT
without breaking application programs
that depend upon this representation
and the implementation that it implies.

The GSL provides no library functions
which application programmers can use
to access the private data member indirectly.
The GSL makes no attempt to hide
the actual data representation
from the application program.
The GSL documentation makes no distinction
between the API and implementation details.
Application programmers can't "apply common sense"
because GSL application programmers
and GSL library developers don't share
the necessary information.
Application programmers would need to be clairvoyant!
And upon reading your mind and Brian's mind,
they would discover that you and he can't even agree
so how would you expect application programmers to decide
what is part of the API and what is implementation detail?

I'm not talking about anything exotic here.
All that I am talking about is simply applying
good programming practice.
It has nothing to do with any particular programming language.
Pick up a copy of "Data Structures and Algorithms"
by Alfred V. Aho, Jeffrey D. Ullman and John E. Hopcroft
or just ask any sophomore computer science student
who has recently completed a course in data structures.


^ permalink raw reply	[flat|nested] 36+ messages in thread
* Re: gsl Development Query
@ 2000-08-31 21:37 E. Robert Tisdale
  2000-09-01 13:33 ` Gerard Jungman
  0 siblings, 1 reply; 36+ messages in thread
From: E. Robert Tisdale @ 2000-08-31 21:37 UTC (permalink / raw)
  To: gsl-discuss

Gerard Jungman wrote:

> Brian Gough wrote:
> 
> > What you've outlined is something much bigger
> > than GSL (i.e. it's not GSL).
> 
> No. What I have described is an efficient way
> to obtain the required functionality in GSL.
> These are implementation details.
> If you feel there are some fundamental flaws
> in existing implementations,
> then you are free to reimplement. I don't see
> the flaws in existing (and Free!) implementations
> such as BLAS and FFTW.
> 
> And how can it possibly matter to the end user?
> All they want is something that works,
> and that works in the right way,
> without making undesirable assumptions
> about usage patterns or data representation.
> These important issues are _interface_ issues.
> Their only relation to the elemental entity
> turning the crank under the hood
> is to specify certain constraints
> that any such implementation must satisfy.
> If you find a solution to those constraints,
> then you have satisfied the design criteria.
> If the solution happens to already exist,
> then so much the better; you can go home early.
> 
> > GSL is just a collection of routines for numerical computing,
> > written in C with modern coding conventions.
> 
> Yes, that's what it says in The Big Book of GSL.
> Now, rather than quoting the precious scripture to me,
> why don't you apply your native intelligence
> and think about whether or not it makes any sense.
> 
> The so-called "design" of this library
> was never anything more than some vague wish list.
> The original idea that you could provide
> "loosely coupled" libraries for the different tasks
> was wrong.  This was made clear
> when Brian and I got down to worrying about
> the various multi-dimensional functionalities
> which depend explicitly on data structures
> for vectors and matrices and linear algebra support.
> The linear algebra bottleneck should be obvious to everyone
> who has done any numerical computing;
> if you don't solve this problem first, you are screwed.
> 
> When you take the time to look at the requirements
> for implementing higher level algorithms,
> you realize that the design must be layered
> and you must solve the fundamental problems first.
> These include things like control of and access
> to the floating point capabilities of the machine,
> data representation issues, and basic linear algebra.
> 
> When you (Brian) and I faced these problems squarely,
> about two years ago, we found it necessary
> to redesign and reimplement large sections of the project,
> fixing things related to the issues above,
> as well as doing the right thing at higher levels,
> such as introducing a consistent framework for iteration.
> 
> When you say "well, we're just a collection of tools",
> you are just echoing the original design goals,
> which have been demonstrated, by your own work,
> to be confused.
> 
> > Maybe a "universal interface/library"
> > of the type you suggest is worthwhile --
> > but it would be a different project from GSL.
> 
> I'm not talking about a "universal interface/library",
> whatever that is.  I'm talking about the right way
> to provide an underlying implementation
> for some of the required functionality.
> 
> > If you need wrappers for fortran codes,
> > they are available in other places
> > (e.g. Octave's library, NumPy, ...).
> 
> Yes, they are. So?
> 
> Nobody "needs" wrappers for fortran codes.
> They need tools that do certain tasks.
> Wrapping fortran just happens to be
> a convenient way to get certain functionality.
> That's why people do it,
> not because they like to know that
> a little fortran monkey is turning the crank
> in their greasy little simulated worlds.
> Who cares what turns the crank, as long as it turns?
> 
> > The idea of GSL is that wrapping
> > is never completely satisfactory
> > and so it's better to rewrite things.
> 
> Let me paraphrase this for the general reader:
> The idea of GSL is to write half-assed implementations
> of some ill-defined collection of numerical foo,
> sometimes of functionality that already exists,
> with no real thought going into the overall design,
> and to pat each other on the back
> for having done everything the hard way
> and put it under the GPL.
> Well, GPL'ed foo is still foo;
> that's one thing I know for sure
> after having watched the free software world work
> for the last ten years.
> 
> You have this idea that GSL is just some thing
> that we are tinkering with in the backyard,
> not really "important" enough to do the right way;
> after all, nobody's going to the moon riding on a GSL rocket.
> This is insulting to everyone involved, including yourself.
> 
> > However much you wrap unreadable fortran,
> > it's still unreadable fortran.
> 
> Huh? What does this mean? This is a non sequitur.

Evidently, you and Brian
each have a very different vision for the GSL.
Brian's aspirations are rather modest.
He just wants to implement a numerical library
that he can distribute free of charge to people
who can't afford the $50 or whatever it costs
to purchase a copy of Numerical Recipes in C.
For him, the GSL is just another software project.
His plan is to simply allow the GSL to evolve.
Apparently, he believes that GSL users
are amateur application programmers who want to write
short lived disposable application programs
like most of the programmers at LANL for example.
He doesn't worry about supporting poor API design decisions
because he doesn't expect any applications using the GSL
to survive much beyond the next version of the GSL.

Personally, I would prefer an API for the GSL that
professional as well as amateur programmers could use.
Professional programmers are more interested in writing
long lived reusable application programs.
I don't think that many professional programmers
would dare risk using the GSL because, apparently,
it isn't reasonable to expect Brian or anyone else
to support it for very long.

Anyway, I don't think Brian is prepared to design an API.
If you want someone to design an API for the GSL,
you will probably need to do it yourself which means that
you will need to contribute to the design documentation
and submit specific proposals -- in writing.
The API should not dictate how it is to be implemented.
Implementation details should be left up to
the library developer --
Brian if he agrees to implement the API.

^ permalink raw reply	[flat|nested] 36+ messages in thread
* Re: gsl Development Query
@ 2000-08-31 17:25 E. Robert Tisdale
  2000-09-01 13:32 ` Gerard Jungman
  0 siblings, 1 reply; 36+ messages in thread
From: E. Robert Tisdale @ 2000-08-31 17:25 UTC (permalink / raw)
  To: gsl-discuss

Brian Gough writes:

> E. Robert Tisdale writes:
> 
> > The GSL should allow application programmers
> > to create FFT objects like the "plan" object in FFTW.
> > The overhead of creating an FFT object is amortized
> > over several invocations of an FFT of a particular length.
> 
> Yes, this is how it works --
> see the documentation for gsl_fft_complex_alloc
> in the manual for details.

The FFT object (what you call a gsl_fft_wavetable_complex) is OK.
But then you go on to itemize the private members:

	typedef struct {
	  size_t n;
	  size_t nf;
	  size_t factor[64];
	  gsl_complex *twiddle[64];
	  gsl_complex *trig;
	  double *scratch;
	  } gsl_fft_wavetable_complex;


Why did you do this?
It isn't necessary for the application programmer
to have any of this information.
You present it in the manual as if it is part of the API.
Did you really need to make a commitment
to this particular algorithm
and this particular data representation?
I don't think so.
I think that you've painted yourself into a corner
and you will be obliged to support this particular
data representation and the implied algorithm forever.

There is almost never any one best algorithm
much less one best implementation of anything
in numerical computing.
No matter how gifted and careful you are,
your implementation and/or data representation
is likely to be suboptimal on some platform.
It is best to hide as many details
of the data representation and/or implementation
so that you or some other programmer can re-implement
the functionality without breaking
any of the applications which depend upon it.

If, on the other hand, you only meant to describe
the data representation and algorithm
that you were implementing, you should have
separated it from the specification of the API -- 
preferably, in another document.

^ permalink raw reply	[flat|nested] 36+ messages in thread
* Re: gsl Development Query
@ 2000-08-30 16:18 E. Robert Tisdale
  2000-08-31 12:28 ` Brian Gough
  0 siblings, 1 reply; 36+ messages in thread
From: E. Robert Tisdale @ 2000-08-30 16:18 UTC (permalink / raw)
  To: gsl-discuss

Please take a look at
the Vector, Signal and Image Processing Library (VSIPL)

    http://www.vsipl.org/

Lots of really smart people have been working very hard on
a digital signal processing library API standard for over four years now.
The VSIPL ANSI C language binding is very similar
to the GSL ANSI C language binding.

Yes.  The GSL should allow application programmers
to create FFT objects like the "plan" object in FFTW.
The overhead of creating an FFT object is amortized
over several invocations of an FFT of a particular length.
The GSL really should include an entire "wing"
devoted to digital signal processing.  The application programmer
should be able to create and invoke convolver, correlation,
filter and decomposition objects as well as FFT objects.

^ permalink raw reply	[flat|nested] 36+ messages in thread
* PPC Linux Bugs, and a perplexing problem
@ 2000-08-25  3:34 F J Franklin
  2000-08-30  6:07 ` gsl Development Query F J Franklin
  0 siblings, 1 reply; 36+ messages in thread
From: F J Franklin @ 2000-08-25  3:34 UTC (permalink / raw)
  To: gsl-discuss

Discovered GSL only this week, and must say I'm *very* impressed! However...

> Until we have set up a separate bug reporting address, please report
> bugs to the GSL discussion list gsl-discuss@sourceware.cygnus.com

Compiled & checked happily enough on my (x86) desktop, but not on my (G3) 
laptop. (This is the first time I've ever submitted a bug report, so please 
forgive me if I have got the format all wrong.)

Has anyone succeeded in compiling & checking GSL-0.6 for PPC Linux?

Frank

Francis James Franklin
fjf@alinameridon.com

Diodorus the professor of logic died of shame because he could not at once 
solve a problem put to him in jest by Stilpo.
                                                       --- Pliny the Elder

=============================== Bugs ===============================

 (1) `make' Error
 (2) `make check' Errors
 (3) Puzzling PPC Problem

GSL 0.6

LinuxPPC 2000 on Apple iBook SE
kernel: linux-2.2.17pre13-ben1
compiler: gcc-2.95.2
libc & libm: glibc-2.1.3

(1) `make' Error
    ============

Neither of the following options is (or can be) set in config.h 
/* #undef HAVE_M68KLINUX_IEEE_INTERFACE */
/* #define HAVE_LINUX_IEEE_INTERFACE 1 */

FYI:

In /usr/include/fpu_control.h:
_FPU_SINGLE,_FPU_DOUBLE,_FPU_EXTENDED                     *Not* defined
_FPU_RC_NEAREST,_FPU_RC_DOWN,_FPU_RC_UP,_FPU_RC_ZERO      Defined
_FPU_MASK_IM,_FPU_MASK_ZM,_FPU_MASK_OM,_FPU_MASK_UM       Defined
_FPU_MASK_DM                                              *Not* defined
_FPU_MASK_PM                                              *Not* defined

However, defined in /usr/include/fpu_control.h is (cf. _FPU_MASK_PM ?)
/* masking of interrupts */
#define _FPU_MASK_XM  0x08 /* inexact */

(2) `make check' Errors
    ===================

(a) BLAS
    ====

Segmentation fault!
Source: In `int test_gbmv(void)' in `gsl-0.6/blas/test_blas_raw.c'

  gsl_blas_raw_dcopy(4, vector_4_d, 1, tmp_d, 1);
  gsl_blas_raw_dgbmv(CblasNoTrans, 4, 4, 1, 2, 2.0, matrix_gen_4_d, 4, vector_4_d, 1, 3.0, tmp_d, 1);
  s = ( tmp_d[0] != -10.0 || tmp_d[1] != -5.0 || tmp_d[2] != 7.0 || tmp_d[3] != 9.0 );
  gsl_test(s, "gsl_blas_raw_dgbmv A");
  status += s;

  gsl_blas_raw_dcopy(4, vector_4_d, 1, tmp_d, 1);
  gsl_blas_raw_dgbmv(CblasNoTrans, 4, 4, 1, 2, 2.0, matrix_gen_4_d, 4, vector_4_z, 2, 3.0, tmp_d, 1);
  s = ( tmp_d[0] != -10.0 || tmp_d[1] != -5.0 || tmp_d[2] != 7.0 || tmp_d[3] != 9.0 );
  gsl_test(s, "gsl_blas_raw_dgbmv B");
  status += s;

Commenting these out `removes' the problem... (more on this later; see below)

(b) MONTE [This is listed in KNOWN-PROBLEMS, I see...]
    =====

Testing double gaussian
FAIL: vegas(f2), dim=9, err=0.0003, chisq=0.6418 (0.499681001846611517 observed vs 1 expected)
FAIL: vegas_test

*** Rather suspicious factor of 2 here! (to state the obvious)

(c) SPECFUNC
    ========

FAIL:   gsl_sf_hyperg_1F1_int_impl(100, 400, 100.0, &r)
  test_hyperg.c 73
  expected:     907123037681.855
  obtained:    907123037681.8558    0.04068719885713332  4.4853e-14
  fracdiff: 4.709902361666654e-16
  value not within tolerance of expected value
     907123037681.855835   0.0406871988571333165
FAIL:   gsl_sf_hyperg_U_int_impl(-90, 1, 10, &r)
  test_hyperg.c 323
  expected: -1.898767714922189e+139
  obtained: -1.898767714922192e+139   1.543096725201747e+126  8.12683e-14
  fracdiff: 6.962999882451004e-16
  value not within tolerance of expected value
  -1.8987677149221916e+139  1.54309672520174719e+126
FAIL:   gsl_sf_hyperg_U_int_impl(-90, 10, 10, &r)
  test_hyperg.c 324
  expected: -5.682999988842067e+143
  obtained: -5.682999988842072e+143   4.618478923559706e+130  8.12683e-14
  fracdiff: 4.573953621928294e-16
  value not within tolerance of expected value
  -5.68299998884207181e+143  4.61847892355970615e+130
FAIL:   gsl_sf_hyperg_U_impl(1, 1.2, 2.0, &r)
  test_hyperg.c 360
  expected:   0.3835044780075603
  obtained:   0.3835044780075599   9.696010384367307e-16  2.52827e-15
  fracdiff: 5.066147605858526e-16
  value not within tolerance of expected value
    0.383504478007559879  9.69601038436730741e-16
FAIL:   gsl_sf_hyperg_U_impl(-50.5, 100.1, 40, &r)
  test_hyperg.c 387
  expected: 5.937463786613894e+91
  obtained: 5.937463786613886e+91   8.703956648586891e+79  1.46594e-12
  fracdiff: 6.703793421875711e-16
  value not within tolerance of expected value
  5.93746378661388571e+91  8.70395664858689101e+79
FAIL:   gsl_sf_hyperg_2F1_conj_impl(25, 25, 1, -0.5, &r)
  test_hyperg.c 424
  expected: 5.16969440956632e-06
  obtained: 5.169694409691514e-06   5.713800742253134e-17  1.10525e-11
  fracdiff: 1.210837176728465e-11
  value/expected not consistent within reported error
  5.16969440969151365e-06  5.71380074225313361e-17
FAIL:   gsl_sf_hyperg_2F1_conj_renorm_impl(9, 9, -1.5, -0.99, &r)
  test_hyperg.c 454
  expected:   0.1083402022947613
  obtained:   0.1083402022947615   4.247728659543883e-13  3.92073e-12
  fracdiff: 1.152850812762138e-15
  value not within tolerance of expected value
    0.108340202294761503  4.24772865954388333e-13
FAIL: Hypergeometric Functions

FAIL:   gsl_sf_laguerre_n_impl(90, 2.0, 100.0, &r)
  test_sf.c 873
  expected: -2.092904225954693e+20
  obtained: -2.09290422595469e+20      50333025.30505015  2.40494e-13
  fracdiff: 7.82835630833816e-16
  value not within tolerance of expected value
  -2.09290422595468952e+20     50333025.3050501496
FAIL: Laguerre Polynomials

FAIL:   gsl_sf_synchrotron_2_impl(0.01, &r)
  test_sf.c 1083
3
  obtained:   0.1083402022947615   4.247728659543883e-13  3.92073e-12
  fracdiff: 1.152850812762138e-15
  value not within tolerance of expected value
  expected:   0.2309807734222628
  obtained:   0.2309807734222623   1.877351636458429e-16  8.12774e-16
  fracdiff: 9.613120678191913e-16
  value/expected not consistent within reported error
    0.230980773422262337  1.87735163645842852e-16
FAIL: Synchrotron Functions

(3) Puzzling PPC Problem
    ====================

GSL-0.6 compiles and checks for x86-Linux, but not for iBook Linux. As far as 
I can tell, the code itself is not at fault, but I have isolated the problem 
in the following extract-example program. The output is given below; note how 
args 12 & 13 get messed up.

Can anybody tell me what, if anything, may be wrong with the following code?
(The program behaves as expected when compiled on my x86, so the problem is
probably PPC-specific.)

Interestingly, the problem vanishes if every instance of `double' is replaced
by `float'...

=============================== test.c ===============================

#include <stdio.h>

typedef enum CBLAS_TRANSPOSE
{  CblasNoTrans   = 111,
   CblasTrans     = 112,
   CblasConjTrans = 113
} CBLAS_TRANSPOSE_t;

const double     vector_4_d[] = { -2.0, -1.0, 0.0, 3.0 };
const double matrix_gen_4_d[] = 
{
  1.0,  0.0, -2.0, 1.0, 
  0.5,  3.0,  5.0, 1.0,
  2.0, -2.0, -1.0, 0.5,
  1.0, -1.0,  0.5, 0.0
};

void dgbmv (CBLAS_TRANSPOSE_t TransA,
            size_t M, size_t N, size_t KL, size_t KU,
            double alpha,
            const double A[], int lda,
            const double X[], size_t incX,
            double beta,
            double Y[], size_t incY)
{
  fprintf (stderr,"dgbmv: TransA = %d\n", (int) TransA);
  fprintf (stderr,"dgbmv: M      = %d\n", (int) M);
  fprintf (stderr,"dgbmv: N      = %d\n", (int) N);
  fprintf (stderr,"dgbmv: KL     = %d\n", (int) KL);
  fprintf (stderr,"dgbmv: KU     = %d\n", (int) KU);
  fprintf (stderr,"dgbmv: alpha  = %lf\n",alpha);
  fprintf (stderr,"dgbmv: A      = %p\n", A);
  fprintf (stderr,"dgbmv: lda    = %d\n", lda);
  fprintf (stderr,"dgbmv: X      = %p\n", X);
  fprintf (stderr,"dgbmv: incX   = %d\n", (int) incX);
  fprintf (stderr,"dgbmv: beta   = %lf\n",beta);
  fprintf (stderr,"dgbmv: Y      = %p\n", Y);
  fprintf (stderr,"dgbmv: incY   = %d\n", (int) incY);
}

int main()
{
  double tmp_d[32];

  fprintf (stderr,"dgbmv: tmp_d          = %p\n",tmp_d);
  fprintf (stderr,"dgbmv: vector_4_d     = %p\n",vector_4_d);
  fprintf (stderr,"dgbmv: matrix_gen_4_d = %p\n",matrix_gen_4_d);

  dgbmv(CblasNoTrans,4,4,1,2,2.0,matrix_gen_4_d,4,vector_4_d,1,3.0,tmp_d,1);
}

=============================== PPC output ===============================

dgbmv: tmp_d          = 0x7ffffb18
dgbmv: vector_4_d     = 0x10000730
dgbmv: matrix_gen_4_d = 0x10000750
dgbmv: TransA = 111
dgbmv: M      = 4
dgbmv: N      = 4
dgbmv: KL     = 1
dgbmv: KU     = 2
dgbmv: alpha  = 2.000000
dgbmv: A      = 0x10000750
dgbmv: lda    = 4
dgbmv: X      = 0x10000730
dgbmv: incX   = 1
dgbmv: beta   = 3.000000
dgbmv: Y      = 0x1
dgbmv: incY   = 805388944

=============================== x86 output ===============================

dgbmv: tmp_d          = 0xbffffad8
dgbmv: vector_4_d     = 0x8048668
dgbmv: matrix_gen_4_d = 0x8048688
dgbmv: TransA = 111
dgbmv: M      = 4
dgbmv: N      = 4
dgbmv: KL     = 1
dgbmv: KU     = 2
dgbmv: alpha  = 2.000000
dgbmv: A      = 0x8048688
dgbmv: lda    = 4
dgbmv: X      = 0x8048668
dgbmv: incX   = 1
dgbmv: beta   = 3.000000
dgbmv: Y      = 0xbffffad8
dgbmv: incY   = 1

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2000-09-04 14:27 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-09-01 18:58 gsl Development Query E. Robert Tisdale
2000-09-02  0:12 ` Eleftherios Gkioulekas
2000-09-02 15:12 ` Gerard Jungman
  -- strict thread matches above, loose matches on Subject: below --
2000-09-04 13:10 E. Robert Tisdale
2000-09-04 13:00 E. Robert Tisdale
2000-09-04 12:38 E. Robert Tisdale
2000-09-04 13:00 ` Steve ROBBINS
2000-09-03 17:34 E. Robert Tisdale
2000-09-03 16:20 E. Robert Tisdale
2000-09-03 17:22 ` Randall Judd
2000-09-04 11:45   ` Brian Gough
2000-09-02 16:31 E. Robert Tisdale
2000-09-04 11:39 ` Steve ROBBINS
2000-09-02  9:22 E. Robert Tisdale
2000-09-01 15:18 E. Robert Tisdale
2000-09-01 14:26 E. Robert Tisdale
2000-08-31 21:37 E. Robert Tisdale
2000-09-01 13:33 ` Gerard Jungman
2000-08-31 17:25 E. Robert Tisdale
2000-09-01 13:32 ` Gerard Jungman
2000-08-30 16:18 E. Robert Tisdale
2000-08-31 12:28 ` Brian Gough
2000-08-25  3:34 PPC Linux Bugs, and a perplexing problem F J Franklin
2000-08-30  6:07 ` gsl Development Query F J Franklin
2000-08-30  8:15   ` Thomas Walter
2000-08-30 10:46   ` Brian Gough
2000-08-30 12:10     ` Gerard Jungman
2000-08-31 12:28       ` Brian Gough
2000-08-31 14:38         ` Gerard Jungman
2000-08-31 15:53           ` Randall Judd
2000-09-01 14:53             ` Gerard Jungman
2000-09-01 16:46               ` Randall Judd
2000-09-02 14:56                 ` Gerard Jungman
2000-09-03 14:29                   ` Randall Judd
2000-09-04 11:45                     ` Brian Gough
2000-09-04 14:27                       ` Randall Judd
2000-08-31 16:15           ` Brian Gough

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).