From 8fb7705428a6524a436a5dd8806ad8076b7f4e08 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Mon, 21 Oct 2019 22:33:13 +0200 Subject: Add basic argument parsing --- boltzgen.py | 24 ++++++++++++++++++++++++ test.py | 16 ---------------- 2 files changed, 24 insertions(+), 16 deletions(-) create mode 100644 boltzgen.py delete mode 100644 test.py diff --git a/boltzgen.py b/boltzgen.py new file mode 100644 index 0000000..6d410c3 --- /dev/null +++ b/boltzgen.py @@ -0,0 +1,24 @@ +import argparse +import string + +from boltzgen import * + +argparser = argparse.ArgumentParser(description='Generate LBM kernels in various languages using a symbolic description.') +argparser.add_argument('language', help = 'Target language (currently either "opencl" or "cpp")') + +args = argparser.parse_args() + +lbm = LBM(D2Q9) +geometry = Geometry(32,32) + +src = source( + args.language, + D2Q9, + lbm.moments(), + lbm.bgk(f_eq = lbm.equilibrium(), tau = 0.6), + "", + 'float', + geometry +) + +print(src) diff --git a/test.py b/test.py deleted file mode 100644 index 0eec050..0000000 --- a/test.py +++ /dev/null @@ -1,16 +0,0 @@ -from boltzgen import * - -lbm = LBM(D2Q9) -geometry = Geometry(32,32) - -src = source( - 'opencl', - D2Q9, - lbm.moments(), - lbm.bgk(f_eq = lbm.equilibrium(), tau = 0.6), - "", - 'float', - geometry -) - -print(src) -- cgit v1.2.3