Skip to content
Snippets Groups Projects
Commit d837db01 authored by Sebastian Eibl's avatar Sebastian Eibl
Browse files

enable mesa_pd codegen for ci

parent ff3b369b
No related merge requests found
...@@ -25,6 +25,8 @@ stages: ...@@ -25,6 +25,8 @@ stages:
- cmake --version - cmake --version
- ccache --version - ccache --version
- mpirun --version - mpirun --version
- python3 --version
- python3 python/mesa_pd.py -y ..
- export CCACHE_BASEDIR=$CI_PROJECT_DIR - export CCACHE_BASEDIR=$CI_PROJECT_DIR
- mkdir $CI_PROJECT_DIR/build - mkdir $CI_PROJECT_DIR/build
- cd $CI_PROJECT_DIR/build - cd $CI_PROJECT_DIR/build
...@@ -2073,4 +2075,4 @@ benchmark_ClangBuildAnalyzer: ...@@ -2073,4 +2075,4 @@ benchmark_ClangBuildAnalyzer:
- ClangBuildAnalyzer --analyze CBA - ClangBuildAnalyzer --analyze CBA
image: i10git.cs.fau.de:5005/walberla/buildenvs/clang:9.0 image: i10git.cs.fau.de:5005/walberla/buildenvs/clang:9.0
tags: tags:
- docker-benchmark - docker-benchmark
\ No newline at end of file
...@@ -11,6 +11,7 @@ import argparse ...@@ -11,6 +11,7 @@ import argparse
if __name__ == '__main__': if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Generate all necessary files for the waLBerla mesa_pd module.') parser = argparse.ArgumentParser(description='Generate all necessary files for the waLBerla mesa_pd module.')
parser.add_argument('path', help='Where should the files be created?') parser.add_argument('path', help='Where should the files be created?')
parser.add_argument('-y', action='store_true', help='Silent mode. Accept all questions with yes.')
args = parser.parse_args() args = parser.parse_args()
mpd = Module(args.path) mpd = Module(args.path)
...@@ -120,4 +121,4 @@ if __name__ == '__main__': ...@@ -120,4 +121,4 @@ if __name__ == '__main__':
mpd.add(mpi.SyncNextNeighbors(ps)) mpd.add(mpi.SyncNextNeighbors(ps))
mpd.add(mpi.SyncNextNeighborsNoGhosts(ps)) mpd.add(mpi.SyncNextNeighborsNoGhosts(ps))
mpd.generate() mpd.generate(not args.y)
...@@ -30,21 +30,20 @@ class Module: ...@@ -30,21 +30,20 @@ class Module:
return component return component
def rename(self): def rename(self):
for root, dirnames, filenames in os.walk(self.context['module_path']): for filename in (f for f in self.context['module_path'].glob('**/*') if f.is_file()):
for filename in filenames: filedata = None
filedata = None #print(f'renaming module name: {filename}')
# print(f'renaming module name: {root}/{filename}') with open(filename, encoding="utf-8") as fin:
with open(f'{root}/{filename}', 'r') as file: filedata = fin.read()
filedata = file.read()
filedata = filedata.replace('mesa_pd', self.context['name']) filedata = filedata.replace('mesa_pd', self.context['name'])
with open(f'{root}/{filename}', 'w') as file: with open(filename, 'w', encoding="utf-8") as fout:
file.write(filedata) fout.write(filedata)
def generate(self, folder_check=True): def generate(self, folder_check=True):
print(f"This operation will overwrite the content of: {self.context['module_path']}")
if (folder_check): if (folder_check):
print(f"This operation will overwrite the content of: {self.context['module_path']}")
answer = input("Continue? (y to confirm)") answer = input("Continue? (y to confirm)")
if (answer != "y"): if (answer != "y"):
return return
...@@ -52,11 +51,11 @@ class Module: ...@@ -52,11 +51,11 @@ class Module:
mesa_pd_folder = (Path(__file__).parents[2] / 'src' / 'mesa_pd').resolve() mesa_pd_folder = (Path(__file__).parents[2] / 'src' / 'mesa_pd').resolve()
if (mesa_pd_folder != self.context['module_path']): if (mesa_pd_folder != self.context['module_path']):
if not self.context['module_path'].exists(): if not self.context['module_path'].exists():
self.context['module_path'].mkdir() self.context['module_path'].mkdir(parents=True)
shutil.rmtree(self.context['module_path']) shutil.rmtree(self.context['module_path'])
shutil.copytree(mesa_pd_folder, self.context['module_path']) shutil.copytree(mesa_pd_folder, self.context['module_path'])
for d in self.components: for d in self.components:
d.generate(self.context) d.generate(self.context)
self.rename() self.rename()
\ No newline at end of file
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