Пример #1
0
import bsp
import numpy
import math

# get the 2D coordinates
nProcs = bsp.procCount()
myProcID = bsp.myProcID()
n1Dim = int(math.floor(math.sqrt(nProcs)))
i0 = myProcID / n1Dim
i1 = myProcID % n1Dim

# create the local parts of the global array
bsp.createArray('arr.a1','f8',[10,10])
a1=bsp.asNumpy('arr.a1')
for i in range(10):
    for j in range(10):
        a1[i][j] = i0+i1+i+j

# globalize the local array
bsp.globalize(0,(n1Dim,n1Dim),'arr.a1')

# create an index-set for the request
bsp.createArray('ind.lower1','u8',[2,2])
bsp.createArray('ind.upper1','u8',[2,2])
lower1=bsp.asNumpy('ind.lower1')
upper1=bsp.asNumpy('ind.upper1')
lower1[0][0] = 5
lower1[0][1] = 5
upper1[0][0] = 14
upper1[0][1] = 14
lower1[1][0] = 2
Пример #2
0
import bsp
import numpy
import math

# get the 2D coordinates
nProcs = bsp.procCount()
myProcID = bsp.myProcID()
n1Dim = int(math.floor(math.sqrt(nProcs)))
i0 = myProcID / n1Dim
i1 = myProcID % n1Dim

# create the local parts of the global array
bsp.createArray('arr.a1', 'f8', [10, 10])
a1 = bsp.asNumpy('arr.a1')
for i in range(10):
    for j in range(10):
        a1[i][j] = i0 + i1 + i + j

# globalize the local array
bsp.globalize(0, (n1Dim, n1Dim), 'arr.a1')

# create an index-set for the request
bsp.createArray('ind.lower1', 'u8', [2, 2])
bsp.createArray('ind.upper1', 'u8', [2, 2])
lower1 = bsp.asNumpy('ind.lower1')
upper1 = bsp.asNumpy('ind.upper1')
lower1[0][0] = 5
lower1[0][1] = 5
upper1[0][0] = 14
upper1[0][1] = 14
lower1[1][0] = 2