1bcb2dfaeSJed Brown# libCEED: Efficient Extensible Discretization 2bcb2dfaeSJed Brown 3d3fde3fbSJed Brown[![GitHub Actions][github-badge]][github-link] 4d3fde3fbSJed Brown[![GitLab-CI][gitlab-badge]][gitlab-link] 5d3fde3fbSJed Brown[![Azure Pipelines][azure-badge]][azure-link] 6d3fde3fbSJed Brown[![Code coverage][codecov-badge]][codecov-link] 7d3fde3fbSJed Brown[![BSD-2-Clause][license-badge]][license-link] 8d3fde3fbSJed Brown[![Documentation][doc-badge]][doc-link] 9d3fde3fbSJed Brown[![JOSS paper][joss-badge]][joss-link] 10d3fde3fbSJed Brown[![Binder][binder-badge]][binder-link] 11bcb2dfaeSJed Brown 12bcb2dfaeSJed Brown## Summary and Purpose 13bcb2dfaeSJed Brown 14bcb2dfaeSJed BrownlibCEED provides fast algebra for element-based discretizations, designed for 15bcb2dfaeSJed Brownperformance portability, run-time flexibility, and clean embedding in higher 16bcb2dfaeSJed Brownlevel libraries and applications. It offers a C99 interface as well as bindings 17bcb2dfaeSJed Brownfor Fortran, Python, Julia, and Rust. 18bcb2dfaeSJed BrownWhile our focus is on high-order finite elements, the approach is mostly 19bcb2dfaeSJed Brownalgebraic and thus applicable to other discretizations in factored form, as 20bcb2dfaeSJed Brownexplained in the [user manual](https://libceed.readthedocs.io/en/latest/) and 21bcb2dfaeSJed BrownAPI implementation portion of the 22bcb2dfaeSJed Brown[documentation](https://libceed.readthedocs.io/en/latest/api/). 23bcb2dfaeSJed Brown 24bcb2dfaeSJed BrownOne of the challenges with high-order methods is that a global sparse matrix is 25bcb2dfaeSJed Brownno longer a good representation of a high-order linear operator, both with 26bcb2dfaeSJed Brownrespect to the FLOPs needed for its evaluation, as well as the memory transfer 27bcb2dfaeSJed Brownneeded for a matvec. Thus, high-order methods require a new "format" that still 28bcb2dfaeSJed Brownrepresents a linear (or more generally non-linear) operator, but not through a 29bcb2dfaeSJed Brownsparse matrix. 30bcb2dfaeSJed Brown 31bcb2dfaeSJed BrownThe goal of libCEED is to propose such a format, as well as supporting 32bcb2dfaeSJed Brownimplementations and data structures, that enable efficient operator evaluation 33bcb2dfaeSJed Brownon a variety of computational device types (CPUs, GPUs, etc.). This new operator 34bcb2dfaeSJed Browndescription is based on algebraically 35bcb2dfaeSJed Brown[factored form](https://libceed.readthedocs.io/en/latest/libCEEDapi/#finite-element-operator-decomposition), 36bcb2dfaeSJed Brownwhich is easy to incorporate in a wide variety of applications, without significant 37bcb2dfaeSJed Brownrefactoring of their own discretization infrastructure. 38bcb2dfaeSJed Brown 39bcb2dfaeSJed BrownThe repository is part of the 40bcb2dfaeSJed Brown[CEED software suite](http://ceed.exascaleproject.org/software/), a collection of 41bcb2dfaeSJed Brownsoftware benchmarks, miniapps, libraries and APIs for efficient exascale 42bcb2dfaeSJed Browndiscretizations based on high-order finite element and spectral element methods. 43bcb2dfaeSJed BrownSee <http://github.com/ceed> for more information and source code availability. 44bcb2dfaeSJed Brown 45bcb2dfaeSJed BrownThe CEED research is supported by the 46bcb2dfaeSJed Brown[Exascale Computing Project](https://exascaleproject.org/exascale-computing-project) 47bcb2dfaeSJed Brown(17-SC-20-SC), a collaborative effort of two U.S. Department of Energy 48bcb2dfaeSJed Brownorganizations (Office of Science and the National Nuclear Security 49bcb2dfaeSJed BrownAdministration) responsible for the planning and preparation of a 50bcb2dfaeSJed Brown[capable exascale ecosystem](https://exascaleproject.org/what-is-exascale), including 51bcb2dfaeSJed Brownsoftware, applications, hardware, advanced system engineering and early testbed 52bcb2dfaeSJed Brownplatforms, in support of the nation’s exascale computing imperative. 53bcb2dfaeSJed Brown 54bcb2dfaeSJed BrownFor more details on the CEED API see the [user manual](https://libceed.readthedocs.io/en/latest/). 55bcb2dfaeSJed Brown 56bcb2dfaeSJed Brown% gettingstarted-inclusion-marker 57bcb2dfaeSJed Brown 58bcb2dfaeSJed Brown## Building 59bcb2dfaeSJed Brown 60bcb2dfaeSJed BrownThe CEED library, `libceed`, is a C99 library with no required dependencies, and 61bcb2dfaeSJed Brownwith Fortran, Python, Julia, and Rust interfaces. It can be built using: 62bcb2dfaeSJed Brown 63bcb2dfaeSJed Brown``` 64bcb2dfaeSJed Brownmake 65bcb2dfaeSJed Brown``` 66bcb2dfaeSJed Brown 67bcb2dfaeSJed Brownor, with optimization flags: 68bcb2dfaeSJed Brown 69bcb2dfaeSJed Brown``` 70bcb2dfaeSJed Brownmake OPT='-O3 -march=skylake-avx512 -ffp-contract=fast' 71bcb2dfaeSJed Brown``` 72bcb2dfaeSJed Brown 73bcb2dfaeSJed BrownThese optimization flags are used by all languages (C, C++, Fortran) and this 74bcb2dfaeSJed Brownmakefile variable can also be set for testing and examples (below). 75bcb2dfaeSJed Brown 76bcb2dfaeSJed BrownThe library attempts to automatically detect support for the AVX 77bcb2dfaeSJed Browninstruction set using gcc-style compiler options for the host. 78bcb2dfaeSJed BrownSupport may need to be manually specified via: 79bcb2dfaeSJed Brown 80bcb2dfaeSJed Brown``` 81bcb2dfaeSJed Brownmake AVX=1 82bcb2dfaeSJed Brown``` 83bcb2dfaeSJed Brown 84bcb2dfaeSJed Brownor: 85bcb2dfaeSJed Brown 86bcb2dfaeSJed Brown``` 87bcb2dfaeSJed Brownmake AVX=0 88bcb2dfaeSJed Brown``` 89bcb2dfaeSJed Brown 90bcb2dfaeSJed Brownif your compiler does not support gcc-style options, if you are cross 91bcb2dfaeSJed Browncompiling, etc. 92bcb2dfaeSJed Brown 93bcb2dfaeSJed BrownTo enable CUDA support, add `CUDA_DIR=/opt/cuda` or an appropriate directory 94bcb2dfaeSJed Brownto your `make` invocation. To enable HIP support, add `HIP_DIR=/opt/rocm` or 95bcb2dfaeSJed Brownan appropriate directory. To store these or other arguments as defaults for 96bcb2dfaeSJed Brownfuture invocations of `make`, use: 97bcb2dfaeSJed Brown 98bcb2dfaeSJed Brown``` 99bcb2dfaeSJed Brownmake configure CUDA_DIR=/usr/local/cuda HIP_DIR=/opt/rocm OPT='-O3 -march=znver2' 100bcb2dfaeSJed Brown``` 101bcb2dfaeSJed Brown 102bcb2dfaeSJed Brownwhich stores these variables in `config.mk`. 103bcb2dfaeSJed Brown 104bcb2dfaeSJed Brown## Additional Language Interfaces 105bcb2dfaeSJed Brown 106bcb2dfaeSJed BrownThe Fortran interface is built alongside the library automatically. 107bcb2dfaeSJed Brown 108bcb2dfaeSJed BrownPython users can install using: 109bcb2dfaeSJed Brown 110bcb2dfaeSJed Brown``` 111bcb2dfaeSJed Brownpip install libceed 112bcb2dfaeSJed Brown``` 113bcb2dfaeSJed Brown 114bcb2dfaeSJed Brownor in a clone of the repository via `pip install .`. 115bcb2dfaeSJed Brown 116bcb2dfaeSJed BrownJulia users can install using: 117bcb2dfaeSJed Brown 118bcb2dfaeSJed Brown``` 119bcb2dfaeSJed Brown$ julia 120bcb2dfaeSJed Brownjulia> ] 121bcb2dfaeSJed Brownpkg> add LibCEED 122bcb2dfaeSJed Brown``` 123bcb2dfaeSJed Brown 124186a1480SWill PaznerSee the [LibCEED.jl documentation](http://ceed.exascaleproject.org/libCEED-julia-docs/dev/) 125186a1480SWill Paznerfor more information. 126bcb2dfaeSJed Brown 127bcb2dfaeSJed BrownRust users can include libCEED via `Cargo.toml`: 128bcb2dfaeSJed Brown 129bcb2dfaeSJed Brown```toml 130bcb2dfaeSJed Brown[dependencies] 131bcb2dfaeSJed Brownlibceed = { git = "https://github.com/CEED/libCEED", branch = "main" } 132bcb2dfaeSJed Brown``` 133bcb2dfaeSJed Brown 134bcb2dfaeSJed BrownSee the [Cargo documentation](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#specifying-dependencies-from-git-repositories) for details. 135bcb2dfaeSJed Brown 136bcb2dfaeSJed Brown## Testing 137bcb2dfaeSJed Brown 138bcb2dfaeSJed BrownThe test suite produces [TAP](https://testanything.org) output and is run by: 139bcb2dfaeSJed Brown 140bcb2dfaeSJed Brown``` 141bcb2dfaeSJed Brownmake test 142bcb2dfaeSJed Brown``` 143bcb2dfaeSJed Brown 144bcb2dfaeSJed Brownor, using the `prove` tool distributed with Perl (recommended): 145bcb2dfaeSJed Brown 146bcb2dfaeSJed Brown``` 147bcb2dfaeSJed Brownmake prove 148bcb2dfaeSJed Brown``` 149bcb2dfaeSJed Brown 150bcb2dfaeSJed Brown## Backends 151bcb2dfaeSJed Brown 152bcb2dfaeSJed BrownThere are multiple supported backends, which can be selected at runtime in the examples: 153bcb2dfaeSJed Brown 154bcb2dfaeSJed Brown| CEED resource | Backend | Deterministic Capable | 155d3fde3fbSJed Brown| :--- | :--- | :---: | 156d3fde3fbSJed Brown|| 157d3fde3fbSJed Brown| **CPU Native** | 158d3fde3fbSJed Brown| `/cpu/self/ref/serial` | Serial reference implementation | Yes | 159d3fde3fbSJed Brown| `/cpu/self/ref/blocked` | Blocked reference implementation | Yes | 160d3fde3fbSJed Brown| `/cpu/self/opt/serial` | Serial optimized C implementation | Yes | 161d3fde3fbSJed Brown| `/cpu/self/opt/blocked` | Blocked optimized C implementation | Yes | 162d3fde3fbSJed Brown| `/cpu/self/avx/serial` | Serial AVX implementation | Yes | 163d3fde3fbSJed Brown| `/cpu/self/avx/blocked` | Blocked AVX implementation | Yes | 164d3fde3fbSJed Brown|| 165d3fde3fbSJed Brown| **CPU Valgrind** | 166d3fde3fbSJed Brown| `/cpu/self/memcheck/*` | Memcheck backends, undefined value checks | Yes | 167d3fde3fbSJed Brown|| 168d3fde3fbSJed Brown| **CPU LIBXSMM** | 169d3fde3fbSJed Brown| `/cpu/self/xsmm/serial` | Serial LIBXSMM implementation | Yes | 170d3fde3fbSJed Brown| `/cpu/self/xsmm/blocked` | Blocked LIBXSMM implementation | Yes | 171d3fde3fbSJed Brown|| 172d3fde3fbSJed Brown| **CUDA Native** | 173d3fde3fbSJed Brown| `/gpu/cuda/ref` | Reference pure CUDA kernels | Yes | 174d3fde3fbSJed Brown| `/gpu/cuda/shared` | Optimized pure CUDA kernels using shared memory | Yes | 175d3fde3fbSJed Brown| `/gpu/cuda/gen` | Optimized pure CUDA kernels using code generation | No | 176d3fde3fbSJed Brown|| 177d3fde3fbSJed Brown| **HIP Native** | 178d3fde3fbSJed Brown| `/gpu/hip/ref` | Reference pure HIP kernels | Yes | 179d3fde3fbSJed Brown| `/gpu/hip/shared` | Optimized pure HIP kernels using shared memory | Yes | 180d3fde3fbSJed Brown| `/gpu/hip/gen` | Optimized pure HIP kernels using code generation | No | 181d3fde3fbSJed Brown|| 182d3fde3fbSJed Brown| **MAGMA** | 183d3fde3fbSJed Brown| `/gpu/cuda/magma` | CUDA MAGMA kernels | No | 184d3fde3fbSJed Brown| `/gpu/cuda/magma/det` | CUDA MAGMA kernels | Yes | 185d3fde3fbSJed Brown| `/gpu/hip/magma` | HIP MAGMA kernels | No | 186d3fde3fbSJed Brown| `/gpu/hip/magma/det` | HIP MAGMA kernels | Yes | 187d3fde3fbSJed Brown|| 188d3fde3fbSJed Brown| **OCCA** | 189d3fde3fbSJed Brown| `/*/occa` | Selects backend based on available OCCA modes | Yes | 190d3fde3fbSJed Brown| `/cpu/self/occa` | OCCA backend with serial CPU kernels | Yes | 191d3fde3fbSJed Brown| `/cpu/openmp/occa` | OCCA backend with OpenMP kernels | Yes | 192d3fde3fbSJed Brown| `/gpu/cuda/occa` | OCCA backend with CUDA kernels | Yes | 193d3fde3fbSJed Brown| `/gpu/hip/occa`~ | OCCA backend with HIP kernels | Yes | 194bcb2dfaeSJed Brown 195bcb2dfaeSJed BrownThe `/cpu/self/*/serial` backends process one element at a time and are intended for meshes 196bcb2dfaeSJed Brownwith a smaller number of high order elements. The `/cpu/self/*/blocked` backends process 197bcb2dfaeSJed Brownblocked batches of eight interlaced elements and are intended for meshes with higher numbers 198bcb2dfaeSJed Brownof elements. 199bcb2dfaeSJed Brown 200bcb2dfaeSJed BrownThe `/cpu/self/ref/*` backends are written in pure C and provide basic functionality. 201bcb2dfaeSJed Brown 202bcb2dfaeSJed BrownThe `/cpu/self/opt/*` backends are written in pure C and use partial e-vectors to improve performance. 203bcb2dfaeSJed Brown 204bcb2dfaeSJed BrownThe `/cpu/self/avx/*` backends rely upon AVX instructions to provide vectorized CPU performance. 205bcb2dfaeSJed Brown 206bcb2dfaeSJed BrownThe `/cpu/self/memcheck/*` backends rely upon the [Valgrind](http://valgrind.org/) Memcheck tool 207bcb2dfaeSJed Brownto help verify that user QFunctions have no undefined values. To use, run your code with 208bcb2dfaeSJed BrownValgrind and the Memcheck backends, e.g. `valgrind ./build/ex1 -ceed /cpu/self/ref/memcheck`. A 209bcb2dfaeSJed Brown'development' or 'debugging' version of Valgrind with headers is required to use this backend. 210bcb2dfaeSJed BrownThis backend can be run in serial or blocked mode and defaults to running in the serial mode 211bcb2dfaeSJed Brownif `/cpu/self/memcheck` is selected at runtime. 212bcb2dfaeSJed Brown 213bcb2dfaeSJed BrownThe `/cpu/self/xsmm/*` backends rely upon the [LIBXSMM](http://github.com/hfp/libxsmm) package 214bcb2dfaeSJed Brownto provide vectorized CPU performance. If linking MKL and LIBXSMM is desired but 215bcb2dfaeSJed Brownthe Makefile is not detecting `MKLROOT`, linking libCEED against MKL can be 216bcb2dfaeSJed Brownforced by setting the environment variable `MKL=1`. 217bcb2dfaeSJed Brown 218bcb2dfaeSJed BrownThe `/gpu/cuda/*` backends provide GPU performance strictly using CUDA. 219bcb2dfaeSJed Brown 220bcb2dfaeSJed BrownThe `/gpu/hip/*` backends provide GPU performance strictly using HIP. They are based on 221*f577dd42Snbeamsthe `/gpu/cuda/*` backends. ROCm version 4.2 or newer is required. 222bcb2dfaeSJed Brown 223bcb2dfaeSJed BrownThe `/gpu/*/magma/*` backends rely upon the [MAGMA](https://bitbucket.org/icl/magma) package. 224bcb2dfaeSJed BrownTo enable the MAGMA backends, the environment variable `MAGMA_DIR` must point to the top-level 225bcb2dfaeSJed BrownMAGMA directory, with the MAGMA library located in `$(MAGMA_DIR)/lib/`. 226bcb2dfaeSJed BrownBy default, `MAGMA_DIR` is set to `../magma`; to build the MAGMA backends 227bcb2dfaeSJed Brownwith a MAGMA installation located elsewhere, create a link to `magma/` in libCEED's parent 228bcb2dfaeSJed Browndirectory, or set `MAGMA_DIR` to the proper location. MAGMA version 2.5.0 or newer is required. 229bcb2dfaeSJed BrownCurrently, each MAGMA library installation is only built for either CUDA or HIP. The corresponding 230bcb2dfaeSJed Brownset of libCEED backends (`/gpu/cuda/magma/*` or `/gpu/hip/magma/*`) will automatically be built 231bcb2dfaeSJed Brownfor the version of the MAGMA library found in `MAGMA_DIR`. 232bcb2dfaeSJed Brown 233bcb2dfaeSJed BrownUsers can specify a device for all CUDA, HIP, and MAGMA backends through adding `:device_id=#` 234bcb2dfaeSJed Brownafter the resource name. For example: 235bcb2dfaeSJed Brown 236bcb2dfaeSJed Brown> - `/gpu/cuda/gen:device_id=1` 237bcb2dfaeSJed Brown 238bcb2dfaeSJed BrownThe `/*/occa` backends rely upon the [OCCA](http://github.com/libocca/occa) package to provide 239bcb2dfaeSJed Browncross platform performance. To enable the OCCA backend, the environment variable `OCCA_DIR` must point 240bcb2dfaeSJed Brownto the top-level OCCA directory, with the OCCA library located in the `${OCCA_DIR}/lib` (By default, 241bcb2dfaeSJed Brown`OCCA_DIR` is set to `../occa`). 242bcb2dfaeSJed Brown 243bcb2dfaeSJed BrownAdditionally, users can pass specific OCCA device properties after setting the CEED resource. 244bcb2dfaeSJed BrownFor example: 245bcb2dfaeSJed Brown 246bcb2dfaeSJed Brown> - `"/*/occa:mode='CUDA',device_id=0"` 247bcb2dfaeSJed Brown 248bcb2dfaeSJed BrownBit-for-bit reproducibility is important in some applications. 249bcb2dfaeSJed BrownHowever, some libCEED backends use non-deterministic operations, such as `atomicAdd` for increased performance. 250bcb2dfaeSJed BrownThe backends which are capable of generating reproducible results, with the proper compilation options, are highlighted in the list above. 251bcb2dfaeSJed Brown 252bcb2dfaeSJed Brown## Examples 253bcb2dfaeSJed Brown 254bcb2dfaeSJed BrownlibCEED comes with several examples of its usage, ranging from standalone C 255bcb2dfaeSJed Browncodes in the `/examples/ceed` directory to examples based on external packages, 256bcb2dfaeSJed Brownsuch as MFEM, PETSc, and Nek5000. Nek5000 v18.0 or greater is required. 257bcb2dfaeSJed Brown 258bcb2dfaeSJed BrownTo build the examples, set the `MFEM_DIR`, `PETSC_DIR`, and 259bcb2dfaeSJed Brown`NEK5K_DIR` variables and run: 260bcb2dfaeSJed Brown 261bcb2dfaeSJed Brown``` 262bcb2dfaeSJed Browncd examples/ 263bcb2dfaeSJed Brown``` 264bcb2dfaeSJed Brown 265bcb2dfaeSJed Brown% running-examples-inclusion-marker 266bcb2dfaeSJed Brown 267bcb2dfaeSJed Brown```console 268bcb2dfaeSJed Brown# libCEED examples on CPU and GPU 269bcb2dfaeSJed Browncd ceed/ 270bcb2dfaeSJed Brownmake 271bcb2dfaeSJed Brown./ex1-volume -ceed /cpu/self 272bcb2dfaeSJed Brown./ex1-volume -ceed /gpu/cuda 273bcb2dfaeSJed Brown./ex2-surface -ceed /cpu/self 274bcb2dfaeSJed Brown./ex2-surface -ceed /gpu/cuda 275bcb2dfaeSJed Browncd .. 276bcb2dfaeSJed Brown 277bcb2dfaeSJed Brown# MFEM+libCEED examples on CPU and GPU 278bcb2dfaeSJed Browncd mfem/ 279bcb2dfaeSJed Brownmake 280bcb2dfaeSJed Brown./bp1 -ceed /cpu/self -no-vis 281bcb2dfaeSJed Brown./bp3 -ceed /gpu/cuda -no-vis 282bcb2dfaeSJed Browncd .. 283bcb2dfaeSJed Brown 284bcb2dfaeSJed Brown# Nek5000+libCEED examples on CPU and GPU 285bcb2dfaeSJed Browncd nek/ 286bcb2dfaeSJed Brownmake 287bcb2dfaeSJed Brown./nek-examples.sh -e bp1 -ceed /cpu/self -b 3 288bcb2dfaeSJed Brown./nek-examples.sh -e bp3 -ceed /gpu/cuda -b 3 289bcb2dfaeSJed Browncd .. 290bcb2dfaeSJed Brown 291bcb2dfaeSJed Brown# PETSc+libCEED examples on CPU and GPU 292bcb2dfaeSJed Browncd petsc/ 293bcb2dfaeSJed Brownmake 294bcb2dfaeSJed Brown./bps -problem bp1 -ceed /cpu/self 295bcb2dfaeSJed Brown./bps -problem bp2 -ceed /gpu/cuda 296bcb2dfaeSJed Brown./bps -problem bp3 -ceed /cpu/self 297bcb2dfaeSJed Brown./bps -problem bp4 -ceed /gpu/cuda 298bcb2dfaeSJed Brown./bps -problem bp5 -ceed /cpu/self 299bcb2dfaeSJed Brown./bps -problem bp6 -ceed /gpu/cuda 300bcb2dfaeSJed Browncd .. 301bcb2dfaeSJed Brown 302bcb2dfaeSJed Browncd petsc/ 303bcb2dfaeSJed Brownmake 304bcb2dfaeSJed Brown./bpsraw -problem bp1 -ceed /cpu/self 305bcb2dfaeSJed Brown./bpsraw -problem bp2 -ceed /gpu/cuda 306bcb2dfaeSJed Brown./bpsraw -problem bp3 -ceed /cpu/self 307bcb2dfaeSJed Brown./bpsraw -problem bp4 -ceed /gpu/cuda 308bcb2dfaeSJed Brown./bpsraw -problem bp5 -ceed /cpu/self 309bcb2dfaeSJed Brown./bpsraw -problem bp6 -ceed /gpu/cuda 310bcb2dfaeSJed Browncd .. 311bcb2dfaeSJed Brown 312bcb2dfaeSJed Browncd petsc/ 313bcb2dfaeSJed Brownmake 314bcb2dfaeSJed Brown./bpssphere -problem bp1 -ceed /cpu/self 315bcb2dfaeSJed Brown./bpssphere -problem bp2 -ceed /gpu/cuda 316bcb2dfaeSJed Brown./bpssphere -problem bp3 -ceed /cpu/self 317bcb2dfaeSJed Brown./bpssphere -problem bp4 -ceed /gpu/cuda 318bcb2dfaeSJed Brown./bpssphere -problem bp5 -ceed /cpu/self 319bcb2dfaeSJed Brown./bpssphere -problem bp6 -ceed /gpu/cuda 320bcb2dfaeSJed Browncd .. 321bcb2dfaeSJed Brown 322bcb2dfaeSJed Browncd petsc/ 323bcb2dfaeSJed Brownmake 324bcb2dfaeSJed Brown./area -problem cube -ceed /cpu/self -degree 3 325bcb2dfaeSJed Brown./area -problem cube -ceed /gpu/cuda -degree 3 326bcb2dfaeSJed Brown./area -problem sphere -ceed /cpu/self -degree 3 -dm_refine 2 327bcb2dfaeSJed Brown./area -problem sphere -ceed /gpu/cuda -degree 3 -dm_refine 2 328bcb2dfaeSJed Brown 329bcb2dfaeSJed Browncd fluids/ 330bcb2dfaeSJed Brownmake 331bcb2dfaeSJed Brown./navierstokes -ceed /cpu/self -degree 1 332bcb2dfaeSJed Brown./navierstokes -ceed /gpu/cuda -degree 1 333bcb2dfaeSJed Browncd .. 334bcb2dfaeSJed Brown 335bcb2dfaeSJed Browncd solids/ 336bcb2dfaeSJed Brownmake 337bcb2dfaeSJed Brown./elasticity -ceed /cpu/self -mesh [.exo file] -degree 2 -E 1 -nu 0.3 -problem Linear -forcing mms 338bcb2dfaeSJed Brown./elasticity -ceed /gpu/cuda -mesh [.exo file] -degree 2 -E 1 -nu 0.3 -problem Linear -forcing mms 339bcb2dfaeSJed Browncd .. 340bcb2dfaeSJed Brown``` 341bcb2dfaeSJed Brown 342bcb2dfaeSJed BrownFor the last example shown, sample meshes to be used in place of 343bcb2dfaeSJed Brown`[.exo file]` can be found at <https://github.com/jeremylt/ceedSampleMeshes> 344bcb2dfaeSJed Brown 345bcb2dfaeSJed BrownThe above code assumes a GPU-capable machine with the OCCA backend 346bcb2dfaeSJed Brownenabled. Depending on the available backends, other CEED resource 347bcb2dfaeSJed Brownspecifiers can be provided with the `-ceed` option. Other command line 348bcb2dfaeSJed Brownarguments can be found in [examples/petsc](https://github.com/CEED/libCEED/blob/main/examples/petsc/README.md). 349bcb2dfaeSJed Brown 350bcb2dfaeSJed Brown% benchmarks-marker 351bcb2dfaeSJed Brown 352bcb2dfaeSJed Brown## Benchmarks 353bcb2dfaeSJed Brown 354bcb2dfaeSJed BrownA sequence of benchmarks for all enabled backends can be run using: 355bcb2dfaeSJed Brown 356bcb2dfaeSJed Brown``` 357bcb2dfaeSJed Brownmake benchmarks 358bcb2dfaeSJed Brown``` 359bcb2dfaeSJed Brown 360bcb2dfaeSJed BrownThe results from the benchmarks are stored inside the `benchmarks/` directory 361bcb2dfaeSJed Brownand they can be viewed using the commands (requires python with matplotlib): 362bcb2dfaeSJed Brown 363bcb2dfaeSJed Brown``` 364bcb2dfaeSJed Browncd benchmarks 365bcb2dfaeSJed Brownpython postprocess-plot.py petsc-bps-bp1-*-output.txt 366bcb2dfaeSJed Brownpython postprocess-plot.py petsc-bps-bp3-*-output.txt 367bcb2dfaeSJed Brown``` 368bcb2dfaeSJed Brown 369bcb2dfaeSJed BrownUsing the `benchmarks` target runs a comprehensive set of benchmarks which may 370bcb2dfaeSJed Browntake some time to run. Subsets of the benchmarks can be run using the scripts in the `benchmarks` folder. 371bcb2dfaeSJed Brown 372bcb2dfaeSJed BrownFor more details about the benchmarks, see the `benchmarks/README.md` file. 373bcb2dfaeSJed Brown 374bcb2dfaeSJed Brown## Install 375bcb2dfaeSJed Brown 376bcb2dfaeSJed BrownTo install libCEED, run: 377bcb2dfaeSJed Brown 378bcb2dfaeSJed Brown``` 379bcb2dfaeSJed Brownmake install prefix=/usr/local 380bcb2dfaeSJed Brown``` 381bcb2dfaeSJed Brown 382bcb2dfaeSJed Brownor (e.g., if creating packages): 383bcb2dfaeSJed Brown 384bcb2dfaeSJed Brown``` 385bcb2dfaeSJed Brownmake install prefix=/usr DESTDIR=/packaging/path 386bcb2dfaeSJed Brown``` 387bcb2dfaeSJed Brown 388bcb2dfaeSJed BrownThe usual variables like `CC` and `CFLAGS` are used, and optimization flags 389bcb2dfaeSJed Brownfor all languages can be set using the likes of `OPT='-O3 -march=native'`. Use 390bcb2dfaeSJed Brown`STATIC=1` to build static libraries (`libceed.a`). 391bcb2dfaeSJed Brown 392bcb2dfaeSJed BrownTo install libCEED for Python, run: 393bcb2dfaeSJed Brown 394bcb2dfaeSJed Brown``` 395bcb2dfaeSJed Brownpip install libceed 396bcb2dfaeSJed Brown``` 397bcb2dfaeSJed Brown 398bcb2dfaeSJed Brownwith the desired setuptools options, such as `--user`. 399bcb2dfaeSJed Brown 400bcb2dfaeSJed Brown### pkg-config 401bcb2dfaeSJed Brown 402bcb2dfaeSJed BrownIn addition to library and header, libCEED provides a [pkg-config](https://en.wikipedia.org/wiki/Pkg-config) 403bcb2dfaeSJed Brownfile that can be used to easily compile and link. 404bcb2dfaeSJed Brown[For example](https://people.freedesktop.org/~dbn/pkg-config-guide.html#faq), if 405bcb2dfaeSJed Brown`$prefix` is a standard location or you set the environment variable 406bcb2dfaeSJed Brown`PKG_CONFIG_PATH`: 407bcb2dfaeSJed Brown 408bcb2dfaeSJed Brown``` 409bcb2dfaeSJed Browncc `pkg-config --cflags --libs ceed` -o myapp myapp.c 410bcb2dfaeSJed Brown``` 411bcb2dfaeSJed Brown 412bcb2dfaeSJed Brownwill build `myapp` with libCEED. This can be used with the source or 413bcb2dfaeSJed Browninstalled directories. Most build systems have support for pkg-config. 414bcb2dfaeSJed Brown 415bcb2dfaeSJed Brown## Contact 416bcb2dfaeSJed Brown 417bcb2dfaeSJed BrownYou can reach the libCEED team by emailing [ceed-users@llnl.gov](mailto:ceed-users@llnl.gov) 418bcb2dfaeSJed Brownor by leaving a comment in the [issue tracker](https://github.com/CEED/libCEED/issues). 419bcb2dfaeSJed Brown 420bcb2dfaeSJed Brown## How to Cite 421bcb2dfaeSJed Brown 422bcb2dfaeSJed BrownIf you utilize libCEED please cite: 423bcb2dfaeSJed Brown 424bcb2dfaeSJed Brown``` 425bcb2dfaeSJed Brown@article{libceed-joss-paper, 426bcb2dfaeSJed Brown author = {Jed Brown and Ahmad Abdelfattah and Valeria Barra and Natalie Beams and Jean Sylvain Camier and Veselin Dobrev and Yohann Dudouit and Leila Ghaffari and Tzanio Kolev and David Medina and Will Pazner and Thilina Ratnayaka and Jeremy Thompson and Stan Tomov}, 427bcb2dfaeSJed Brown title = {{libCEED}: Fast algebra for high-order element-based discretizations}, 428bcb2dfaeSJed Brown journal = {Journal of Open Source Software}, 429bcb2dfaeSJed Brown year = {2021}, 430bcb2dfaeSJed Brown publisher = {The Open Journal}, 431bcb2dfaeSJed Brown volume = {6}, 432bcb2dfaeSJed Brown number = {63}, 433bcb2dfaeSJed Brown pages = {2945}, 434bcb2dfaeSJed Brown doi = {10.21105/joss.02945} 435bcb2dfaeSJed Brown} 436bcb2dfaeSJed Brown 437bcb2dfaeSJed Brown@misc{libceed-user-manual, 438bcb2dfaeSJed Brown author = {Abdelfattah, Ahmad and 439bcb2dfaeSJed Brown Barra, Valeria and 440bcb2dfaeSJed Brown Beams, Natalie and 441bcb2dfaeSJed Brown Brown, Jed and 442bcb2dfaeSJed Brown Camier, Jean-Sylvain and 443bcb2dfaeSJed Brown Dobrev, Veselin and 444bcb2dfaeSJed Brown Dudouit, Yohann and 445bcb2dfaeSJed Brown Ghaffari, Leila and 446bcb2dfaeSJed Brown Kolev, Tzanio and 447bcb2dfaeSJed Brown Medina, David and 448bcb2dfaeSJed Brown Pazner, Will and 449bcb2dfaeSJed Brown Ratnayaka, Thilina and 450bcb2dfaeSJed Brown Thompson, Jeremy L and 451bcb2dfaeSJed Brown Tomov, Stanimire}, 452bcb2dfaeSJed Brown title = {{libCEED} User Manual}, 453bcb2dfaeSJed Brown month = jul, 454bcb2dfaeSJed Brown year = 2021, 455bcb2dfaeSJed Brown publisher = {Zenodo}, 456bcb2dfaeSJed Brown version = {0.9.0}, 457bcb2dfaeSJed Brown doi = {10.5281/zenodo.5077489} 458bcb2dfaeSJed Brown} 459bcb2dfaeSJed Brown``` 460bcb2dfaeSJed Brown 461bcb2dfaeSJed BrownFor libCEED's Python interface please cite: 462bcb2dfaeSJed Brown 463bcb2dfaeSJed Brown``` 464bcb2dfaeSJed Brown@InProceedings{libceed-paper-proc-scipy-2020, 465bcb2dfaeSJed Brown author = {{V}aleria {B}arra and {J}ed {B}rown and {J}eremy {T}hompson and {Y}ohann {D}udouit}, 466bcb2dfaeSJed Brown title = {{H}igh-performance operator evaluations with ease of use: lib{C}{E}{E}{D}'s {P}ython interface}, 467bcb2dfaeSJed Brown booktitle = {{P}roceedings of the 19th {P}ython in {S}cience {C}onference}, 468bcb2dfaeSJed Brown pages = {85 - 90}, 469bcb2dfaeSJed Brown year = {2020}, 470bcb2dfaeSJed Brown editor = {{M}eghann {A}garwal and {C}hris {C}alloway and {D}illon {N}iederhut and {D}avid {S}hupe}, 471bcb2dfaeSJed Brown doi = {10.25080/Majora-342d178e-00c} 472bcb2dfaeSJed Brown} 473bcb2dfaeSJed Brown``` 474bcb2dfaeSJed Brown 475bcb2dfaeSJed BrownThe BiBTeX entries for these references can be found in the 476bcb2dfaeSJed Brown`doc/bib/references.bib` file. 477bcb2dfaeSJed Brown 478bcb2dfaeSJed Brown## Copyright 479bcb2dfaeSJed Brown 480bcb2dfaeSJed BrownThe following copyright applies to each file in the CEED software suite, unless 481bcb2dfaeSJed Brownotherwise stated in the file: 482bcb2dfaeSJed Brown 483bcb2dfaeSJed Brown> Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at the 484bcb2dfaeSJed Brown> Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights reserved. 485bcb2dfaeSJed Brown 486bcb2dfaeSJed BrownSee files LICENSE and NOTICE for details. 487d3fde3fbSJed Brown 488d3fde3fbSJed Brown[github-badge]: https://github.com/CEED/libCEED/workflows/C/Fortran/badge.svg 489d3fde3fbSJed Brown[github-link]: https://github.com/CEED/libCEED/actions 490d3fde3fbSJed Brown[gitlab-badge]: https://gitlab.com/libceed/libCEED/badges/main/pipeline.svg?key_text=GitLab-CI 491d3fde3fbSJed Brown[gitlab-link]: https://gitlab.com/libceed/libCEED/-/pipelines?page=1&scope=all&ref=main 492d3fde3fbSJed Brown[azure-badge]: https://dev.azure.com/CEED-ECP/libCEED/_apis/build/status/CEED.libCEED?branchName=main 493d3fde3fbSJed Brown[azure-link]: https://dev.azure.com/CEED-ECP/libCEED/_build?definitionId=2 494d3fde3fbSJed Brown[codecov-badge]: https://codecov.io/gh/CEED/libCEED/branch/main/graphs/badge.svg 495d3fde3fbSJed Brown[codecov-link]: https://codecov.io/gh/CEED/libCEED/ 496d3fde3fbSJed Brown[license-badge]: https://img.shields.io/badge/License-BSD%202--Clause-orange.svg 497d3fde3fbSJed Brown[license-link]: https://opensource.org/licenses/BSD-2-Clause 498d3fde3fbSJed Brown[doc-badge]: https://readthedocs.org/projects/libceed/badge/?version=latest 499d3fde3fbSJed Brown[doc-link]: https://libceed.readthedocs.io/en/latest/?badge=latest 500d3fde3fbSJed Brown[joss-badge]: https://joss.theoj.org/papers/10.21105/joss.02945/status.svg 501d3fde3fbSJed Brown[joss-link]: https://doi.org/10.21105/joss.02945 502d3fde3fbSJed Brown[binder-badge]: http://mybinder.org/badge_logo.svg 5031bd2483cSJeremy L Thompson[binder-link]: https://mybinder.org/v2/gh/CEED/libCEED/main?urlpath=lab/tree/examples/python/tutorial-0-ceed.ipynb 504