Vlasiator ebf0dd394 on dev (v5.4.0 + 1054 commits)
Loading...
Searching...
No Matches
vec.h
Go to the documentation of this file.
1/*
2 * This file is part of Vlasiator.
3 * Copyright 2010-2016 Finnish Meteorological Institute
4 *
5 * For details of usage, see the COPYING file and read the "Rules of the Road"
6 * at http://www.physics.helsinki.fi/vlasiator/
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
23#include "../common.h"
24#ifndef VECTORCLASS_INTERFACE_H
25#define VECTORCLASS_INTERFACE_H
26
55
56
57#ifdef VEC_FALLBACK_GENERIC
58// use portable vectorclass with specified vector length
59// if not specified in Makefile, equivalent to VEC8F
60#ifndef VECL
61#define VECL (8)
62#endif
63#ifndef VEC_PER_PLANE
64const int VEC_PER_PLANE = (WID*WID/VECL);
65#endif
66#ifndef VEC_PER_BLOCK
67const int VEC_PER_BLOCK = (WID*VEC_PER_PLANE);
68#endif
69#ifndef VPREC
70#define VPREC (8)
71#endif
72
74
75typedef VecSimple<bool> Vecb;
76typedef VecSimple<int> Veci;
77
78#ifdef DPF
79typedef VecSimple<double> Vec;
80#define to_realf(v) to_double(v)
81#else
82typedef VecSimple<float> Vec;
83#define to_realf(v) to_float(v)
84#endif
85
86#endif
87
88// SVE Definitions
89#if (defined(VEC4F_SVE) || defined(VEC4D_SVE))
90#define VECL 4
91#define VEC_SVE
92#endif
93
94#if (defined(VEC8F_SVE) || defined(VEC8D_SVE))
95#define VECL 8
96#define VEC_SVE
97#endif
98
99#if (defined(VEC16F_SVE) || defined(VEC16D_SVE))
100#define VECL 16
101#define VEC_SVE
102#endif
103
104#if (defined(VEC32F_SVE) || defined(VEC32D_SVE))
105#define VECL 32
106#define VEC_SVE
107#endif
108
109#if (defined(VEC64F_SVE) || defined(VEC64D_SVE))
110#define VECL 64
111#define VEC_SVE
112#endif
113
114#if defined(VEC_SVE)
115
116#include "vectorclass_sve.hpp"
117
118#define VPREC 8
119#ifndef VEC_PER_PLANE
120const int VEC_PER_PLANE = (WID*WID/VECL);
121#endif
122#ifndef VEC_PER_BLOCK
123const int VEC_PER_BLOCK = (WID*VEC_PER_PLANE);
124#endif
125
126#if defined(DPF)
127using Vec = VecSVE<double, VECL>;
128using Veci = VecSVE<int64_t, VECL>;
129using Vecb = VecSVEMask<double, VECL>;
130#define to_realf(v) to_double(v)
131#else
132using Vec = VecSVE<float, VECL>;
133using Veci = VecSVE<int32_t, VECL>;
134using Vecb = VecSVEMask<float, VECL>;
135#define to_realf(v) to_float(v)
136#endif
137
138#endif // END VEC_SVE
139
140#ifdef VEC4D_AGNER
141//user Agner's AVX2 optimized datatypes, double precision accuracy
142#include "vectorclass.h"
143typedef Vec4d Vec;
144#if VECTORCLASS_H >= 20000
145typedef Vec4q Veci;
146#else
147typedef Vec4i Veci;
148#endif
149typedef Vec4db Vecb;
150#define to_realf(v) to_double(v)
151#define VECL 4
152#define VPREC 8
153#ifndef VEC_PER_PLANE
154const int VEC_PER_PLANE = (WID*WID/VECL);
155#endif
156#ifndef VEC_PER_BLOCK
157const int VEC_PER_BLOCK = (WID*VEC_PER_PLANE);
158#endif
159#endif
160
161#ifdef VEC8D_AGNER
162//user Agner's AVX512 optimized datatypes, double precision accuracy
163#include "vectorclass.h"
164typedef Vec8d Vec;
165#if VECTORCLASS_H >= 20000
166typedef Vec8q Veci;
167#else
168typedef Vec8i Veci;
169#endif
170typedef Vec8db Vecb;
171#define to_realf(v) to_double(v)
172#define VECL 8
173#define VPREC 8
174#ifndef VEC_PER_PLANE
175const int VEC_PER_PLANE = (WID*WID/VECL);
176#endif
177#ifndef VEC_PER_BLOCK
178const int VEC_PER_BLOCK = (WID*VEC_PER_PLANE);
179#endif
180#endif
181
182#ifdef VEC4F_AGNER
183//user Agner's SSEx optimized datatypes, double precision accuracy
184#include "vectorclass.h"
185typedef Vec4f Vec;
186typedef Vec4i Veci;
187typedef Vec4fb Vecb;
188#define to_realf(v) to_float(v)
189#define VECL 4
190#define VPREC 4
191#ifndef VEC_PER_PLANE
192const int VEC_PER_PLANE = (WID*WID/VECL);
193#endif
194#ifndef VEC_PER_BLOCK
195const int VEC_PER_BLOCK = (WID*VEC_PER_PLANE);
196#endif
197#endif
198
199#ifdef VEC8F_AGNER
200//user Agner's AVX2 optimized datatypes, single precision accuracy
201#include "vectorclass.h"
202typedef Vec8f Vec;
203typedef Vec8i Veci;
204typedef Vec8fb Vecb;
205#define to_realf(v) to_float(v)
206#define VECL 8
207#define VPREC 4
208#ifndef VEC_PER_PLANE
209const int VEC_PER_PLANE = (WID*WID/VECL);
210#endif
211#ifndef VEC_PER_BLOCK
212const int VEC_PER_BLOCK = (WID*VEC_PER_PLANE);
213#endif
214#endif
215
216
217#ifdef VEC16F_AGNER
218//user Agner's AVX512 optimized datatypes, single precision accuracy
219#include "vectorclass.h"
220typedef Vec16f Vec;
221typedef Vec16i Veci;
222typedef Vec16fb Vecb;
223#define to_realf(v) to_float(v)
224#define VECL 16
225#define VPREC 4
226#ifndef VEC_PER_PLANE
227const int VEC_PER_PLANE = (WID*WID/VECL);
228#endif
229#ifndef VEC_PER_BLOCK
230const int VEC_PER_BLOCK = (WID*VEC_PER_PLANE);
231#endif
232#endif
233
234#endif
#define WID
Definition common.h:514