The C++ Vector Class Library for SIMD programming on x86 platforms. github.com/vectorclass
Questions tagged [vector-class-library]
13 questions
6
votes
3 answers
Compile multi-architecture code using Agner's Vector Class Library
How can I create a library that will dynamically switch between SSE, AVX, and AVX2 code paths depending on the host processor/OS? I am using Agner Fog's VCL (Vector Class Library) and compiling with GCC for Linux.

Aleksandr Dubinsky
- 22,436
- 15
- 82
- 99
3
votes
2 answers
How to compile a project which requires SSE2 on MacBook with M1 chip?
I need to install a software which requires SSE2 on my macbook air with M1 chip (os Monterey).
When I am trying to compile the project I receive the following error:
/libRootFftwWrapper/vectorclass/vectorclass.h:38:4: error: Please compile for the…

Alisa Nozdrina
- 51
- 1
- 6
2
votes
2 answers
How to use Vector Class Library for AVX vectorization together with the openmp #pragma omp parallel for reduction?
I'm using OpenMP to parallelize the loop, that is internally using AVX-512 with Agner Fog's VCL Vector Class Library.
Here is the code:
double HarmonicSeries(const unsigned long long int N) {
unsigned long long int i;
Vec8d divV(1.0, 2.0, 3.0,…

Jirka
- 365
- 2
- 8
2
votes
3 answers
Is it good or bad (performance-wise) to use std::vector
I am using Agner Fog's vectorclass library to use SIMD instructions (AVX specifically) in my application. Since it is best to use struct-of-array datastructures for easily employing SIMD, I quite often use:
std::vector some_var;
or…

wvc
- 91
- 1
- 3
1
vote
1 answer
How to use VCL as a separate namespace?
My goal is to separate all vectorclass-library typenames to a separate namespace, so that vcl::Vec4i will compile, but Vec4i won't. I tried to use example from manual, however it's not working.
Failed attempt following the manual:
#include…

Vladislav Kogan
- 561
- 6
- 15
1
vote
0 answers
AVX2/VCL : static/dynamic lane scheduling
I have been trying to speed up a binary tree evaluation algo using AVX2. Actually, I'm using Agner's VCL lib since the difference between hand-coding the algo and using vcl was small for big gain in readability.
I have a list of trees that need to…

David Jobet
- 111
- 1
- 5
1
vote
0 answers
Can't get vectorclass library to compile to AVX2 instructions in MSVC2019
I have tried my best to get the vectorclass library to generate AVX2 instructions, but can't get it to.
I'm using MSVC2019. Here are the compile options:
/permissive- /ifcOutput "x64\Release" /GS /Qpar /GL /W3 /Gy /Zc:wchar_t…

blmckinley
- 11
- 2
1
vote
1 answer
Are there any real benefits to compiling a 32-bit version of my DLL with AVX or higher?
I have a legacy Windows DLL (written in c++) for which I need to maintain a 32-bit version, along with the 64-bit version. I'm updating the heavy math code with simd using Agner's vector class library, and seeing little or no speed improvements for…

dts
- 125
- 1
- 10
1
vote
3 answers
Vector class library for processing speed
I am looking at parallel processing algorithm for processing speed improvement.
I want to test Agner Fog's vector class library, VCL.
I am wondering how to select different vector classes for example Vec16c (SSE2 instruction set) and Vec32c (AVX…

batuman
- 7,066
- 26
- 107
- 229
0
votes
3 answers
How to gather arbitrary indexes in VCL with AVX2 enabled
I want to vectorize following code using gather instructions in VCL. Some operations should be performed on the indexes of vSource defined by other vector VInd:
vector vSource;
vector vInd;
for (auto i = 0; i < vSource.size();i++) {
…

Vladislav Kogan
- 561
- 6
- 15
0
votes
0 answers
Vector class library: solivng a problem while using vec4d
here a piece of simplified code that causes me a problem/error (Vec4d is coming from the Agner Fog library VCL)
#define AVX256_ALIGNED_MALLOC(type,size) (type *)_aligned_malloc(size * sizeof(type),32)
#define AVX256_FREE(ptr)…

Luc
- 11
- 3
0
votes
0 answers
Vector resize function not working properly c++
I have been making a custom vector class, however I have been bumping into a problem. The problem being that my vector just won't resize, the size stays 0.
Anyone know what the problem is?
Thanks in advance!
void resize(const int newSize) {
…

Robert
- 1
- 1
-1
votes
2 answers
Does anyone know of a fix for an MSVC compiler bug/annoyance where SIMD Extension settings get "stuck" on AVX?
Does anyone know of a fix for an MSVC compiler bug/annoyance where SIMD Extension settings get "stuck" on AVX?
The context of this question is coding up SIMD CPU dispatchers, closely following Agner's well-known dispatch_example2.cpp project. I've…

dts
- 125
- 1
- 10