Git Product home page Git Product logo

ddc's Introduction

The discrete domain computation library (DDC)

See https://ddc.mdls.fr/

DDC, is a C++-17 library that aims to offer to the C++/MPI world an equivalent to the xarray.DataArray/dask.Array python environment. Where these two libraries are based on numpy, DDC relies on Kokkos and mdspan to offer CPU/GPU performance-portable multi-dimensional arrays and iterators.

DDC aims to offer abstractions to represent:

  • tagged continuous dimensions,
  • discretizations of these (multiple kinds of meshes, function spaces, Fourier, etc.),
  • domains in these discretized dimensions,
  • associating data to the elements of these discrete domains,
  • efficient distribution and iteration over this data.

All these abstractions are handled at compilation using C++ template meta-programming to ensure zero overhead at execution and enable developers to change their design choices (e.g. from a regular mesh to a non-uniform one) with performance portability.

Find out more...

If you like the project, please leave us a github star.

If you want to know more, join un on Slack

Getting the code and basic configuration

git clone --recurse-submodules -j4 https://github.com/CExA-project/ddc.git
cd ddc
cmake -B build -D DDC_BUILD_KERNELS_FFT=OFF -D DDC_BUILD_KERNELS_SPLINES=OFF -D DDC_BUILD_PDI_WRAPPER=OFF
cmake --build build

ddc's People

Contributors

acalloo avatar alex-m-h avatar blegouix avatar emilybourne avatar gsabelette avatar jbigot avatar rb214678 avatar thierryantoun avatar tpadioleau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ddc's Issues

Unification of the interface of multi-dimensional algorithms

I suggest that we try an implementation of the for_each algorithm independent of the DiscreteDomain and DiscreteVector classes. I would prefer an implementation that should work for any class that implements the concept of a cartesian product, that remains to be defined.

This also applies to transform_reduce and deep_copy.

Public header naming convention

Should we have different public headers for the library, with a naming convention, or only a single header like #include <ddc>

Prepare v1 release

  • namespace ddc
  • document the concepts
  • architectures support: NVIDIA and AMD GPUs, CPUs
  • respect naming conventions

Allow addition of non-exact matching objects

I think it would be useful to allow expressions such as:

ddc::DiscreteElement<Dim1, Dim2> old_pos = ...;
ddc::DiscreteElement<Dim1, Dim2> new_pos = old_pos + ddc::DiscreteVector<Dim2>(3);

Currently it is only possible to do:

ddc::DiscreteElement<Dim1, Dim2> old_pos = ...;
ddc::DiscreteElement<Dim1, Dim2> new_pos = old_pos + ddc::DiscreteVector<Dim1, Dim2>(3, 0);

This addition would be useful in cases where we know that Dim2 is one of the dimensions but we don't want to specialise the function for all possible values of Dim1 (present or not present)

Distinguish between vertices, edges, faces & cells in the discretization

See https://gitlab.maisondelasimulation.fr/gysela-developpers/voicexx/-/issues/34

Currently and according to Voice++#26 , we only discretize points (vertices).
I would like to introduce edges discretization also.

For example, in 3D, this could look like so:

using IDimX = ×DiscretizationOf<RDimX>;
using IDimY = ×DiscretizationOf<RDimY>;
using IDimZ = ×DiscretizationOf<RDimZ>;

using IVerticesSpace = DiscreteSpace<IDimX,        IDimY,        IDimZ>;
using IXEdgesSpace   = DiscreteSpace<IDimX::Edges, IDimY,        IDimZ>;
using IYEdgesSpace   = DiscreteSpace<IDimX,        IDimY::Edges, IDimZ>;
using IXFacesSpace   = DiscreteSpace<IDimX,        IDimY::Edges, IDimZ::Edges>;
using IYFacesSpace   = DiscreteSpace<IDimX::Edges, IDimY,        IDimZ::Edges>;
using ICellsSpace    = DiscreteSpace<IDimX::Edges, IDimY::Edges, IDimZ::Edges>;

The real type would be a tensor product that would combine either Point<RDim> or Interval<RDim>

using RVertex = VectorElement<Point<RDimX>,    Point<RDimY>,    Point<RDimZ>>;
using RXEdge  = VectorElement<Interval<RDimX>, Point<RDimY>,    Point<RDimZ>>;
using RYEdge  = VectorElement<Point<RDimX>,    Interval<RDimY>, Point<RDimZ>>;
using RXFace  = VectorElement<Point<RDimX>,    Interval<RDimY>, Interval<RDimZ>>;
using RYFace  = VectorElement<Interval<RDimX>, Point<RDimY>,    Interval<RDimZ>>;
using RCell   = VectorElement<Interval<RDimX>, Interval<RDimY>, Interval<RDimZ>>;

The to_real() function would yield a type that depends on the discrete space:

IVerticesSpace vertices_space = /*[...]*/;
ICellsSpace cell_space = /*[...]*/;
RVertex = vertices_space.to_real(/*[...]*/);
RCell = cell_space.to_real(/*[...]*/);

parallel loops with scratch buffer

We should offer a way to provide a scratch buffer in our parallel loops that would support efficient access when all iterations access the buffer with the same pattern (one buffer/thread on the right NUMA node for OMP, interleaved buffers on GPU, etc.)
I believe this can be built on top of #56 & #57 .

Discussion about Intel GPU support

We currently use global variables to store some data related to discrete spaces. I do not see any implementation of a device global variable for now, only a discussion about it here, see also there.

Decouple discrete dimensions from discrete spaces

As for now, discrete dimensions are represented by the discrete spaces themselves. For example this forces the definition of two classes to differentiate nodes from cells in a 1d mesh.
We want to decouple the two in order to be able to ease the definition of multiple discrete dimensions.

Use a signed integer type for DiscreteElementType

With the recent possibility for mdspan to choose the index_type, I think we should a signed integer type common for DiscreteElementType, std::extents and iterators difference_type that is to say std::ptrdiff_t.

Optimize FFT normalization

Depending on the choice of normalization, the norm_coef can be 1. In these cases we could optimize out the loop normalizing the data.

Rename internal types to match new naming scheme

Our types in classes haven't been renamed in the big !73 renaming. For example, we have stuff like:

template <class... DDims>
class DiscreteDomain
{
public:
    using mcoord_type = DiscreteCoordinate<DDims...>;
};

This should read more like:

template <class... DDims>
class DiscreteDomain
{
public:
    using discrete_coordinate_type = DiscreteCoordinate<DDims...>;
};

Introduce a namespace

I suggest to introduce a ddc namespace along with using namespace ddc; in the <ddc/ddc.hpp> header to not break application codes for now.

Looping over an empty domain results in entering into the loop

In the following code:

DiscreteDomain<BSplines> const dom_bsplines_singular(
            DiscreteElement<BSplines>(0),
            DiscreteVector<BSplines>(BSplines::n_singular_basis()));
Chunk<double, DiscreteDomain<BSplines>> singular_spline_coef(dom_bsplines_singular);
for_each(singular_spline_coef.domain(), [&](DiscreteElement<BSplines> const i) {
    singular_spline_coef(i) = 1.0;
});

where n_singular_basis() returns 0, the loop is entered resulting in a seg fault at the line singular_spline_coef(i) = 1.0;

Can't create a multi-D `Coordinate` from a multi-D `DiscreteElement`

I can do:

Coordinate<MyDim> get_coord(DiscreteElement<UniformPointSampling<MyDim>> el) {
    return coordinate(el);
}

but not:

Coordinate<MyDim1, MyDim2> get_coord(DiscreteElement<UniformPointSampling<MyDim1>,UniformPointSampling<MyDim2>> el) {
    return coordinate(el);
}

This should be possible

Cleanup inline, constexpr & noexcept

We currently apply the constexpr, inline & noexcept modifiers to functions somewhat randomly. This should be reviewed. We should come up with some guidelines and apply them all-around.

Clearly distinguish `DiscreteCoordinate`/`DiscreteVector`

Issue following issue 41 in the gitlab.

I think we need three types similar to the manipulation of pointers in C++:

  • T*
  • std::size_t
  • std::ptrdiff_t

In our case we would have:

  • DiscreteCoordinate, identifier of a element of discretization
  • DiscreteSize, multidimensional size
  • DiscreteVector, multidimensional displacement

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.