- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to cilkify a program that now hasthe following loop
cilk_for(i=o;i<(*Env).Nfreq;I++)
I got the error:
Cilk_for initialization must be a declaration. I know that on cilkifying c++ you must declare i to be an intteger, but you do not have to do this in c. My program is in c. However, just to experiment I added int i=0 instead of i=0. I got the same error. What is going on? It should have no problemusing i=o without i beingdeclared an integer.
Thanks in advance.
Newport_j
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Barry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The screenshot is a picture of the output after I tried to compile. It gives the exact source code and the compiler response. I should not have to specify i to be an integer. IfI do specify i to be an integer, then I still get the same error.
Any help appreciated.
Newport_j
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Iam using the icc command - not icpc. I will show you the complete command asI used it.I have attached a screenshot so now nothing is hidden. I have also included a cut down version of the file prc_ray2.c. By simply using the command
icc prc_ray2.c
you will see the output. You will also see a lot irrelevant errors. please ignore them, they are not important. The only error that matters is on line 116. The last error.
I have so many of these in my legacy code; I must find a solution to this problem.I have so many similar occurences; a solution is needed orI cannot use Intel Cilk Plus. Why is it insisting on a declaration when it says in the manual (andI have proven in other examples) that when using c one does not have to declare the for loop index. In additonifIinsert a declare, it then still gives sameerror messages.
I read that it might be a spacing problem. I hope not. I added spaces about 1 hour ago and got no improvement.
Newport_j
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Something's not right. Thejpeg of the buildclaims that the error is on line 163. Looking at the source you provided, line 163 is in the middle of the call to VRT_RAY2 after the comment "Unfold trailing rays into virtual rays."
Also, there's no way we can compile the file. There are include files we don't have, from WAFmutex.h to WEGFunDefs.h.
Is there any possibility of extracting this down to just something simple like thecilk_forafter the comment "Initializeweighted sums."? We'dstill need the definition of Env, but it would be a start. When we try to use sample code like:
#includeint main() { int i; int ary[42]; cilk_for(i = 0; i < 42; i++) ary = i; return 0; }
It compiles as expect, issuing an error with the command
icpc newport_j.c
And compiles correctly with the command
icc newport_j.c
- Barry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I took a snapshotafter the compile to answer the previous postabout maybe I used icpc. I did not use icpc! I used icc. I then modified the files to send to you asmall example of the file. I did at that point changes the line number.I removed several ines.
I will send to you my output on runing the file with icc. I will show you that it does not workfor me.I get the initilization error. I also sent output when I gave the command:
icc -v.
I must solve this.
See attached files.
Newport_j
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jim pointed out something that appears to reproduce the problem you're seeing:
#includeint main() { int j, k; int ary[42]; cilk_for(j = 0; j < 42; j++) { ary = j; cilk_for(k = 0; k < 42; k++) { ary = k; } } return 0; }
In your code, you've got nested cilk_for's in PRC_RAY2:
- the loop indexed by "IRAY"
- the loop nestedunder itindexed by "i"
The inner loop will be racing to access "i", which is declared at the function-level scope. In my example, moving the declaration of "k" into the outer cilk_for fixed the problem.
Fixed code:
#includeint main() { int j; int ary[42]; cilk_for(j = 0; j < 42; j++) { int k; ary = j; cilk_for(k = 0; k < 42; k++) { ary = k; } } return 0; }
I'm going to submit this to the compiler group since it's a confusing error message. But it is an error.
- Barry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Barry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For those trying to track this issue, my bug has been closed as a duplicate of DPD200261033.
- Barry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Barry
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page