From: Paul H. Hargrove (hargrove_at_hpcrd_dot_lbl_dot_gov)
Date: Fri Aug 01 2008 - 15:00:27 PDT
George, We've assigned bug #2314 to this issue: http://upc-bugs.lbl.gov/bugzilla/show_bug.cgi?id=2314 Costin Iancu, our complier expert, was able to fix this bug in our development version. We plan a release for October which will include this fix. In the meantime, it is possible to access a fixed translator by compiling with "--translator=http://upc-translator.lbl.gov/upcc-nightly-dev.cgi" on the upcc command line, or by adding "translator=http://upc-translator.lbl.gov/upcc-nightly-dev.cgi" to ~/.upccrc However, be aware that this translator is experimental and might have different bugs. -Paul George Caragea wrote: > Hi all, > > I am using berkeley-upc-2.6.0 on an i686 Linux machine, with the online > translator. I am using the smp conduit, with pthreads (although I > disabled pthreads to pinpoint the problem). I think I have encountered > a bug either with the translator or the run-time system. > > I am running the program below with one single thread (pthreads > disabled), but I cannot get the correct result. The program I am trying > to run is : > > -------------- > #include <upc_relaxed.h> > #include <stdio.h> > #include <upc.h> > > shared int *twiddle; > //shared [1] int twiddle[2]; > > int main(){ > > twiddle = (shared int *) upc_all_alloc(1, 2*sizeof(int)); > > int TID=0; > int index = 1-TID; > > twiddle[TID] = 1; > twiddle[1-TID] = 2; > //twiddle[index] = 2; > > if(MYTHREAD == 0) { > int i; > for(i=0;i<2;i++){ > printf("%d\n", twiddle[i]); > } > upc_free(twiddle); > } > } > --------------- > > I am compiling and running this with: > $ upcc -T 1 -pthreads=0 fft_1.upc -o fft_1 > $ upcrun fft_1 > > However, instead of printing the values 1 and 2, I get some random > numbers in the array. > > The problem seems to come from the line twiddle[1-TID]=2. If I use > twiddle[index] instead, it works just fine. I think there is some > casting problem. Running upcc -v I get these warnings from the translator: > > !!!rearranging upc pointer arithmetic expression failed!!! > [...] > internal translator warning (from fft_1.upc:16): Attempt to directly > cast to upcr_{p}shared_ptr_t > > Am I doing something incorrect in the code? Note that when I compile and > run this on a x86_64 machine, it works fine. This makes me think there > is a problem with casting between 32b/64b pointers and values, which > seems to be the case when I look in the output of the translator. The > problem also happens when I use an array instead of upc_all_alloc(). > > I am attaching my upcc --version output and the output of the translator > for reference. > > Thank you, > George > -- Paul H. Hargrove PHHargrove_at_lbl_dot_gov Future Technologies Group HPC Research Department Tel: +1-510-495-2352 Lawrence Berkeley National Laboratory Fax: +1-510-486-6900