Reference documentation for deal.II version 9.0.0
|
#include <deal.II/base/vectorization.h>
Public Member Functions | |
VectorizedArray & | operator= (const double x) |
double & | operator[] (const unsigned int comp) |
const double & | operator[] (const unsigned int comp) const |
VectorizedArray & | operator+= (const VectorizedArray &vec) |
VectorizedArray & | operator-= (const VectorizedArray &vec) |
VectorizedArray & | operator*= (const VectorizedArray &vec) |
VectorizedArray & | operator/= (const VectorizedArray &vec) |
void | load (const double *ptr) |
void | store (double *ptr) const |
void | streaming_store (double *ptr) const |
void | gather (const double *base_ptr, const unsigned int *offsets) |
void | scatter (const unsigned int *offsets, double *base_ptr) const |
Public Attributes | |
__m128d | data |
Static Public Attributes | |
static const unsigned int | n_array_elements = 2 |
Private Member Functions | |
VectorizedArray | get_sqrt () const |
VectorizedArray | get_abs () const |
VectorizedArray | get_max (const VectorizedArray &other) const |
VectorizedArray | get_min (const VectorizedArray &other) const |
Friends | |
template<typename Number2 > | |
VectorizedArray< Number2 > | std::sqrt (const VectorizedArray< Number2 > &) |
Specialization for double and SSE2.
Definition at line 2141 of file vectorization.h.
|
inline |
This function can be used to set all data fields to a given scalar.
Definition at line 2154 of file vectorization.h.
|
inline |
Access operator.
Definition at line 2165 of file vectorization.h.
|
inline |
Constant access operator.
Definition at line 2176 of file vectorization.h.
|
inline |
Addition.
Definition at line 2187 of file vectorization.h.
|
inline |
Subtraction.
Definition at line 2202 of file vectorization.h.
|
inline |
Multiplication.
Definition at line 2217 of file vectorization.h.
|
inline |
Division.
Definition at line 2232 of file vectorization.h.
|
inline |
Load n_array_elements
from memory into the calling class, starting at the given address. The memory need not be aligned by 16 bytes, as opposed to casting a double address to VectorizedArray<double>*.
Definition at line 2248 of file vectorization.h.
|
inline |
Write the content of the calling class into memory in form of n_array_elements
to the given address. The memory need not be aligned by 16 bytes, as opposed to casting a double address to VectorizedArray<double>*.
Definition at line 2260 of file vectorization.h.
|
inline |
Write the content of the calling class into memory in form of n_array_elements
to the given address using non-temporal stores that bypass the processor's caches, using _mm_stream_pd
store intrinsics on supported CPUs. The destination of the store ptr
must be aligned by the amount of bytes in the vectorized array.
This store operation can be faster than usual store operations in case the store is streaming because it avoids the read-for-ownership transfer typically invoked in standard stores. This approximately works as follows (see the literature on computer architecture for details): When an algorithm stores some results to a memory address, a processor typically wants to move it into some of its caches as it expects the data to be re-used again at some point. Since caches are organized in lines of sizes either 64 byte or 128 byte but writes are usually smaller, a processor must first load in the destination cache line upon a write because only part of the cache line is overwritten initially. If a series of stores write data in a chunk bigger than any of its caches could handle, the data finally has to be moved out from the caches to main memory. But since all addressed have first been read, this doubles the load on main memory, which can incur a performance penalty. Furthermore, the organization of caches in a multicore context also requires reading an address before something can be written to cache to that address, see e.g. the Wikipedia article on the MESI protocol for details. The instruction underlying this function call signals to the processor that these two prerequisites on a store are relaxed: Firstly, one expects the whole cache line to be overwritten (that the memory subsystem then handles appropriately), so no need to first read the "remainder" of the cache line. Secondly, the data behind that particular memory will not be subject to cache coherency protocol as it will be in main memory both when the same processor wants to access it again as well as any other processors in a multicore chip. Due to this particular setup, any subsequent access to the data written by this function will need to query main memory, which is slower than an access from a cache both latency-wise and throughput-wise. Thus, this command should only be used for large stores that will collectively not fit into caches, as performance will be degraded otherwise. For a typical use case, see also this blog article.
Note that streaming stores are only available in the specialized SSE/AVX classes of VectorizedArray of type double
or float
, not in the generic base class.
Definition at line 2269 of file vectorization.h.
|
inline |
Load n_array_elements
from memory into the calling class, starting at the given address and with given offsets, each entry from the offset providing one element of the vectorized array.
This operation corresponds to the following code (but uses a more efficient implementation in case the hardware allows for that):
Definition at line 2288 of file vectorization.h.
|
inline |
Write the content of the calling class into memory in form of n_array_elements
to the given address and the given offsets, filling the elements of the vectorized array into each offset.
This operation corresponds to the following code (but uses a more efficient implementation in case the hardware allows for that):
Definition at line 2308 of file vectorization.h.
|
inlineprivate |
Return the square root of this field. Not for use in user code. Use sqrt(x) instead.
Definition at line 2328 of file vectorization.h.
|
inlineprivate |
Return the absolute value of this field. Not for use in user code. Use abs(x) instead.
Definition at line 2341 of file vectorization.h.
|
inlineprivate |
Return the component-wise maximum of this field and another one. Not for use in user code. Use max(x,y) instead.
Definition at line 2359 of file vectorization.h.
|
inlineprivate |
Return the component-wise minimum of this field and another one. Not for use in user code. Use min(x,y) instead.
Definition at line 2372 of file vectorization.h.
|
friend |
Make a few functions friends.
|
static |
This gives the number of vectors collected in this class.
Definition at line 2147 of file vectorization.h.
__m128d VectorizedArray< double >::data |
Actual data field. Since this class represents a POD data type, it remains public.
Definition at line 2319 of file vectorization.h.