/[escript]/trunk/paso/src/Pattern_unrollBlocks.c
ViewVC logotype

Diff of /trunk/paso/src/Pattern_unrollBlocks.c

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

revision 1388 by trankine, Fri Jan 11 07:45:58 2008 UTC revision 1811 by ksteube, Thu Sep 25 23:11:13 2008 UTC
# Line 1  Line 1 
1    
 /* $Id: Pattern_unrollBlocks.c 1306 2007-09-18 05:51:09Z ksteube $ */  
   
2  /*******************************************************  /*******************************************************
3   *  *
4   *           Copyright 2003-2007 by ACceSS MNRF  * Copyright (c) 2003-2008 by University of Queensland
5   *       Copyright 2007 by University of Queensland  * Earth Systems Science Computational Center (ESSCC)
6   *  * http://www.uq.edu.au/esscc
7   *                http://esscc.uq.edu.au  *
8   *        Primary Business: Queensland, Australia  * Primary Business: Queensland, Australia
9   *  Licensed under the Open Software License version 3.0  * Licensed under the Open Software License version 3.0
10   *     http://www.opensource.org/licenses/osl-3.0.php  * http://www.opensource.org/licenses/osl-3.0.php
11   *  *
12   *******************************************************/  *******************************************************/
13    
14    
15  /**************************************************************/  /**************************************************************/
16    
# Line 34  Paso_Pattern* Paso_Pattern_unrollBlocks( Line 33  Paso_Pattern* Paso_Pattern_unrollBlocks(
33                                          int type, dim_t output_block_size,dim_t input_block_size) {                                          int type, dim_t output_block_size,dim_t input_block_size) {
34    Paso_Pattern*out=NULL;    Paso_Pattern*out=NULL;
35    index_t *ptr=NULL,*index=NULL,iPtr;    index_t *ptr=NULL,*index=NULL,iPtr;
36    dim_t i,j,k,l, block_size, new_n_ptr, new_len, new_numOutput;    dim_t i,j,k, block_size, new_len, new_numOutput, new_numInput;
37    index_t index_offset_in=(pattern->type & PATTERN_FORMAT_OFFSET1 ? 1:0);    index_t index_offset_in=(pattern->type & PATTERN_FORMAT_OFFSET1 ? 1:0);
38    index_t index_offset_out=(type & PATTERN_FORMAT_OFFSET1 ? 1:0);    index_t index_offset_out=(type & PATTERN_FORMAT_OFFSET1 ? 1:0);
39        
# Line 59  Paso_Pattern* Paso_Pattern_unrollBlocks( Line 58  Paso_Pattern* Paso_Pattern_unrollBlocks(
58       block_size=output_block_size*input_block_size;       block_size=output_block_size*input_block_size;
59       new_len=(pattern->len)*block_size;       new_len=(pattern->len)*block_size;
60       new_numOutput=(pattern->numOutput)*output_block_size;       new_numOutput=(pattern->numOutput)*output_block_size;
61         new_numInput=(pattern->numInput)*input_block_size;
62        
63       ptr=MEMALLOC(new_numOutput+1,index_t);       ptr=MEMALLOC(new_numOutput+1,index_t);
64       index=MEMALLOC(new_len,index_t);       index=MEMALLOC(new_len,index_t);
# Line 68  Paso_Pattern* Paso_Pattern_unrollBlocks( Line 68  Paso_Pattern* Paso_Pattern_unrollBlocks(
68             #pragma omp for private(i) schedule(static)             #pragma omp for private(i) schedule(static)
69             for (i=0;i<new_numOutput+1;++i) ptr[i]=index_offset_out;             for (i=0;i<new_numOutput+1;++i) ptr[i]=index_offset_out;
70        
71             #pragma omp master             #pragma omp single
72             ptr[new_numOutput]=new_len+index_offset_out;             ptr[new_numOutput]=new_len+index_offset_out;
73        
74             #pragma omp for private(i,k) schedule(static)             #pragma omp for private(i,k) schedule(static)
# Line 93  Paso_Pattern* Paso_Pattern_unrollBlocks( Line 93  Paso_Pattern* Paso_Pattern_unrollBlocks(
93                }                }
94             }             }
95          }          }
96          out=Paso_Pattern_alloc(type,pattern->input_block_size * input_block_size,pattern->output_block_size * output_block_size,new_numOutput,ptr,index);          out=Paso_Pattern_alloc(type,pattern->input_block_size * input_block_size,pattern->output_block_size * output_block_size,new_numOutput,new_numInput,ptr,index);
97       }         }  
98       if (! Paso_noError()) {       if (! Paso_noError()) {
99          MEMFREE(index);          MEMFREE(index);

Legend:
Removed from v.1388  
changed lines
  Added in v.1811

  ViewVC Help
Powered by ViewVC 1.1.26