Esempio n. 1
0
import time
import mui4py
domain = sys.argv[1]

# Configuration for the interfaces
config1d = mui4py.Config(1, mui4py.FLOAT64)
config2d = mui4py.Config(2, mui4py.FLOAT32)
config3d = mui4py.Config(3, mui4py.FLOAT64)

appcomm = mui4py.mpi_split_by_app()
rank = appcomm.Get_rank()

# Set up interfaces by type
# 1D interfaces
ifs = []
ifaces1d = mui4py.create_unifaces(domain, ifs, config1d)

# 2D interfaces
ifs = ["I1", "I2"]
ifaces2d = mui4py.create_unifaces(domain, ifs, config2d)
ifaces2d["I1"].set_data_types({
    "data1": mui4py.FLOAT64,
    "data2": mui4py.STRING
})
ifaces2d["I2"].set_data_types({"data": mui4py.INT64})

# 3D interfaces
ifs = ["I3"]
ifaces3d = mui4py.create_unifaces(domain, ifs, config3d)
ifaces3d["I3"].set_data_types({"more_data": mui4py.INT64})
Esempio n. 2
0
import sys
import mui4py
domain = sys.argv[1]

# Configuration for the interfaces
config1d = mui4py.Config(1, mui4py.FLOAT64)
config2d = mui4py.Config(2, mui4py.FLOAT32)
config3d = mui4py.Config(3, mui4py.FLOAT64)

appcomm = mui4py.mpi_split_by_app()
rank = appcomm.Get_rank()

# Set up interfaces by type
# 1D interfaces
ifs = ["I4"]
ifaces1d = mui4py.create_unifaces(domain, ifs, config1d) 
ifaces1d["I4"].set_data_types({"data": mui4py.INT32})
# 2D interfaces
ifs = []
ifaces2d = mui4py.create_unifaces(domain, ifs, config2d) 
# 3D interfaces
ifs = []
ifaces3d = mui4py.create_unifaces(domain, ifs, config3d) 

# Join all interfaces under a single dict for convenience
ifaces = {**ifaces1d, **ifaces2d, **ifaces3d}
time.sleep(0.1)
print ("Domain", domain + ",", "rank", rank, "connected to interfaces:", 
        "\n\t1D:", list(ifaces1d.keys()),
        "\n\t2D:", list(ifaces2d.keys()), 
        "\n\t3D:", list(ifaces3d.keys()))
# Define MUI dimension
dimensionMUI = 2

# Define the name of push/fetch values
name_push = "coarseField"
name_fetch = "fineField"

# Define MUI push/fetch data types
data_types_push = {name_push: mui4py.FLOAT64}
data_types_fetch = {name_fetch: mui4py.FLOAT64}

# MUI interface creation
domain = "coarseDomain"
config2d = mui4py.Config(dimensionMUI, mui4py.FLOAT64)
iface = ["interface2D01", "interface2D02"]
MUI_Interfaces = mui4py.create_unifaces(domain, iface, config2d)
MUI_Interfaces["interface2D01"].set_data_types(data_types_fetch)
MUI_Interfaces["interface2D02"].set_data_types(data_types_push)

print("mpi4py.get_config(): ", mpi4py.get_config(), "\n")
print("mui4py.get_compiler_config(): ", mui4py.get_compiler_config(), "\n")
print("mui4py.get_compiler_version(): ", mui4py.get_compiler_version(), "\n")
print("mui4py.get_mpi_version(): ", mui4py.get_mpi_version(), "\n")

# Define the forget steps of MUI to reduce the memory
forgetSteps = int(5)

# Define the search radius of the RBF sampler
# The search radius should not set to a very large value so that to ensure a good convergence
rSampler = 0.4