Commit 6373c03a authored by Martin Bauer's avatar Martin Bauer
Browse files

Import sorting using isort

parent cd0949ab
"""This submodule offers functions to work with stencils in expression an offset-list form.""" """This submodule offers functions to work with stencils in expression an offset-list form."""
from collections import defaultdict
from typing import Sequence from typing import Sequence
import numpy as np import numpy as np
import sympy as sp import sympy as sp
from collections import defaultdict
def inverse_direction(direction): def inverse_direction(direction):
...@@ -91,7 +92,7 @@ def coefficient_dict(expr): ...@@ -91,7 +92,7 @@ def coefficient_dict(expr):
>>> sorted(coeffs.items()) >>> sorted(coeffs.items())
[((-1, 0), 3), ((0, 1), 2)] [((-1, 0), 3), ((0, 1), 2)]
""" """
from pystencils import Field from pystencils.field import Field
expr = expr.expand() expr = expr.expand()
field_accesses = expr.atoms(Field.Access) field_accesses = expr.atoms(Field.Access)
fields = set(fa.field for fa in field_accesses) fields = set(fa.field for fa in field_accesses)
......
import itertools import itertools
import warnings
import operator import operator
from functools import reduce, partial import warnings
from collections import defaultdict, Counter from collections import Counter, defaultdict
from functools import partial, reduce
from typing import Callable, Dict, Iterable, List, Optional, Sequence, Tuple, TypeVar, Union
import sympy as sp import sympy as sp
from sympy.functions import Abs from sympy.functions import Abs
from typing import Optional, Union, List, TypeVar, Iterable, Sequence, Callable, Dict, Tuple
from pystencils.data_types import get_type_of_expression, get_base_type, cast_func
from pystencils.assignment import Assignment from pystencils.assignment import Assignment
from pystencils.data_types import cast_func, get_base_type, get_type_of_expression
T = TypeVar('T') T = TypeVar('T')
......
import hashlib
import pickle
import warnings import warnings
from collections import defaultdict, OrderedDict, namedtuple from collections import OrderedDict, defaultdict, namedtuple
from copy import deepcopy from copy import deepcopy
from types import MappingProxyType from types import MappingProxyType
import pickle
import hashlib
import sympy as sp import sympy as sp
from sympy.logic.boolalg import Boolean from sympy.logic.boolalg import Boolean
from pystencils.simp.assignment_collection import AssignmentCollection
import pystencils.astnodes as ast
from pystencils.assignment import Assignment from pystencils.assignment import Assignment
from pystencils.field import AbstractField, FieldType, Field from pystencils.data_types import (
from pystencils.data_types import TypedSymbol, PointerType, StructType, get_base_type, reinterpret_cast_func, \ PointerType, StructType, TypedSymbol, cast_func, collate_types, create_type, get_base_type,
cast_func, pointer_arithmetic_func, get_type_of_expression, collate_types, create_type get_type_of_expression, pointer_arithmetic_func, reinterpret_cast_func)
from pystencils.field import AbstractField, Field, FieldType
from pystencils.kernelparameters import FieldPointerSymbol from pystencils.kernelparameters import FieldPointerSymbol
from pystencils.simp.assignment_collection import AssignmentCollection
from pystencils.slicing import normalize_slice from pystencils.slicing import normalize_slice
import pystencils.astnodes as ast
class NestedScopes: class NestedScopes:
......
import os import os
from tempfile import NamedTemporaryFile from collections import Counter
from contextlib import contextmanager from contextlib import contextmanager
from tempfile import NamedTemporaryFile
from typing import Mapping from typing import Mapping
from collections import Counter
import sympy as sp
import numpy as np import numpy as np
import sympy as sp
class DotDict(dict): class DotDict(dict):
......
import os
import math import math
import os
import time import time
import numpy as np import numpy as np
import sympy as sp import sympy as sp
from influxdb import InfluxDBClient
from git import Repo from git import Repo
from kerncraft.models import ECM, Benchmark, Roofline, RooflineIACA from influxdb import InfluxDBClient
from kerncraft.machinemodel import MachineModel from kerncraft.machinemodel import MachineModel
from kerncraft.models import ECM, Benchmark, Roofline, RooflineIACA
from kerncraft.prefixedunit import PrefixedUnit from kerncraft.prefixedunit import PrefixedUnit
from pystencils import Assignment, Field, create_kernel
from pystencils.kerncraft_coupling import KerncraftParameters, PyStencilsKerncraftKernel from pystencils.kerncraft_coupling import KerncraftParameters, PyStencilsKerncraftKernel
from pystencils import Field, Assignment, create_kernel
def output_benchmark(analysis): def output_benchmark(analysis):
......
import sympy as sp
import numpy as np import numpy as np
from pystencils import Field, Assignment, create_kernel import sympy as sp
from pystencils import Assignment, Field, create_kernel
def meassure(): def meassure():
...@@ -47,5 +48,3 @@ def meassure(): ...@@ -47,5 +48,3 @@ def meassure():
if __name__ == "__main__": if __name__ == "__main__":
meassure() meassure()
...@@ -3,10 +3,11 @@ ...@@ -3,10 +3,11 @@
Test of pystencils.data_types.address_of Test of pystencils.data_types.address_of
""" """
from pystencils.data_types import address_of, cast_func, PointerType import sympy
import pystencils import pystencils
from pystencils.data_types import PointerType, address_of, cast_func
from pystencils.simp.simplifications import sympy_cse from pystencils.simp.simplifications import sympy_cse
import sympy
def test_address_of(): def test_address_of():
......
import sympy as sp import sympy as sp
from pystencils import Assignment, AssignmentCollection from pystencils import Assignment, AssignmentCollection
from pystencils.simp.assignment_collection import SymbolGen from pystencils.simp.assignment_collection import SymbolGen
......
import pystencils
import numpy as np import numpy as np
import pystencils
def test_assignment_from_stencil(): def test_assignment_from_stencil():
......
import sympy as sp
import numpy as np import numpy as np
import sympy as sp
import pystencils as ps import pystencils as ps
...@@ -58,4 +59,3 @@ def test_jacobi3d_fixed_size(): ...@@ -58,4 +59,3 @@ def test_jacobi3d_fixed_size():
arr = np.empty([8*4, 16*2, 4*3]) arr = np.empty([8*4, 16*2, 4*3])
src, dst = ps.fields("src, dst: double[3D]", src=arr, dst=arr) src, dst = ps.fields("src, dst: double[3D]", src=arr, dst=arr)
check_equivalence(jacobi(dst, src), arr) check_equivalence(jacobi(dst, src), arr)
import numpy as np import numpy as np
import pystencils as ps import pystencils as ps
......
from tempfile import TemporaryDirectory
import os import os
from tempfile import TemporaryDirectory
import numpy as np import numpy as np
from pystencils import create_kernel, Assignment from pystencils import Assignment, create_kernel
from pystencils.boundaries import add_neumann_boundary, Neumann, BoundaryHandling from pystencils.boundaries import BoundaryHandling, Neumann, add_neumann_boundary
from pystencils.datahandling import SerialDataHandling from pystencils.datahandling import SerialDataHandling
from pystencils.slicing import slice_from_direction from pystencils.slicing import slice_from_direction
......
"""Tests (un)packing (from)to buffers.""" """Tests (un)packing (from)to buffers."""
import numpy as np import numpy as np
from pystencils import Field, FieldType, Assignment, create_kernel
from pystencils.field import layout_string_to_tuple, create_numpy_array_with_layout
from pystencils.stencil import direction_string_to_offset
from pystencils.slicing import add_ghost_layers, get_slice_before_ghost_layer, get_ghost_region_slice
from pystencils import Assignment, Field, FieldType, create_kernel
from pystencils.field import create_numpy_array_with_layout, layout_string_to_tuple
from pystencils.slicing import (
add_ghost_layers, get_ghost_region_slice, get_slice_before_ghost_layer)
from pystencils.stencil import direction_string_to_offset
FIELD_SIZES = [(32, 10), (10, 8, 6)] FIELD_SIZES = [(32, 10), (10, 8, 6)]
......
"""Tests for the (un)packing (from)to buffers on a CUDA GPU.""" """Tests for the (un)packing (from)to buffers on a CUDA GPU."""
import numpy as np import numpy as np
from pystencils import Field, FieldType, Assignment
from pystencils.field import layout_string_to_tuple, create_numpy_array_with_layout
from pystencils.stencil import direction_string_to_offset
from pystencils.gpucuda import make_python_function, create_cuda_kernel
from pystencils.slicing import add_ghost_layers, get_slice_before_ghost_layer, get_ghost_region_slice
import pytest import pytest
from pystencils import Assignment, Field, FieldType
from pystencils.field import create_numpy_array_with_layout, layout_string_to_tuple
from pystencils.gpucuda import create_cuda_kernel, make_python_function
from pystencils.slicing import (
add_ghost_layers, get_ghost_region_slice, get_slice_before_ghost_layer)
from pystencils.stencil import direction_string_to_offset
try: try:
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
import pycuda.autoinit import pycuda.autoinit
......
import pystencils as ps
import sympy as sp
import numpy as np import numpy as np
from pystencils.astnodes import Conditional, Block import sympy as sp
import pystencils as ps
from pystencils.astnodes import Block, Conditional
from pystencils.cpu.vectorization import vec_all, vec_any from pystencils.cpu.vectorization import vec_all, vec_any
......
import numpy as np import numpy as np
import sympy as sp
from pystencils import Field, Assignment, fields
from pystencils.simp import sympy_cse_on_assignment_list
from pystencils.gpucuda.indexing import LineIndexing
from pystencils.slicing import remove_ghost_layers, add_ghost_layers, make_slice
from pystencils.gpucuda import make_python_function, create_cuda_kernel, BlockIndexing
import pycuda.gpuarray as gpuarray import pycuda.gpuarray as gpuarray
import sympy as sp
from scipy.ndimage import convolve from scipy.ndimage import convolve
from pystencils import Assignment, Field, fields
from pystencils.gpucuda import BlockIndexing, create_cuda_kernel, make_python_function
from pystencils.gpucuda.indexing import LineIndexing
from pystencils.simp import sympy_cse_on_assignment_list
from pystencils.slicing import add_ghost_layers, make_slice, remove_ghost_layers
def test_averaging_kernel(): def test_averaging_kernel():
size = (40, 55) size = (40, 55)
......
import numpy as np
import os import os
from tempfile import TemporaryDirectory from tempfile import TemporaryDirectory
import numpy as np
import pystencils as ps import pystencils as ps
from pystencils import create_kernel, create_data_handling from pystencils import create_data_handling, create_kernel
def basic_iteration(dh): def basic_iteration(dh):
......
import numpy as np import numpy as np
from pystencils.datahandling.parallel_datahandling import ParallelDataHandling
from pystencils_tests.test_datahandling import access_and_gather, synchronization, kernel_execution_jacobi, vtk_output, \
reduction
import waLBerla as wlb import waLBerla as wlb
from pystencils.datahandling.parallel_datahandling import ParallelDataHandling
from pystencils_tests.test_datahandling import (
access_and_gather, kernel_execution_jacobi, reduction, synchronization, vtk_output)
def test_access_and_gather(): def test_access_and_gather():
block_size = (4, 7, 1) block_size = (4, 7, 1)
......
import sympy as sp import sympy as sp
import pystencils as ps from sympy.abc import a, b, t, x, y, z
from sympy.printing.latex import LatexPrinter from sympy.printing.latex import LatexPrinter
import pystencils as ps
from pystencils.fd import * from pystencils.fd import *
from sympy.abc import a, b, t, x, y, z
def test_derivative_basic(): def test_derivative_basic():
......
import pystencils
import numpy as np import numpy as np
import pytest import pytest
import pystencils
def test_dtype_check_wrong_type(): def test_dtype_check_wrong_type():
array = np.ones((10, 20)).astype(np.float32) array = np.ones((10, 20)).astype(np.float32)
......
Markdown is supported
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