Re: [GSLL-devel] [Gsll-devel] Efficient access to externally generated double-float arrays?

2010-11-14 Thread Liam Healy
OK, I've now committed what I think is my last attempt at this. This latest version includes optimization of matrices and setting values in foreign arrays. This latter comes with a caveat however. The compiler will macroexpand setf, and for SBCL at least, that means making temporary variables to

Re: [GSLL-devel] [Gsll-devel] Efficient access to externally generated double-float arrays?

2010-11-14 Thread Liam Healy
On Sun, Nov 14, 2010 at 10:24 AM, Sebastian Sturm wrote: > My apologies for taking so long to answer. I have verified that the new gref* > can now be used without consing and comes relatively close to the > unconvenient cffi:mem-aref solution in terms of computation time. Many thanks > for that

Re: [GSLL-devel] [Gsll-devel] Efficient access to externally generated double-float arrays?

2010-11-14 Thread Sebastian Sturm
My apologies for taking so long to answer. I have verified that the new gref* can now be used without consing and comes relatively close to the unconvenient cffi:mem-aref solution in terms of computation time. Many thanks for that! I also tried the functions on matrices, which still results in s

Re: [GSLL-devel] [Gsll-devel] Efficient access to externally generated double-float arrays?

2010-11-07 Thread Liam Healy
OK, this turned out to be a lot harder than I thought. I have done three things: 1) I have defined gref* and (setf gref*) methods specific to each of the foreign-array types that call cffi:mem-aref. This gives about 20x speedup because I am now passing the literal type to cffi:mem-aref, so it can

Re: [GSLL-devel] [Gsll-devel] Efficient access to externally generated double-float arrays?

2010-10-29 Thread Sebastian Sturm
Liam, I'm sorry, I now see a difference between the original gref* and your modified version of it. I guess I forgot to reload the Lisp image last time, so both timings had been obtained using the new gref*. There is still consing, but it's already reduced by a factor of three. Can be reduced b

Re: [GSLL-devel] [Gsll-devel] Efficient access to externally generated double-float arrays?

2010-10-28 Thread Liam Healy
Sebastian, Trying to walk code correctly is a nasty business, and generally non-portable, so I'd stay away from it. We could do this with a macro/macrolet pair but I'd like to optimize via the CLOS route if we can. Liam On Thu, Oct 28, 2010 at 1:01 PM, Sebastian Sturm wrote: > Here is somethi

Re: [GSLL-devel] [Gsll-devel] Efficient access to externally generated double-float arrays?

2010-10-28 Thread Liam Healy
Sebastian, I'm very puzzled by this. You should now have the type :double hard-wired in the CFFI call. Can you run your big test with and without this function defined, instead of just the grid:gref* test? If it still shows no improvement, that says that the problem is not in the binding of type

Re: [GSLL-devel] [Gsll-devel] Efficient access to externally generated double-float arrays?

2010-10-28 Thread Sebastian Sturm
Here is something similar to what I suggested, although still very unfinished. It's probably not the proper way to write a macro, but I guess other people on the list will know how to do it correctly. Efficient linearization can be added in the same manner; also, the macro should be modified s.t

Re: [GSLL-devel] [Gsll-devel] Efficient access to externally generated double-float arrays?

2010-10-28 Thread Sebastian Sturm
Liam, I have tried this and (without using (the double-float (...)) since this is unnecessary for cffi:mem-aref with hardcoded :double data type), I get the following timing data: using the standard grid:gref routine: Evaluation took: 0.542 seconds of real time 0.536671 seconds of total run tim

Re: [GSLL-devel] [Gsll-devel] Efficient access to externally generated double-float arrays?

2010-10-26 Thread Liam Healy
Sebastian, Can you temporarily define this and find the timing/consing for your test case: (defmethod gref* ((object vector-double-float) linearized-index) (cffi:mem-aref (foreign-pointer object) :double linearized-index)) (I think you don't use any matrices but if you do, define an a

Re: [GSLL-devel] [Gsll-devel] Efficient access to externally generated double-float arrays?

2010-10-25 Thread Liam Healy
On Fri, Oct 22, 2010 at 2:13 PM, Sebastian Sturm wrote: >> I'm surprised about the grid:gref result.   Please run a profiler and >> confirm that the time consumed is within grid:gref and its callees, > > I tried using sb-sprof, but as a complete CL newbie I had a hard time making > sense of its o