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

Import sorting using isort

parent cd0949ab
import sympy as sp
import pystencils as ps
from pystencils.fast_approximation import insert_fast_divisions, insert_fast_sqrts, fast_sqrt, fast_inv_sqrt, \
fast_division
from pystencils.fast_approximation import (
fast_division, fast_inv_sqrt, fast_sqrt, insert_fast_divisions, insert_fast_sqrts)
def test_fast_sqrt():
......
import pytest
import sympy as sp
from pystencils.utils import LinearEquationSystem
......
import pytest
import numpy as np
import pytest
import sympy as sp
import pystencils as ps
from pystencils import Field, FieldType
from pystencils.field import Field, FieldType
from pystencils.field import layout_string_to_tuple
......
import sympy as sp
import pystencils as ps
from pystencils.astnodes import LoopOverCoordinate
from pystencils.fd.spatial import fd_stencils_standard, fd_stencils_isotropic, discretize_spatial
from pystencils.fd import diff
from pystencils.fd.spatial import discretize_spatial, fd_stencils_isotropic, fd_stencils_standard
def test_spatial_2d_unit_sum():
......
import numpy as np
from pystencils import Field, Assignment
from pystencils import Assignment, Field
from pystencils.cpu import create_indexed_kernel, make_python_function
......
import numpy as np
from pystencils import show_code
from pystencils.transformations import move_constants_before_loop, make_loop_over_domain, resolve_field_accesses
from pystencils.field import Field
from pystencils.astnodes import SympyAssignment, Block, KernelFunction
from pystencils.astnodes import Block, KernelFunction, SympyAssignment
from pystencils.cpu import make_python_function
from pystencils.field import Field
from pystencils.transformations import (
make_loop_over_domain, move_constants_before_loop, resolve_field_accesses)
def test_jacobi_fixed_field_size():
......
import numpy as np
from pystencils import Assignment, Field
from pystencils.llvm import create_kernel, make_python_function
from pystencils.llvm.llvmjit import generate_and_jit
......
import os
import numpy as np
import sympy as sp
from pystencils import Field, Assignment
from pystencils.kerncraft_coupling import PyStencilsKerncraftKernel, KerncraftParameters
from pystencils.kerncraft_coupling.generate_benchmark import generate_benchmark
from pystencils.cpu import create_kernel
import pytest
import sympy as sp
import kerncraft
from kerncraft.models import ECMData, ECM, Benchmark
from kerncraft.machinemodel import MachineModel
from kerncraft.kernel import KernelCode
from pystencils import Assignment, Field
from pystencils.cpu import create_kernel
from pystencils.kerncraft_coupling import KerncraftParameters, PyStencilsKerncraftKernel
from pystencils.kerncraft_coupling.generate_benchmark import generate_benchmark
SCRIPT_FOLDER = os.path.dirname(os.path.realpath(__file__))
INPUT_FOLDER = os.path.join(SCRIPT_FOLDER, "kerncraft_inputs")
......@@ -19,11 +17,11 @@ INPUT_FOLDER = os.path.join(SCRIPT_FOLDER, "kerncraft_inputs")
@pytest.mark.kernkraft
def test_compilation():
machine_file_path = os.path.join(INPUT_FOLDER, "default_machine_file.yaml")
machine = MachineModel(path_to_yaml=machine_file_path)
machine = kerncraft.machinemodel.MachineModel(path_to_yaml=machine_file_path)
kernel_file_path = os.path.join(INPUT_FOLDER, "2d-5pt.c")
with open(kernel_file_path) as kernel_file:
reference_kernel = KernelCode(kernel_file.read(), machine=machine, filename=kernel_file_path)
reference_kernel = kerncraft.kernel.KernelCode(kernel_file.read(), machine=machine, filename=kernel_file_path)
reference_kernel.as_code('likwid')
size = [30, 50, 3]
......@@ -41,17 +39,17 @@ def test_compilation():
@pytest.mark.kernkraft
def analysis(kernel, model='ecmdata'):
machine_file_path = os.path.join(INPUT_FOLDER, "default_machine_file.yaml")
machine = MachineModel(path_to_yaml=machine_file_path)
machine = kerncraft.machinemodel.MachineModel(path_to_yaml=machine_file_path)
if model == 'ecmdata':
model = ECMData(kernel, machine, KerncraftParameters())
model = kerncraft.models.ECMData(kernel, machine, KerncraftParameters())
elif model == 'ecm':
model = ECM(kernel, machine, KerncraftParameters())
model = kerncraft.models.ECM(kernel, machine, KerncraftParameters())
# model.analyze()
# model.plot()
elif model == 'benchmark':
model = Benchmark(kernel, machine, KerncraftParameters())
model = kerncraft.models.Benchmark(kernel, machine, KerncraftParameters())
else:
model = ECM(kernel, machine, KerncraftParameters())
model = kerncraft.models.ECM(kernel, machine, KerncraftParameters())
model.analyze()
return model
......@@ -62,9 +60,9 @@ def test_3d_7pt_iaca():
size = [20, 200, 200]
kernel_file_path = os.path.join(INPUT_FOLDER, "3d-7pt.c")
machine_file_path = os.path.join(INPUT_FOLDER, "default_machine_file.yaml")
machine = MachineModel(path_to_yaml=machine_file_path)
machine = kerncraft.machinemodel.MachineModel(path_to_yaml=machine_file_path)
with open(kernel_file_path) as kernel_file:
reference_kernel = KernelCode(kernel_file.read(), machine=machine, filename=kernel_file_path)
reference_kernel = kerncraft.kernel.KernelCode(kernel_file.read(), machine=machine, filename=kernel_file_path)
reference_kernel.set_constant('M', size[0])
reference_kernel.set_constant('N', size[1])
assert size[1] == size[2]
......@@ -89,7 +87,7 @@ def test_2d_5pt():
size = [30, 50, 3]
kernel_file_path = os.path.join(INPUT_FOLDER, "2d-5pt.c")
with open(kernel_file_path) as kernel_file:
reference_kernel = KernelCode(kernel_file.read(), machine=None, filename=kernel_file_path)
reference_kernel = kerncraft.kernel.KernelCode(kernel_file.read(), machine=None, filename=kernel_file_path)
reference = analysis(reference_kernel)
arr = np.zeros(size)
......@@ -111,7 +109,7 @@ def test_3d_7pt():
size = [30, 50, 50]
kernel_file_path = os.path.join(INPUT_FOLDER, "3d-7pt.c")
with open(kernel_file_path) as kernel_file:
reference_kernel = KernelCode(kernel_file.read(), machine=None, filename=kernel_file_path)
reference_kernel = kerncraft.kernel.KernelCode(kernel_file.read(), machine=None, filename=kernel_file_path)
reference_kernel.set_constant('M', size[0])
reference_kernel.set_constant('N', size[1])
assert size[1] == size[2]
......
import sympy as sp
import numpy as np
import sympy as sp
import pystencils as ps
from pystencils import Field
from pystencils.cpu import create_kernel, make_python_function
import pystencils.astnodes as ast
from pystencils.field import Field
from pystencils.astnodes import Conditional, LoopOverCoordinate, SympyAssignment
from pystencils.cpu import create_kernel, make_python_function
from pystencils.kernelcreation import create_staggered_kernel
from pystencils.transformations import move_constants_before_loop
import pystencils.astnodes as ast
from pystencils.transformations import simplify_conditionals, cleanup_blocks, cut_loop
from pystencils.transformations import (
cleanup_blocks, cut_loop, move_constants_before_loop, simplify_conditionals)
def offsets_in_plane(normal_plane, offset_int, dimension):
......
import pystencils as ps
import numpy as np
from pystencils.astnodes import LoopOverCoordinate, Block, SympyAssignment, TypedSymbol
import pystencils as ps
from pystencils.astnodes import Block, LoopOverCoordinate, SympyAssignment, TypedSymbol
from pystencils.transformations import move_constants_before_loop
......
import io
import json
from http.server import HTTPServer, BaseHTTPRequestHandler
from http.server import BaseHTTPRequestHandler, HTTPServer
from tempfile import TemporaryDirectory
from pystencils.runhelper import ParameterStudy
......
from pystencils import Field, TypedSymbol
from copy import copy, deepcopy
from pystencils.field import Field
from pystencils.data_types import TypedSymbol
def test_field_access():
field = Field.create_generic('some_field', spatial_dimensions=2, index_dimensions=0)
......
import os
from tempfile import TemporaryDirectory
import numpy as np
import pystencils.plot as plt
......
import numpy as np
import pystencils as ps
from pystencils.rng import PhiloxTwoDoubles, PhiloxFourFloats
from pystencils.rng import PhiloxFourFloats, PhiloxTwoDoubles
def test_philox_double():
......
import sympy as sp
from pystencils import Assignment, AssignmentCollection
from pystencils.simp import SimplificationStrategy, apply_on_all_subexpressions, \
subexpression_substitution_in_existing_subexpressions
from pystencils.simp import (
SimplificationStrategy, apply_on_all_subexpressions,
subexpression_substitution_in_existing_subexpressions)
def test_simplification_strategy():
......
import numpy as np
import pytest
from pystencils import Field, Assignment, fields, create_kernel
import sympy as sp
from pystencils import Assignment, Field, create_kernel, fields
def test_size_check():
"""Kernel with two fixed-sized fields creating with same size but calling with wrong size"""
......
import numpy as np
from pystencils import Field, Assignment
from pystencils import Assignment, Field
from pystencils.llvm import create_kernel, make_python_function
......
import numpy as np
import sympy as sp
from pystencils import TypedSymbol, make_slice, Assignment, create_kernel, Field
from pystencils import Assignment, Field, TypedSymbol, create_kernel, make_slice
from pystencils.simp import sympy_cse_on_assignment_list
......
import numpy as np
from pystencils import Field, create_kernel, Assignment
from pystencils import Assignment, Field, create_kernel
def test_fixed_sized_field():
......
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