コード例 #1
0
def main():
    assert R == R
    assert RW == RW
    assert WD == WD
    assert N == N
    assert Reduce('+') == Reduce('+')

    assert not (R == RW)
    assert not (R == WD)
    assert not (R == N)
    assert not (R == Reduce('+'))

    assert R != RW
    assert R != WD
    assert R != N
    assert Reduce('+') != Reduce('*')

    assert not (R != R)
    assert not (RW != RW)
    assert not (WD != WD)
    assert not (N != N)

    assert R('x') == R('x')
    assert R('x') != R('y')
    assert R('x') != R

    assert R + R == R
    assert R + RW == RW
    assert R + WD == WD

    assert not (R + RW == R)

    assert R('x') + R('y') == R('x', 'y')
    assert R('x') + R('y') != R('y', 'x')

    assert R('x', 'y') + RW('y') == R('x') + RW('y')
    assert R('x') + RW('x', 'y') == RW('x', 'y')

    assert R + Reduce('+') == RW
    assert Reduce('+') + Reduce('*') == RW
    assert Reduce('+') + WD == WD

    assert R('x', 'y') + Reduce('+', 'y', 'z') == R('x') + RW('y') + Reduce(
        '+', 'z')

    print(R('x'))
    print(R('x') + RW('y'))
    print(RW('x') + RW('y'))
コード例 #2
0
ファイル: stencil.py プロジェクト: stkaplan/legion
        Region, Region, Region, Region, Region, Region, pygion.bool_
    ],
    privileges=[RW, N, R('input'),
                R('input'),
                R('input'),
                R('input')],
    return_type=pygion.void,
    calling_convention='regent')

increment = extern_task(task_id=10002,
                        argument_types=[
                            Region, Region, Region, Region, Region, Region,
                            pygion.bool_
                        ],
                        privileges=[
                            RW('input'), N,
                            RW('input'),
                            RW('input'),
                            RW('input'),
                            RW('input')
                        ],
                        return_type=pygion.void,
                        calling_convention='regent')

check = extern_task(
    task_id=10003,
    argument_types=[Region, Region, pygion.int64, pygion.int64],
    privileges=[R, N],
    return_type=pygion.void,
    calling_convention='regent')
コード例 #3
0
ファイル: pennant.py プロジェクト: dycz0fx/legion
read_partitions = pygion.extern_task(
    task_id=10001,
    argument_types=[Region, Region, Region, config],
    privileges=[N, N, N],
    return_type=mesh_partitions,
    calling_convention='regent')

initialize_topology = extern_task(task_id=10003,
                                  argument_types=[
                                      config, pygion.int64, Region, Region,
                                      Region, Region, Region
                                  ],
                                  privileges=[
                                      None, None,
                                      RW('znump'),
                                      RW('px_x', 'px_y', 'has_bcx', 'has_bcy'),
                                      RW('px_x', 'px_y', 'has_bcx', 'has_bcy'),
                                      N,
                                      RW('mapsz', 'mapsp1', 'mapsp1_r',
                                         'mapsp2', 'mapsp2_r', 'mapss3',
                                         'mapss4')
                                  ],
                                  return_type=pygion.void,
                                  calling_convention='regent')

init_pointers = extern_task(
    task_id=10004,
    argument_types=[Region, Region, Region, Region],
    privileges=[N, N, N,
                RW('mapsp1', 'mapsp1_r', 'mapsp2', 'mapsp2_r')],
コード例 #4
0
ファイル: circuit_sparse.py プロジェクト: sanidhya/legion
    extern_task = pygion.extern_task

init_piece = extern_task(task_id=10002,
                         argument_types=[
                             pygion.int32, Config, Region, Region, Region,
                             Region, Region
                         ],
                         privileges=[None, None, WD, WD, WD, N, WD],
                         return_type=pygion.void,
                         calling_convention='regent')

init_pointers = extern_task(
    task_id=10003,
    argument_types=[Region, Region, Region, Region],
    privileges=[N, N, N,
                RW('in_ptr', 'in_ptr_r', 'out_ptr', 'out_ptr_r')],
    return_type=pygion.void,
    calling_convention='regent')

calculate_new_currents = extern_task(
    task_id=10004,
    argument_types=[
        pygion.bool_, pygion.uint32, Region, Region, Region, Region
    ],
    privileges=[
        None, None,
        R('node_voltage'),
        R('node_voltage'),
        R('node_voltage'),
        R('in_ptr', 'in_ptr_r', 'out_ptr', 'out_ptr_r', 'inductance',
          'resistance', 'wire_cap') +
コード例 #5
0
if _constant_time_launches:
    extern_task = pygion.extern_task_wrapper
else:
    extern_task = pygion.extern_task

init_piece = extern_task(
    task_id=10002,
    argument_types=[pygion.int32, Config, Region, Region, Region, Region, Region],
    privileges=[None, None, WD, WD, WD, N, WD],
    return_type=pygion.void,
    calling_convention='regent')

init_pointers = extern_task(
    task_id=10003,
    argument_types=[Region, Region, Region, Region],
    privileges=[N, N, N, RW('in_ptr', 'in_ptr_r', 'out_ptr', 'out_ptr_r')],
    return_type=pygion.void,
    calling_convention='regent')

calculate_new_currents = extern_task(
    task_id=10004,
    argument_types=[pygion.bool_, pygion.uint32, Region, Region, Region, Region],
    privileges=[
        None,
        None,
        R('node_voltage'),
        R('node_voltage'),
        R('node_voltage'),
        R('in_ptr', 'in_ptr_r', 'out_ptr', 'out_ptr_r', 'inductance', 'resistance', 'wire_cap') + RW(*['current_%d' % i for i in range(10)]) + RW(*['voltage_%d' % i for i in range(9)])],
    return_type=pygion.void,
    calling_convention='regent')
コード例 #6
0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from __future__ import print_function

import pygion
from pygion import task, R, Region, RW, WD, N
import numpy


@task(privileges=[RW('x')])
def init_x(R):
    R.x.fill(123)


@task(privileges=[RW('y')])
def init_y(R):
    R.y.fill(456)


@task(privileges=[RW('x')])
def inc(R, step):
    numpy.add(R.x, step, out=R.x)


@task(privileges=[R('x', 'y')])