Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

DSL and compiler framework for automated finite-differences and stencil computation

License

NotificationsYou must be signed in to change notification settings

devitocodes/devito

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status for the Core backendBuild Status with MPIBuild Status on GPUCode CoverageSlack StatusasvPyPI versionBinderDocker

Devito is a Python package to implementoptimized stencil computation (e.g., finite differences, image processing,machine learning) from high-level symbolic problem definitions. Devito buildsonSymPy and employs automated codegeneration and just-in-time compilation to execute optimized computationalkernels on several computer platforms, including CPUs, GPUs, and clustersthereof.

About Devito

Devito provides a functional language to implement sophisticated operators thatcan be made up of multiple stencil computations, boundary conditions, sparseoperations (e.g., interpolation), and much more. A typical use case isexplicit finite difference methods for approximating partial differentialequations. For example, a 2D diffusion operator may be implemented with Devitoas follows

>>>grid=Grid(shape=(10,10))>>>f=TimeFunction(name='f',grid=grid,space_order=2)>>>eqn=Eq(f.dt,0.5*f.laplace)>>>op=Operator(Eq(f.forward,solve(eqn,f.forward)))

AnOperator generates low-level code from an ordered collection ofEq (theexample above being for a single equation). This code may also be compiled andexecuted

>>>op(t=timesteps,dt=dt)

There is virtually no limit to the complexity of anOperator -- the Devitocompiler will automatically analyze the input, detect and apply optimizations(including single- and multi-node parallelism), and eventually generate codewith suitable loops and expressions.

Key features include:

  • A functional language to express finite difference operators.
  • Straightforward mechanisms to adjust the discretization.
  • Constructs to express sparse operators (e.g., interpolation), classic linearoperators (e.g., convolutions), and tensor contractions.
  • Seamless support for boundary conditions and adjoint operators.
  • A flexible API to define custom stencils, sub-domains, sub-sampling,and staggered grids.
  • Generation of highly optimized parallel code (SIMD vectorization, CPU andGPU parallelism via OpenMP and OpenACC, multi-node parallelism via MPI,blocking, aggressive symbolic transformations for FLOP reduction, etc.).
  • Distributed NumPy arrays over multi-node (MPI) domain decompositions.
  • Inspection and customization of the generated code.
  • Autotuning framework to ease performance tuning.
  • Smooth integration with popular Python packages such as NumPy, SymPy, Dask,and SciPy, as well as machine learning frameworks such as TensorFlow andPyTorch.

Installation

The easiest way to try Devito is through Docker using the following commands:

# get the codegit clone https://github.com/devitocodes/devito.gitcd devito# start a jupyter notebook server on port 8888docker-compose up devito

After running the last command above, the terminal will display a URL such ashttps://127.0.0.1:8888/?token=XXX. Copy-paste this URL into a browser windowto start aJupyter notebook session where you can gothrough thetutorialsprovided with Devito or create your own notebooks.

See here for detailed installationinstructions and other options. If you encounter a problem during installation, pleasesee theinstallation issues wehave seen in the past.

Resources

To learn how to use Devito,here is a goodplace to start, with lots of examples and tutorials.

Thewebsite also provides access to otherinformation, including documentation and instructions for citing us.

Some FAQs are discussedhere.

Performance

If you are interested in any of the following

  • Generation of parallel code (CPU, GPU, multi-node via MPI);
  • Performance tuning;
  • Benchmarking operators;

then you should take a look at thisREADME.

Get in touch

If you're using Devito, we would like to hear from you. Whether youare facing issues or just trying it out, join theconversation.

Interactive jupyter notebooks

The tutorial jupyter notebook are available interactively at the publicbinder jupyterhub.


[8]ページ先頭

©2009-2025 Movatter.jp