GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||
GeezerVison is showing correaa.github.io — Boost.Multi :: Boost.Multi Boost.MultiIntroductionMulti is a modern C++ library that provides manipulation and access of data in multidimensional arrays for both CPU and GPU memory.
Multidimensional array data structures are essential in various fields of computing, including data analysis, image processing, and scientific simulations. When combined with GPUs, they also play a significant role in Artificial Intelligence and Machine Learning. Here are 3 examples of arrays of different dimensionalities:
Note that the depicted 3D case has two "planes", the first index selects a plane (plane These depicted 1D, 2D, and 3D arrays contain single characters and can be defined as C++ objects in this library:
and their elements, when retrieved by their coordinates (indices) are such that, for example:
A subarray of a larger array, such as a row, is a reference into the original data. Arrays and subarrays are usable with standard algorithms, while whole-array assignment makes an independent copy (value semantics):
The library features logical access recursively across dimensions and to elements through indices and iterators. The internal data structure layout, when mapped to computer memory, is stride-based, which makes it compatible with low-level C libraries. The library interface is designed to be compatible with standard algorithms and ranges (STL) and special memory (including GPUs) and follows modern C++ design principles. What is MultiThe library offers the following combination of features (some of which are not present in the Standard or generally in other libraries):
What Multi is notThe library’s primary concern is with the storage and logic structure of data. It doesn’t make specific algebraic or geometric assumptions about the arrays and their elements, although they are still good building blocks for implementing mathematical and numerical algorithms on top of them, such as representing algebraic dense matrices in the 2D case, or tensors in the general case. Do not confuse this library with
Boost.MultiArray
or with the standard The Standard also provides no owning, allocator-aware container for special memory spaces (GPU, managed memory, fancy pointers) nor lazy array-expression evaluation; ownership is delegated to a future The library does not throw exceptions and provides basic exception guarantees, such as no memory leaks, in their presence. Exceptions are propagated transparently from allocations or element construction. Indexing, e.g. out-of-bounds errors, and other logical errors result in undefined behavior, which this library attempts to reflect via assertions. The main driver for this design is performance. Therefore the library is does minimal automatic memory management, not lazy copying, reference counting or garbage collection. The user is expected to know the fundamental about object lifetimes, initialization, memory access and thread-safety in their corresponding contexts. More about Use CasesMultidimensional arrays appear everywhere in practice. The state of a game can be represented by placing pieces in a board made of squares that resembles an array. Arrays can also be used to represent numerical matrices, vectors, and, more generally, tensors, to perform linear algebra operations. They can represent other abstract data structures, such as networks, graph connections, or store data in multiple columns. Arrays are amenable to efficient bulk processing, slicing, and reductions. In many simulations, space is divided into a grid, and values are stored at each grid cell. For example, arrays can represent fields of physical values, such as temperature variations within a block of material, or the velocity field of a fluid. A digital photograph is a two-dimensional grid of pixels, or three-dimensional once color channels are included (height × width × channel), and a video adds a further time axis. Spreadsheets and database extracts are two-dimensional tables of rows and columns, while machine-learning workloads continuously move large tensors (of shape batch × channel × height × width) between CPU and GPU. Audio spectrograms, medical CT and MRI scans that sample a volume, and climate models spanning latitude, longitude, altitude, and time are all naturally expressed as arrays of three or more dimensions. In each case the data is logically a single object addressed by several coordinates, which is precisely what a multidimensional array represents. The common geometric interpretation is that a multidimensional array, In the author’s own field of condensed matter physics and chemistry, the quantum states of individual electrons are discretized on a regular 3-dimensional grid of complex numbers. Many quantities of interest are obtained by summing functions evaluated over these elements. Gradients are computed with stencils or via fast Fourier transforms. These 3-dimensional objects can themselves be regarded as vectors in a linear space, and the operators acting on that space are in turn matrices with a 2-dimensional array representation. Typically, at the lowest level, data is processed in bulk by specially tuned numerical CPU or GPU libraries that expect data in the layouts supported by this library. Next Steps
RequirementsMulti is a header-only library and C++17 or later is required. The code requires any modern C++ compiler (or CUDA compiler) with standard C++17 support; for reference, (at least) any of: LLVM’s clang (5.0+) (libc++ and libstdc++), GNU’s g++ (7.1+), Nvidia’s nvcc (11.5+) and nvc++ (22.7+), Intel’s icpx (2022.0.0+) and icc (2021.1.2+, deprecated), Baxter’s circle (build 202+), Zig in c++ mode (v0.9.0+), Edison Design’s EDG (6.5+), Microsoft’s MSVC (+14.1), and Emscripten’s emcc 6. Multi code inside a CUDA kernel can be compiled with | ||
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |