Changeset 598 for soft/giet_vm/applications/ocean/subblock.C
- Timestamp:
- Jul 9, 2015, 2:11:17 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/applications/ocean/subblock.C
r589 r598 1 #line 115 "/Users/alain/soc/giet_vm/applications/ocean/null_macros/c.m4.null.GIET" 1 /*************************************************************************/ 2 /* */ 3 /* Copyright (c) 1994 Stanford University */ 4 /* */ 5 /* All rights reserved. */ 6 /* */ 7 /* Permission is given to use, copy, and modify this software for any */ 8 /* non-commercial purpose as long as this copyright notice is not */ 9 /* removed. All other uses, including redistribution in whole or in */ 10 /* part, are forbidden without prior written permission. */ 11 /* */ 12 /* This software is provided with absolutely no warranty and no */ 13 /* support. */ 14 /* */ 15 /*************************************************************************/ 2 16 17 EXTERN_ENV 18 19 #include <stdio.h> 20 #include <math.h> 21 22 #include "decs.h" 23 24 25 void subblock() 26 { 27 long i; 28 long j; 29 long k; 30 long xportion; 31 long yportion; 32 long my_num; 33 34 /* Determine starting coord and number of points to process in */ 35 /* each direction */ 36 37 for (i = 0; i < numlev; i++) { 38 xportion = (jmx[i] - 2) / xprocs; 39 //xextra = (jmx[i] - 2) % xprocs; 40 for (j = 0; j < xprocs; j++) { 41 for (k = 0; k < yprocs; k++) { 42 gp[k * xprocs + j].rel_num_x[i] = xportion; 43 } 44 } 45 yportion = (imx[i] - 2) / yprocs; 46 //yextra = (imx[i] - 2) % yprocs; 47 for (j = 0; j < yprocs; j++) { 48 for (k = 0; k < xprocs; k++) { 49 gp[j * xprocs + k].rel_num_y[i] = yportion; 50 } 51 } 52 } 53 54 for (my_num = 0; my_num < nprocs; my_num++) { 55 for (i = 0; i < numlev; i++) { 56 gp[my_num].rlist[i] = 1; 57 gp[my_num].rljst[i] = 1; 58 gp[my_num].rlien[i] = gp[my_num].rlist[i] + gp[my_num].rel_num_y[i]; 59 gp[my_num].rljen[i] = gp[my_num].rljst[i] + gp[my_num].rel_num_x[i]; 60 gp[my_num].eist[i] = gp[my_num].rlist[i] + 1; 61 gp[my_num].oist[i] = gp[my_num].rlist[i]; 62 gp[my_num].ejst[i] = gp[my_num].rljst[i] + 1; 63 gp[my_num].ojst[i] = gp[my_num].rljst[i]; 64 } 65 } 66 67 for (i = 0; i < nprocs; i++) { 68 gp[i].neighbors[LEFT] = -1; 69 gp[i].neighbors[RIGHT] = -1; 70 gp[i].neighbors[UP] = -1; 71 gp[i].neighbors[DOWN] = -1; 72 gp[i].neighbors[UPLEFT] = -1; 73 gp[i].neighbors[UPRIGHT] = -1; 74 gp[i].neighbors[DOWNLEFT] = -1; 75 gp[i].neighbors[DOWNRIGHT] = -1; 76 77 if (i >= xprocs) { 78 gp[i].neighbors[UP] = i - xprocs; 79 } 80 if (i < nprocs - xprocs) { 81 gp[i].neighbors[DOWN] = i + xprocs; 82 } 83 if ((i % xprocs) > 0) { 84 gp[i].neighbors[LEFT] = i - 1; 85 } 86 if ((i % xprocs) < (xprocs - 1)) { 87 gp[i].neighbors[RIGHT] = i + 1; 88 } 89 90 j = gp[i].neighbors[UP]; 91 92 if (j != -1) { 93 if ((j % xprocs) > 0) { 94 gp[i].neighbors[UPLEFT] = j - 1; 95 } 96 if ((j % xprocs) < (xprocs - 1)) { 97 gp[i].neighbors[UPRIGHT] = j + 1; 98 } 99 } 100 101 j = gp[i].neighbors[DOWN]; 102 103 if (j != -1) { 104 if ((j % xprocs) > 0) { 105 gp[i].neighbors[DOWNLEFT] = j - 1; 106 } 107 if ((j % xprocs) < (xprocs - 1)) { 108 gp[i].neighbors[DOWNRIGHT] = j + 1; 109 } 110 } 111 } 112 113 for (i = 0; i < nprocs; i++) { 114 (*gp[i].rownum) = i / xprocs; 115 (*gp[i].colnum) = i % xprocs; 116 } 117 }
Note: See TracChangeset
for help on using the changeset viewer.