diff --git a/examples/multiresolution/scalar_advection.py b/examples/multiresolution/scalar_advection.py index 54aa1ab554d326a4addb59bb4a3d64e5b0132b51..bf87e882ccc267e996bcd2f000ef4fe7af849d7a 100644 --- a/examples/multiresolution/scalar_advection.py +++ b/examples/multiresolution/scalar_advection.py @@ -36,7 +36,7 @@ def compute(args): # Define domain dim = args.ndim npts = args.npts - snpts = tuple(2*x for x in args.npts) + snpts = tuple(3*x for x in args.npts) lboundaries = (BoxBoundaryCondition.PERIODIC,)*dim rboundaries = (BoxBoundaryCondition.PERIODIC,)*dim box = Box(origin=args.box_origin, length=args.box_length, dim=dim, diff --git a/hysop/backend/device/opencl/operator/spatial_filtering.py b/hysop/backend/device/opencl/operator/spatial_filtering.py index 615f993695274c11df1e0e0ca8374f66d7d989ab..7266b3a4b6f76c8cd3cf2cc7af9614e2d3d9dc06 100644 --- a/hysop/backend/device/opencl/operator/spatial_filtering.py +++ b/hysop/backend/device/opencl/operator/spatial_filtering.py @@ -47,22 +47,23 @@ class OpenClSpectralLowpassFilter(SpectralLowpassFilterBase, OpenClOperator): # Here we get the coefficient scaling = 1.0 / self.Bt.output_buffer[(0,)*self.FOUT.ndim].get() - # Now we can finally build the filter scaling kernel and append - # it to the kernel list - fout, = kernel_generator.arrays_to_symbols(self.FOUT) + # Now we can finally build the filter scaling kernel + fout, = kernel_generator.arrays_to_symbols(self.Bt.output_buffer) expr = Assignment(fout, scaling*fout) scale, _ = kernel_generator.elementwise_kernel('scale', expr) - kl += scale + self.scale = functools.partial(scale, queue=self.cl_env.default_queue) # we store the filtering kernel list for the setup step - self.kl = kl + self.filter = functools.partial(kl, queue=self.cl_env.default_queue) + + # finally build ghost exchanger + exchange_ghosts = self.dFout.exchange_ghosts(build_launcher=True) + if (exchange_ghosts is not None): + exchange_ghosts = functools.partial(exchange_ghosts, queue=self.cl_env.default_queue) + self.exchange_ghosts = exchange_ghosts return scaling - def setup(self, work): - super(OpenClSpectralLowpassFilter, self).setup(work=work) - self.filter = functools.partial(self.kl, queue=self.cl_env.default_queue) - self.exchange_ghosts = self.dFout.exchange_ghosts(build_launcher=True) @op_apply def apply(self, **kwds): @@ -71,5 +72,6 @@ class OpenClSpectralLowpassFilter(SpectralLowpassFilterBase, OpenClOperator): evt = self.Ft() evt = self.filter() evt = self.Bt() + evt = self.scale() if (self.exchange_ghosts is not None): evt = self.exchange_ghosts() diff --git a/hysop/backend/host/python/operator/spatial_filtering.py b/hysop/backend/host/python/operator/spatial_filtering.py index b02993d36e7682e0799af9557f4320c7a53c5dbc..18b449e403df5fad1ea694f8d737291070e2c894 100644 --- a/hysop/backend/host/python/operator/spatial_filtering.py +++ b/hysop/backend/host/python/operator/spatial_filtering.py @@ -61,5 +61,5 @@ class PythonSpectralLowpassFilter(SpectralLowpassFilterBase, HostOperator): for i, (src_slc, dst_slc) in enumerate(zip(*self.fslices)): self.FOUT[dst_slc] = self.FIN[src_slc] self.Bt() - scaling = 1.0 / self.Bt.output_buffer[(0,)*self.FOUT.ndim].get() + scaling = 1.0 / self.Bt.output_buffer[(0,)*self.FOUT.ndim] return scaling diff --git a/hysop/core/graph/computational_graph.py b/hysop/core/graph/computational_graph.py index fe26837e0022157535e6d55c904ebbc57a50e9df..27ae81716ead3604f7b672b1dd36061da385fc22 100644 --- a/hysop/core/graph/computational_graph.py +++ b/hysop/core/graph/computational_graph.py @@ -24,7 +24,7 @@ class ComputationalGraph(ComputationalGraphNode): __metaclass__ = ABCMeta - __FORCE_REPORTS__ = True + __FORCE_REPORTS__ = False @debug def __init__(self, candidate_input_tensors=None, diff --git a/hysop/core/graph/graph_builder.py b/hysop/core/graph/graph_builder.py index eca3ae4ffa4acf19d52e74225e3248f300d19d18..d83c1f70860159a29c621a8314c4f2e00d3316e8 100644 --- a/hysop/core/graph/graph_builder.py +++ b/hysop/core/graph/graph_builder.py @@ -35,7 +35,6 @@ def gprint2(*args, **kwds): kwds['level'] = 2 gprint(*args, **kwds) - def _op_info(op, istates=None, ostates=None, jmp=False): diff --git a/hysop/fields/field_requirements.py b/hysop/fields/field_requirements.py index 5cf0bf85449516df7a7606ba858a65668c75999b..2ace41f2f1cb165e41ef85d35e2ef97773458be1 100644 --- a/hysop/fields/field_requirements.py +++ b/hysop/fields/field_requirements.py @@ -15,7 +15,7 @@ from hysop.fields.discrete_field import DiscreteScalarField # 0: no debug logs # 1: topo creation summary for each field # 2: topo creation details for all discrete field requirements -TOPO_CREATION_DEBUG_LEVEL=1 +TOPO_CREATION_DEBUG_LEVEL=0 def gprint(*args, **kwds): level = kwds.pop('level', 2) diff --git a/hysop/operator/base/spatial_filtering.py b/hysop/operator/base/spatial_filtering.py index 0814f52158afd404f252ae764b1c8822297bce53..ca812e4a68c6ff6f20ed4afd879b66db27606e82 100644 --- a/hysop/operator/base/spatial_filtering.py +++ b/hysop/operator/base/spatial_filtering.py @@ -113,7 +113,9 @@ class SpectralLowpassFilterBase(LowpassFilterBase, SpectralOperatorBase): def _generate_filter_slices(self): src_slices = [[]] dst_slices = [[]] - for (N,n,tr) in zip(self.FIN.shape, self.FOUT.shape, self.Ft.transforms[::-1]): + + transforms = tuple(self.Ft.transforms[i] for i in self.Ft.output_axes) + for (N,n,tr) in zip(self.FIN.shape, self.FOUT.shape, transforms): assert len(src_slices) == len(dst_slices) assert n <= N if SpectralTransformUtils.is_C2C(tr): diff --git a/hysop/operator/spatial_filtering.py b/hysop/operator/spatial_filtering.py index f6c87b542c99a9417e9400992eae58c52c935d31..c6470e07dda0edb46b1385eba2293b8651d4aead 100644 --- a/hysop/operator/spatial_filtering.py +++ b/hysop/operator/spatial_filtering.py @@ -89,7 +89,7 @@ class LowpassFilterFrontend(MultiComputationalGraphNodeFrontend): check_instance(input_topo, CartesianTopologyDescriptors) check_instance(output_topo, CartesianTopologyDescriptors) check_instance(base_kwds, dict, keys=str, allow_none=True) - assert (input_topo != output_topo), "Same topology for input and output." + #assert (input_topo != output_topo), "Same topology for input and output." super(LowpassFilterFrontend, self).__init__(input_field=input_field, input_topo=input_topo, output_field=output_field, output_topo=output_topo, @@ -174,8 +174,9 @@ class LowpassFilter(ComputationalGraphNodeGenerator): kwds = self._kwds.copy() # if source topology is destination topology there is nothing to be done - if (ttopo == stopo): - continue + # TODO + #if (ttopo == stopo): + #continue # else we build a lowpass filter operator node = LowpassFilterFrontend(input_variable=(ifield,stopo),