Log In | Get Help   
Home My Page Projects Code Snippets Project Openings UPC Operations Microbenchmarking Suite
Summary Activity Tracker Lists Docs News SCM Files
[uoms] Diff of /trunk/uoms/src/UOMS.upc
[uoms] / trunk / uoms / src / UOMS.upc Repository:
ViewVC logotype

Diff of /trunk/uoms/src/UOMS.upc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 13, Wed May 12 11:28:19 2010 UTC revision 14, Mon Nov 29 18:07:07 2010 UTC
# Line 1  Line 1 
1  /*****************************************************************************/  /******************************************************************************/
2  /*                                                                           */  /*                                                                           */
3  /*  Copyright (c) 2008, 2009, 2010                                           */  /*  Copyright (c) 2008, 2009, 2010                                           */
4  /*                         Computer Architecture Group (CAG)                 */  /*                         Computer Architecture Group (CAG)                 */
# Line 24  Line 24 
24  /*  You should have received a copy of the GNU Lesser General Public License */  /*  You should have received a copy of the GNU Lesser General Public License */
25  /*  along with UOMS.  If not, see <http://www.gnu.org/licenses/>.            */  /*  along with UOMS.  If not, see <http://www.gnu.org/licenses/>.            */
26  /*                                                                           */  /*                                                                           */
27  /*****************************************************************************/  /******************************************************************************/
28    
29  /*****************************************************************************/  /******************************************************************************/
30  /*                                                                           */  /*                                                                           */
31  /*    FUNDING: This development has been funded by Hewlett-Packard Spain     */  /*    FUNDING: This development has been funded by Hewlett-Packard Spain     */
32  /*                                                                           */  /*                                                                           */
# Line 35  Line 35 
35  /*    Subproject:                                                            */  /*    Subproject:                                                            */
36  /*     Improving UPC Usability and  Performance in Constellation Systems:    */  /*     Improving UPC Usability and  Performance in Constellation Systems:    */
37  /*     Implementation/Extensions of UPC Libraries.                           */  /*     Implementation/Extensions of UPC Libraries.                           */
38  /*     (UPCPU­Project -> UPC Performance and Usability Project)               */  /*     (UPCPUProject -> UPC Performance and Usability Project)                */
39  /*                                                                           */  /*                                                                           */
40  /*****************************************************************************/  /******************************************************************************/
41    
42  /*****************************************************************************  /******************************************************************************
43    
44    For further documentation, see    For further documentation, see
45    
46    [1] Files under doc/    [1] Files under doc/
47    
48  ******************************************************************************/  *******************************************************************************/
49    
50  #include <sched.h>  #include <sched.h>
51  #include <stdio.h>  #include <stdio.h>
# Line 150  Line 150 
150  upc_flag_t sync_mode = UPC_IN_ALLSYNC | UPC_OUT_ALLSYNC;  upc_flag_t sync_mode = UPC_IN_ALLSYNC | UPC_OUT_ALLSYNC;
151  char * char_sync_mode = "UPC_IN_ALLSYNC|UPC_OUT_ALLSYNC";  char * char_sync_mode = "UPC_IN_ALLSYNC|UPC_OUT_ALLSYNC";
152    
153    int global_aux_var = 0;
154    
155  int main(int argc, char **argv)  int main(int argc, char **argv)
156  /*  /*
157    
# Line 333  Line 335 
335                                  nbuckets=1;                                  nbuckets=1;
336                          }                          }
337    
338                          if(allocate_arrays(operation_code,cursize,nbuckets) == -1) // Unsuccesfully allocation                          if(allocate_arrays(operation_code,cursize,nbuckets) == -1) // Unsuccessful allocation
339                                  continue;                                  continue;
340    
341                          upc_barrier;                          upc_barrier;
# Line 363  Line 365 
365                                  upc_barrier;                                  upc_barrier;
366                                  end = getTicks() - start;                                  end = getTicks() - start;
367    
368                                    /*
369                                            For this benchmark the array should be freed per iteration
370                                    */
371                                  if(operation_code == ALLALLOC){                                  if(operation_code == ALLALLOC){
372                                          UPCMEM_OK(mem_alloc_tests_pointer);                                          UPCMEM_OK(mem_alloc_tests_pointer);
373                                          if(mem_is_ok == -1)                                          if(mem_is_ok == -1)
# Line 422  Line 427 
427  */  */
428  void function(int operation_code, long int cursize,long int offset){  void function(int operation_code, long int cursize,long int offset){
429    
430            int aux_var = 0;
431    
432          switch (operation_code) {          switch (operation_code) {
433                    case FORALL_R:
434                            upc_forall(int i = offset; i < cursize*THREADS+offset; i++; &distArr[i]){
435                                    aux_var+=distArr[i];
436                            }
437                            /*
438                                    Some compilers with aggressive optimizations may drop the whole loop if they detect that
439                                    aux_var is not going to be used. Writing its value to an external variable may prevent this.
440                            */
441                            global_aux_var = aux_var;
442                            break;
443                    case FORALL_W:
444                            upc_forall(int i = offset; i < cursize*THREADS+offset; i++; &distArr[i]){
445                                    distArr[i] = i;
446                            }
447                            break;
448                    case FORALL_RW:
449                            upc_forall(int i = offset; i < cursize*THREADS+offset; i++; &distArr[i]){
450                                    distArr[i] += i;
451                            }
452                            break;
453                    case FOR_R:
454                            if(MYTHREAD == 0){
455                                    for(int i = offset; i < cursize*THREADS+offset; i++){
456                                            aux_var+=distArr[i];
457                                    }
458                            }
459                            /*
460                                    Some compilers with aggressive optimizations may drop the whole loop if they detect that
461                                    aux_var is not going to be used. Writing its value to an external variable may prevent this.
462                            */
463                            global_aux_var = aux_var;
464                            break;
465                    case FOR_W:
466                            if(MYTHREAD == 0){
467                                    for(int i = offset; i < cursize*THREADS+offset; i++){
468                                            distArr[i] = i;
469                                    }
470                            }
471                            break;
472                    case FOR_RW:
473                            if(MYTHREAD == 0){
474                                    for(int i = offset; i < cursize*THREADS+offset; i++){
475                                            distArr[i] += i;
476                                    }
477                            }
478                            break;
479                  case BROADCAST:                  case BROADCAST:
480                  upc_all_broadcast(&(distArr[THREADS*offset]),&(broadcastArr[offset]), cursize, sync_mode);                  upc_all_broadcast(&(distArr[THREADS*offset]),&(broadcastArr[offset]), cursize, sync_mode);
481                  break;                  break;

Legend:
Removed from v.13  
changed lines
  Added in v.14

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge