Skip to content
Snippets Groups Projects
Commit b55520fa authored by Martin Bauer's avatar Martin Bauer
Browse files

Field communiction benchmark

parent 0734d883
No related merge requests found
Pipeline #15738 failed with stages
in 3 hours, 47 minutes, and 54 seconds
......@@ -2,11 +2,17 @@ import waLBerla
import subprocess
import re
from collections import defaultdict
import sys
from datetime import timedelta
base = (32, 16, 2, 64)
BlOCK_SIZES_SQ = [(i, i, i) for i in base]
BLOCK_SIZES_RECT = [(i, i, i // 2) for i in base] + [(i, i // 2, i // 2) for i in base]
time_for_benchmark = 0.25
outer_iterations = 2
db_file = 'FieldCommunication.sqlite'
def supermuc_network_spread():
try:
......@@ -28,7 +34,7 @@ sng_network = supermuc_network_spread()
class AlreadySimulated:
def __init__(self, db_file, properties=('layout', 'ghostLayers', 'cartesianCommunicator', 'stencil',
def __init__(self, db_file, properties=('processes0*processes1*processes2', 'layout', 'ghostLayers', 'cartesianCommunicator', 'stencil',
'cellsPerBlock0', 'cellsPerBlock1', 'cellsPerBlock2',
'blocksPerProcess', 'localCommunicationMode', 'singleMessage',
'fieldsPdf', 'fieldsPdfOpt', 'fieldsVector', 'fieldsScalar',
......@@ -50,9 +56,13 @@ class AlreadySimulated:
@waLBerla.callback("config")
def config():
simulated_db = AlreadySimulated('FieldCommunication.sqlite')
def config(processes=None):
simulated_db = AlreadySimulated(db_file)
isWalberlaRun = processes is None
skipped = 0
simulated = 0
if isWalberlaRun:
processes = waLBerla.mpi.numProcesses()
for layout in ('fzyx', 'zyxf'):
for ghost_layers in (1, 2):
for cartesian_comm in (False, True):
......@@ -67,14 +77,18 @@ def config():
if blocksPerProcess >= 8 and cells[0] >= 64 and cells[1] >= 64 and cells[2] >= 64:
continue
data = (layout, ghost_layers, int(cartesian_comm), stencil, *cells, blocksPerProcess, local_comm,
data = (processes, layout, ghost_layers, int(cartesian_comm), stencil, *cells, blocksPerProcess, local_comm,
int(single_message), pdf, pdf_opt, vector, scalar, buffered)
if simulated_db.in_db(data):
skipped += 1
if skipped % 100 == 0:
if skipped % 100 == 0 and isWalberlaRun:
waLBerla.log_info_on_root("Skipped {} scenarios".format(skipped))
continue
else:
simulated += 1
if not isWalberlaRun:
continue
cfg = {
'Domain': {
......@@ -100,9 +114,9 @@ def config():
'Run': {
'warmupIterations': 3,
'iterations': 100,
'outerIterations': 2,
'databaseFile': 'FieldCommunication.sqlite',
'timeForBenchmark': 0.25,
'outerIterations': outer_iterations,
'databaseFile': db_file,
'timeForBenchmark': time_for_benchmark,
'minIterations': 2,
'maxIterations': 10000,
},
......@@ -114,3 +128,12 @@ def config():
}
}
yield cfg
if not isWalberlaRun:
print("Skipped", skipped, "to simulate", simulated)
estimated_seconds = simulated * time_for_benchmark * outer_iterations
print("Estimated time ", timedelta(seconds=estimated_seconds))
if __name__ == '__main__':
for _ in config(int(sys.argv[1])):
pass
from .callbacks import callback, ScenarioManager, memberCallback
from .callbacks import memberCallback as member_callback # deprecated, was renamed to memberCallback
from .callbacks import memberCallback as member_callback # deprecated, was renamed to memberCallback
import sys
......@@ -8,18 +8,31 @@ import sys
try:
from .walberla_cpp import *
cpp_available=True
cpp_available = True
except ImportError:
try:
from walberla_cpp import *
cpp_available=True
cpp_available = True
except ImportError:
cpp_available=False
cpp_available = False
thismodule = sys.modules[__name__]
thismodule.log_info_on_root = print
thismodule.log_progress_on_root = print
thismodule.log_result_on_root = print
thismodule.log_devel_on_root = print
thismodule.log_detail_on_root = print
thismodule.log_warning_on_root = print
thismodule.log_info = print
thismodule.log_result = print
thismodule.log_devel = print
thismodule.log_progress = print
thismodule.log_detail = print
thismodule.log_warning = print
if cpp_available:
from .core_extension import extend as extend_core
thismodule = sys.modules[__name__]
extend_core ( thismodule )
extend_core(thismodule)
if 'field' in globals(): # check if field was exported
# Update modules dict to be able to write e.g. from waLBerla import field
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment