Re: Error while running

114 views
Skip to first unread message
Message has been deleted

Cédric Bastoul

unread,
Sep 22, 2015, 9:44:10 AM9/22/15
to clan-...@googlegroups.com
Hi Shivam Malhotra,
yes, the problem is that you cannot use j as an index in xp[j][1] because it is not a loop counter nor a parameter but a variable just as reported by Clan. I did a cheat sheet to detail the constraints on Clan's input available here :

Best regards,

Cedric

[Clan] Error: variable or array reference in an affine expression at line 5, column 29.
        dxij[1]=xp[i][1]-xp[j][1];

                         ~~~^

On Tue, Sep 22, 2015 at 2:58 PM, Shivam Malhotra <malhotr...@gmail.com> wrote:
Hi everybody
I am a student in India working on pluto compiler, which uses clan for polyhedral representation extractor.
I tried running some simple test programs but could not understand the errors.
The main part of program is like

#pragma scop
for (i=Nboun+1;i<=Npartstot;++i){
    for (n=1;n<=3;++n){
        j=neb[i][n];
        dxij[1]=xp[i][1]-xp[j][1];
        if(dxij[1]>L-rng*(R[i]+R[j])) dxij[1]=dxij[1]-L;
        else if (dxij[1]<-L+rng*(R[i]+R[j])) dxij[1]=dxij[1]+L;
        dxij[2]=xp[i][2]-xp[j][2];
        dxij[3]=xp[i][3]-xp[j][3];
        }
     }
#pragma endscop

The error shown by clan is
[Clan] Error: variable or array reference in an affine expression at line 291, column 23.
Error extracting polyhedra from source file: 'chute_sizesegr.c'

Line 291 is the second line inside the for loop, ie. the dxij[1] line. Can somebody please explain what am I doing wrong?

--
You received this message because you are subscribed to the Google Groups "Clan Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clan-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

Uday R Bondhugula

unread,
Sep 23, 2015, 7:39:29 AM9/23/15
to clan-...@googlegroups.com, Shivam Malhotra


On Wednesday 23 September 2015 05:02 PM, Shivam Malhotra wrote:
> Sir,
>
> Thank you so much for your quick reply.
> I have another issue that I wanted to clarify.
> Actually the j value that appears in xp[j][i] will only be used for
> reading and never for writing. So any dependency that can happen is RAR.
> Thus should not affect my code if I run these iterations in parallel.( I
> hope I am making sense, please correct me if I am wrong).

Yes, you are right.

> So is there any way to force CLAN to give a a polyhedral representation
> so that we can use that with Pluto?

It would be good if Clan can, but here's a workaround. If you have say
A[xp[j][i]], you can have the following outside the scop:

#define f(s) A[s]

and then just use f(xp[j][i]) in the scop. As you say, this will work
only if A is not being written to in the scop.

~ Uday




>
> Regards
> Shivam
> it, send an email to clan-users+...@googlegroups.com <javascript:>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clan Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to clan-users+...@googlegroups.com
> <mailto:clan-users+...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
> believed to be clean.

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Cédric Bastoul

unread,
Sep 23, 2015, 7:49:49 AM9/23/15
to clan-...@googlegroups.com, Shivam Malhotra
On Wed, Sep 23, 2015 at 1:39 PM, Uday R Bondhugula <ud...@csa.iisc.ernet.in> wrote:


On Wednesday 23 September 2015 05:02 PM, Shivam Malhotra wrote:
Sir,

Thank you so much for your quick reply.
I have another issue that I wanted to clarify.
Actually the j value that appears in xp[j][i] will only be used for
reading and never for writing. So any dependency that can happen is RAR.
Thus should not affect my code if I run these iterations in parallel.( I
hope I am making sense, please correct me if I am wrong).

Yes, you are right.

So is there any way to force CLAN to give a a polyhedral representation
so that we can use that with Pluto?

It would be good if Clan can, but here's a workaround. If you have say A[xp[j][i]], you can have the following outside the scop:

#define f(s)  A[s]

and then just use f(xp[j][i]) in the scop. As you say, this will work only if A is not being written to in the scop.

Yep, perfect workaround :-) !
++

Cedric
 
To unsubscribe from this group and stop receiving emails from it, send an email to clan-users+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages