Example script for executing LUE framework modelling operations on one or more localities.

import lue.framework as lfr
import numpy as np

# Model logic ------------------------------------------------------------------
def create_array_2d():
    array_shape = (1000, 1000)
    partition_shape = (100, 100)
    dtype = np.float64
    fill_value = 5.5

    return lfr.create_array(array_shape, partition_shape, dtype, fill_value)

def iterate(state):
    for t in range(100):
        state = lfr.sqrt(state)

    return state

def simulate():
    state = iterate(create_array_2d())

# Initialize HPX runtime and run model, on the root locality -------------------
# General configuration options, which are valid on all
# platforms. Platform-specific options can be passed on the command line.
cfg = [
    # Make sure hpx_main is always executed
    # Allow for unknown command line options
    # Disable HPX' short options
    # Don't print diagnostics during forced terminate
    # Make AGAS clean up resources faster than by default


# The root locality will distribute the work over all other
# localities. Never perform Python code on the other localities than the
# root locality unless you know what you are doing.
if lfr.on_root_locality():

See Execute LUE framework programs for information about how to execute this script.