/* UPC Testing Suite Copyright (C) 2000 Chen Jianxun, Sebastien Chauvin, Tarek El-Ghazawi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** Test: I_case5_ii -- Test the blocked array of structures. Purpose: To check that the elements of the blocked array of a structure can be accessed by all threads and the affinity of the members of the structure in the shared array. Type: Positive. How : - Declare a blocked array of structure. - Assign the initial value to the elements of the array by each thread, with forall statement. - All threads check that they can see the same values. Otherwise, an error message should be returned. - Check the affinity of the elements of the array using upc_threadof(). If its affinity is not correct, an error message should be returned. */ #include #include #include #define NUMBER 100 #define BLOCK 8 struct foo { char No; int a[NUMBER]; }; shared[BLOCK] struct foo barray[THREADS]; int main() { int i,j, pe=MYTHREAD; int errflag=0; int sum; shared [] char *pNo; shared [] int *psa; // // the value of the blocked shared array of structure value // is set by thread 0. // if (pe==0) { for(i=0; i