All Projects → VcDevel → Vc

VcDevel / Vc

Licence: bsd-3-clause
SIMD Vector Classes for C++

Programming Languages

cpp
1120 projects
cpp11
221 projects
cpp17
186 projects
cpp14
131 projects

Projects that are alternatives of or similar to Vc

Boost.simd
Boost SIMD
Stars: ✭ 238 (-75.84%)
Mutual labels:  parallel-computing, simd, sse, neon, vectorization, portable, avx2, avx512, avx
Simde
Implementations of SIMD instruction sets for systems which don't natively support them.
Stars: ✭ 1,012 (+2.74%)
Mutual labels:  simd, sse, neon, vectorization, avx2, avx512, avx
Quadray Engine
Realtime raytracer using SIMD on ARM, MIPS, PPC and x86
Stars: ✭ 13 (-98.68%)
Mutual labels:  simd, sse, neon, avx2, avx512, avx
Simd
C++ image processing and machine learning library with using of SIMD: SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX-512, VMX(Altivec) and VSX(Power7), NEON for ARM.
Stars: ✭ 1,263 (+28.22%)
Mutual labels:  simd, sse, neon, avx2, avx512, avx
Umesimd
UME::SIMD A library for explicit simd vectorization.
Stars: ✭ 66 (-93.3%)
Mutual labels:  simd, neon, vectorization, avx2, avx512, avx
Xsimd
C++ wrappers for SIMD intrinsics and parallelized, optimized mathematical functions (SSE, AVX, NEON, AVX512)
Stars: ✭ 964 (-2.13%)
Mutual labels:  simd, sse, neon, vectorization, avx512, avx
Unisimd Assembler
SIMD macro assembler unified for ARM, MIPS, PPC and x86
Stars: ✭ 63 (-93.6%)
Mutual labels:  simd, sse, neon, avx2, avx512, avx
Libxsmm
Library for specialized dense and sparse matrix operations, and deep learning primitives.
Stars: ✭ 518 (-47.41%)
Mutual labels:  simd, sse, avx2, avx512, avx
Std Simd
std::experimental::simd for GCC [ISO/IEC TS 19570:2018]
Stars: ✭ 275 (-72.08%)
Mutual labels:  simd, sse, neon, avx512, avx
Hybridizer Basic Samples
Examples of C# code compiled to GPU by hybridizer
Stars: ✭ 186 (-81.12%)
Mutual labels:  parallel, vectorization, avx2, avx512, avx
ultra-sort
DSL for SIMD Sorting on AVX2 & AVX512
Stars: ✭ 29 (-97.06%)
Mutual labels:  parallel, simd, avx2, vectorization, avx512
std find simd
std::find simd version
Stars: ✭ 19 (-98.07%)
Mutual labels:  portable, simd, avx2, vectorization, avx512
ternary-logic
Support for ternary logic in SSE, XOP, AVX2 and x86 programs
Stars: ✭ 21 (-97.87%)
Mutual labels:  avx, sse, simd, avx2, avx512
Mipp
MIPP is a portable wrapper for SIMD instructions written in C++11. It supports NEON, SSE, AVX and AVX-512.
Stars: ✭ 253 (-74.31%)
Mutual labels:  simd, sse, neon, portable, avx
Nsimd
Agenium Scale vectorization library for CPUs and GPUs
Stars: ✭ 138 (-85.99%)
Mutual labels:  simd, neon, avx2, avx512, avx
Sleef
SIMD Library for Evaluating Elementary Functions, vectorized libm and DFT
Stars: ✭ 353 (-64.16%)
Mutual labels:  simd, neon, vectorization, avx512, avx
Base64simd
Base64 coding and decoding with SIMD instructions (SSE/AVX2/AVX512F/AVX512BW/AVX512VBMI/ARM Neon)
Stars: ✭ 115 (-88.32%)
Mutual labels:  simd, sse, neon, avx2, avx512
Libsimdpp
Portable header-only C++ low level SIMD library
Stars: ✭ 914 (-7.21%)
Mutual labels:  simd, sse, neon, avx2, avx512
Directxmath
DirectXMath is an all inline SIMD C++ linear algebra library for use in games and graphics apps
Stars: ✭ 859 (-12.79%)
Mutual labels:  simd, sse, neon, avx2, avx
Guided Missile Simulation
Guided Missile, Radar and Infrared EOS Simulation Framework written in Fortran.
Stars: ✭ 33 (-96.65%)
Mutual labels:  avx, simd, avx2, vectorization

You may be interested in switching to std-simd. Features present in Vc 1.4 and not present in std-simd will eventually turn into Vc 2.0, which then depends on std-simd.

Vc: portable, zero-overhead C++ types for explicitly data-parallel programming

Recent generations of CPUs, and GPUs in particular, require data-parallel codes for full efficiency. Data parallelism requires that the same sequence of operations is applied to different input data. CPUs and GPUs can thus reduce the necessary hardware for instruction decoding and scheduling in favor of more arithmetic and logic units, which execute the same instructions synchronously. On CPU architectures this is implemented via SIMD registers and instructions. A single SIMD register can store N values and a single SIMD instruction can execute N operations on those values. On GPU architectures N threads run in perfect sync, fed by a single instruction decoder/scheduler. Each thread has local memory and a given index to calculate the offsets in memory for loads and stores.

Current C++ compilers can do automatic transformation of scalar codes to SIMD instructions (auto-vectorization). However, the compiler must reconstruct an intrinsic property of the algorithm that was lost when the developer wrote a purely scalar implementation in C++. Consequently, C++ compilers cannot vectorize any given code to its most efficient data-parallel variant. Especially larger data-parallel loops, spanning over multiple functions or even translation units, will often not be transformed into efficient SIMD code.

The Vc library provides the missing link. Its types enable explicitly stating data-parallel operations on multiple values. The parallelism is therefore added via the type system. Competing approaches state the parallelism via new control structures and consequently new semantics inside the body of these control structures.

Vc is a free software library to ease explicit vectorization of C++ code. It has an intuitive API and provides portability between different compilers and compiler versions as well as portability between different vector instruction sets. Thus an application written with Vc can be compiled for:

  • AVX and AVX2
  • SSE2 up to SSE4.2 or SSE4a
  • Scalar
  • AVX-512 (Vc 2 development)
  • NEON (in development)
  • NVIDIA GPUs / CUDA (research)

After Intel dropped MIC support with ICC 18, Vc 1.4 also removes support for it.

Examples

Usage on Compiler Explorer

Scalar Product

Let's start from the code for calculating a 3D scalar product using builtin floats:

using Vec3D = std::array<float, 3>;
float scalar_product(Vec3D a, Vec3D b) {
  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
}

Using Vc, we can easily vectorize the code using the float_v type:

using Vc::float_v
using Vec3D = std::array<float_v, 3>;
float_v scalar_product(Vec3D a, Vec3D b) {
  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
}

The above will scale to 1, 4, 8, 16, etc. scalar products calculated in parallel, depending on the target hardware's capabilities.

For comparison, the same vectorization using Intel SSE intrinsics is more verbose and uses prefix notation (i.e. function calls):

using Vec3D = std::array<__m128, 3>;
__m128 scalar_product(Vec3D a, Vec3D b) {
  return _mm_add_ps(_mm_add_ps(_mm_mul_ps(a[0], b[0]), _mm_mul_ps(a[1], b[1])),
                    _mm_mul_ps(a[2], b[2]));
}

The above will neither scale to AVX, AVX-512, etc. nor is it portable to other SIMD ISAs.

Build Requirements

cmake >= 3.0

C++11 Compiler:

  • GCC >= 4.8.1
  • clang >= 3.4
  • ICC >= 18.0.5
  • Visual Studio 2015 (64-bit target)

Building and Installing Vc

  • After cloning, you need to initialize Vc's git submodules:
git submodule update --init
  • Create a build directory:
$ mkdir build
$ cd build
  • Call cmake with the relevant options:
$ cmake -DCMAKE_INSTALL_PREFIX=/opt/Vc -DBUILD_TESTING=OFF <srcdir>
  • Build and install:
$ make -j16
$ make install

Documentation

The documentation is generated via doxygen. You can build the documentation by running doxygen in the doc subdirectory. Alternatively, you can find nightly builds of the documentation at:

Publications

Work on integrating the functionality of Vc in the C++ standard library.

Communication

A channel on the freenode IRC network is reserved for discussions on Vc: ##vc on freenode (via SSL)

Feel free to use the GitHub issue tracker for questions. Alternatively, there's a mailinglist for users of Vc

License

Vc is released under the terms of the 3-clause BSD license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].