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

Field communication benchmark

parent b95ff457
Branches
No related tags found
No related merge requests found
...@@ -36,7 +36,7 @@ class SingleMessageBufferedScheme ...@@ -36,7 +36,7 @@ class SingleMessageBufferedScheme
public: public:
typedef Stencil_T Stencil; typedef Stencil_T Stencil;
SingleMessageBufferedScheme( weak_ptr_wrapper< StructuredBlockForest > bf, const int tag = 17953 ) SingleMessageBufferedScheme( const weak_ptr_wrapper< StructuredBlockForest > & bf, const int tag = 17953 )
: blockForest_( bf ), tag_( tag ) {} : blockForest_( bf ), tag_( tag ) {}
inline void addDataToCommunicate( const shared_ptr< communication::UniformPackInfo > &packInfo ) inline void addDataToCommunicate( const shared_ptr< communication::UniformPackInfo > &packInfo )
......
...@@ -2,11 +2,17 @@ import waLBerla ...@@ -2,11 +2,17 @@ import waLBerla
import subprocess import subprocess
import re import re
from collections import defaultdict from collections import defaultdict
import sys
from datetime import timedelta
base = (32, 16, 2, 64) base = (32, 16, 2, 64)
BlOCK_SIZES_SQ = [(i, i, i) for i in base] 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] 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(): def supermuc_network_spread():
try: try:
...@@ -28,7 +34,7 @@ sng_network = supermuc_network_spread() ...@@ -28,7 +34,7 @@ sng_network = supermuc_network_spread()
class AlreadySimulated: 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', 'cellsPerBlock0', 'cellsPerBlock1', 'cellsPerBlock2',
'blocksPerProcess', 'localCommunicationMode', 'singleMessage', 'blocksPerProcess', 'localCommunicationMode', 'singleMessage',
'fieldsPdf', 'fieldsPdfOpt', 'fieldsVector', 'fieldsScalar', 'fieldsPdf', 'fieldsPdfOpt', 'fieldsVector', 'fieldsScalar',
...@@ -50,9 +56,13 @@ class AlreadySimulated: ...@@ -50,9 +56,13 @@ class AlreadySimulated:
@waLBerla.callback("config") @waLBerla.callback("config")
def config(): def config(processes=None):
simulated_db = AlreadySimulated('FieldCommunication.sqlite') simulated_db = AlreadySimulated(db_file)
isWalberlaRun = processes is None
skipped = 0 skipped = 0
simulated = 0
if isWalberlaRun:
processes = waLBerla.mpi.numProcesses()
for layout in ('fzyx', 'zyxf'): for layout in ('fzyx', 'zyxf'):
for ghost_layers in (1, 2): for ghost_layers in (1, 2):
for cartesian_comm in (False, True): for cartesian_comm in (False, True):
...@@ -67,14 +77,18 @@ def config(): ...@@ -67,14 +77,18 @@ def config():
if blocksPerProcess >= 8 and cells[0] >= 64 and cells[1] >= 64 and cells[2] >= 64: if blocksPerProcess >= 8 and cells[0] >= 64 and cells[1] >= 64 and cells[2] >= 64:
continue 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) int(single_message), pdf, pdf_opt, vector, scalar, buffered)
if simulated_db.in_db(data): if simulated_db.in_db(data):
skipped += 1 skipped += 1
if skipped % 100 == 0: if skipped % 100 == 0 and isWalberlaRun:
waLBerla.log_info_on_root("Skipped {} scenarios".format(skipped)) waLBerla.log_info_on_root("Skipped {} scenarios".format(skipped))
continue continue
else:
simulated += 1
if not isWalberlaRun:
continue
cfg = { cfg = {
'Domain': { 'Domain': {
...@@ -100,9 +114,9 @@ def config(): ...@@ -100,9 +114,9 @@ def config():
'Run': { 'Run': {
'warmupIterations': 3, 'warmupIterations': 3,
'iterations': 100, 'iterations': 100,
'outerIterations': 2, 'outerIterations': outer_iterations,
'databaseFile': 'FieldCommunication.sqlite', 'databaseFile': db_file,
'timeForBenchmark': 0.25, 'timeForBenchmark': time_for_benchmark,
'minIterations': 2, 'minIterations': 2,
'maxIterations': 10000, 'maxIterations': 10000,
}, },
...@@ -114,3 +128,12 @@ def config(): ...@@ -114,3 +128,12 @@ def config():
} }
} }
yield cfg 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 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 import sys
...@@ -8,18 +8,31 @@ import sys ...@@ -8,18 +8,31 @@ import sys
try: try:
from .walberla_cpp import * from .walberla_cpp import *
cpp_available=True cpp_available = True
except ImportError: except ImportError:
try: try:
from walberla_cpp import * from walberla_cpp import *
cpp_available=True cpp_available = True
except ImportError: 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: if cpp_available:
from .core_extension import extend as extend_core from .core_extension import extend as extend_core
thismodule = sys.modules[__name__] thismodule = sys.modules[__name__]
extend_core ( thismodule ) extend_core(thismodule)
if 'field' in globals(): # check if field was exported if 'field' in globals(): # check if field was exported
# Update modules dict to be able to write e.g. from waLBerla import field # Update modules dict to be able to write e.g. from waLBerla import field
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment