aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-10-28 21:52:34 +0100
committerAdrian Kummerlaender2019-10-28 21:52:34 +0100
commit091811762b7f2cbb6575139276ea16bf54d3456b (patch)
treef01745663e8b368ba8e6a64b78a0787542b567be
parent536b25e2c2b742c17d023d2b3386fed4dc60a339 (diff)
downloadboltzgen-091811762b7f2cbb6575139276ea16bf54d3456b.tar
boltzgen-091811762b7f2cbb6575139276ea16bf54d3456b.tar.gz
boltzgen-091811762b7f2cbb6575139276ea16bf54d3456b.tar.bz2
boltzgen-091811762b7f2cbb6575139276ea16bf54d3456b.tar.lz
boltzgen-091811762b7f2cbb6575139276ea16bf54d3456b.tar.xz
boltzgen-091811762b7f2cbb6575139276ea16bf54d3456b.tar.zst
boltzgen-091811762b7f2cbb6575139276ea16bf54d3456b.zip
Add basic setup.py
No guarantee for correctness - I mostly fiddled this together in order to use common nixpkgs python package functions for including boltzgen in other shell environments.
-rw-r--r--boltzgen/__init__.py13
-rw-r--r--boltzgen/geometry.py2
-rw-r--r--boltzgen/kernel/__init__.py2
-rw-r--r--boltzgen/kernel/generator.py7
-rw-r--r--boltzgen/kernel/target/__init__.py2
-rw-r--r--boltzgen/kernel/target/layout/__init__.py4
-rw-r--r--boltzgen/lbm/__init__.py4
-rw-r--r--boltzgen/lbm/model/__init__.py6
-rw-r--r--boltzgen/utility/__init__.py2
-rw-r--r--setup.py18
10 files changed, 42 insertions, 18 deletions
diff --git a/boltzgen/__init__.py b/boltzgen/__init__.py
index d12f06d..01fc32c 100644
--- a/boltzgen/__init__.py
+++ b/boltzgen/__init__.py
@@ -1,10 +1,5 @@
-from lbm import LBM
+import boltzgen.lbm.model
-import lbm.model.D2Q9
-import lbm.model.D3Q7
-import lbm.model.D3Q19
-import lbm.model.D3Q27
-
-from geometry import Geometry
-
-from kernel.generator import Generator
+from boltzgen.lbm import LBM
+from boltzgen.geometry import Geometry
+from boltzgen.kernel.generator import Generator
diff --git a/boltzgen/geometry.py b/boltzgen/geometry.py
index 193cbe6..7cc406d 100644
--- a/boltzgen/geometry.py
+++ b/boltzgen/geometry.py
@@ -1,5 +1,5 @@
import re
-from utility.ndindex import ndindex
+from .utility.ndindex import ndindex
class Geometry:
def __init__(self, size_x, size_y, size_z = 1):
diff --git a/boltzgen/kernel/__init__.py b/boltzgen/kernel/__init__.py
new file mode 100644
index 0000000..92d1853
--- /dev/null
+++ b/boltzgen/kernel/__init__.py
@@ -0,0 +1,2 @@
+from . import generator
+from . import target
diff --git a/boltzgen/kernel/generator.py b/boltzgen/kernel/generator.py
index 47fb245..5a1a37d 100644
--- a/boltzgen/kernel/generator.py
+++ b/boltzgen/kernel/generator.py
@@ -3,8 +3,7 @@ import sympy
from mako.template import Template
from pathlib import Path
-import kernel.target.layout
-import kernel.target.precision
+import boltzgen.kernel.target
class Generator:
def __init__(self, descriptor, moments, collision):
@@ -34,7 +33,7 @@ class Generator:
)
def kernel(self, target, precision, layout, geometry, functions, extras = []):
- layout_impl = eval("kernel.target.layout.%s.%s" % (target, layout))
+ layout_impl = eval("boltzgen.kernel.target.layout.%s.%s" % (target, layout))
if layout_impl is None:
raise Exception("Target '%s' doesn't support layout '%s'" % (target, layout))
else:
@@ -43,6 +42,6 @@ class Generator:
if geometry.dimension() != self.descriptor.d:
raise Exception('Geometry dimension must match descriptor dimension')
- float_type = eval("kernel.target.precision.%s" % target).get_float_type(precision)
+ float_type = eval("boltzgen.kernel.target.precision.%s" % target).get_float_type(precision)
return "\n".join(map(lambda f: self.instantiate(target, f, float_type, layout_impl, geometry, extras), functions))
diff --git a/boltzgen/kernel/target/__init__.py b/boltzgen/kernel/target/__init__.py
new file mode 100644
index 0000000..e3f8dad
--- /dev/null
+++ b/boltzgen/kernel/target/__init__.py
@@ -0,0 +1,2 @@
+from . import layout
+from . import precision
diff --git a/boltzgen/kernel/target/layout/__init__.py b/boltzgen/kernel/target/layout/__init__.py
index 3887e07..44e92e6 100644
--- a/boltzgen/kernel/target/layout/__init__.py
+++ b/boltzgen/kernel/target/layout/__init__.py
@@ -1,2 +1,2 @@
-import kernel.target.layout.cl
-import kernel.target.layout.cpp
+from . import cl
+from . import cpp
diff --git a/boltzgen/lbm/__init__.py b/boltzgen/lbm/__init__.py
index bafe331..8206baa 100644
--- a/boltzgen/lbm/__init__.py
+++ b/boltzgen/lbm/__init__.py
@@ -1,8 +1,8 @@
from sympy import *
from sympy.codegen.ast import Assignment
-import utility.optimizations as optimizations
-from lbm.model.characteristics import weights, c_s
+import boltzgen.utility.optimizations as optimizations
+from boltzgen.lbm.model.characteristics import weights, c_s
def assign(names, definitions):
diff --git a/boltzgen/lbm/model/__init__.py b/boltzgen/lbm/model/__init__.py
new file mode 100644
index 0000000..c956759
--- /dev/null
+++ b/boltzgen/lbm/model/__init__.py
@@ -0,0 +1,6 @@
+from . import D2Q9
+from . import D3Q7
+from . import D3Q19
+from . import D3Q27
+
+from . import characteristics
diff --git a/boltzgen/utility/__init__.py b/boltzgen/utility/__init__.py
new file mode 100644
index 0000000..8927868
--- /dev/null
+++ b/boltzgen/utility/__init__.py
@@ -0,0 +1,2 @@
+from . import optimizations
+from . import ndindex
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..af00a78
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+
+from setuptools import setup, find_packages
+
+setup(
+ name = 'boltzgen',
+ version = '0.1',
+ description = 'Symbolic generation of LBM kernels',
+ author = 'Adrian Kummerlaender',
+ packages = find_packages(),
+ include_package_data = True,
+ package_data = {'boltzgen': ['kernel/template/*.mako']},
+ install_requires = [
+ 'sympy >= 1.4',
+ 'numpy >= 1.17.2',
+ 'mako >= 1.0.12'
+ ]
+)