[sac-user] Need more help on pass by reference

Salem Reyen salemreyen at yahoo.com
Thu Aug 26 14:10:53 CEST 2010


Carl,

  I have not got a chance to check on your code.  I am basically still working to see if the BLAS binding can pass the standard test suite.  Unfortunately, the suite was in FORTRAN (written in 70s).  And I have wasted so much time trying to cheat it by using f2c.  But some BLAS still failed the test and f2c doesn't support 64 bit integer, so I have no choice but to hack the FORTRAN code to call SaC directly.  It'll take sometime but I'll get it done. 

  Anyway, thanks for your help.

Salem

--- On Mon, 8/23/10, Carl Alan Joslin <carl.joslin at joslinfamily.co.uk> wrote:

From: Carl Alan Joslin <carl.joslin at joslinfamily.co.uk>
Subject: Re: [sac-user] Need more help on pass by reference
To: "sac user mailing list" <sac-user at sac-home.org>
Date: Monday, August 23, 2010, 7:27 AM

Hello Salem

Over the weekend I produce an example for you that adds to vectors,
making use of the advanced C interface.  The main advantage is that this
saves on potential copying and memory allocation.

The function takes 2 double vectors and adds them together, trying to
reuse the memory of one of the vectors if it can.

The code assumes that the two vectors are the same length.

I do not know if it will be help full.

Carl

On Sat, 2010-08-21 at 20:35 -0700, Salem Reyen wrote:
> I have a C function which adds two double precision vectors, ie, 
> add(double* X, double *Y, double* Z) where vectors X and Y are
> the input vectors and Z is the output vector.  In SaC, I declare
> A, B, C to be double precision vectors.
> 
> Based on Bodo's example, I can declare
> 
> external double[.] add(double[.] X, double[.] Y, double[.] Z);
> #pragma linksign[3,1,2,3]
> 
> And then I can call the function add for C = A + B by
> C = add(A, B, C);
> 
> Now my question is how can SaC compiler handle the cases such as
> A = A + B and A = A + A?
> 
> Salem
> 
> 
> 
> 
> _______________________________________________
> sac-user mailing list
> sac-user at sac-home.org
> http://lists.sac-home.org/mailman/listinfo.cgi/sac-user


-----Inline Attachment Follows-----

_______________________________________________
sac-user mailing list
sac-user at sac-home.org
http://lists.sac-home.org/mailman/listinfo.cgi/sac-user



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sac-home.org/pipermail/sac-user/attachments/20100826/37c72107/attachment-0002.html>


More information about the sac-user mailing list