Is it possible to test in Fortran if the processor is vectorial and find out the max length the vector?
I checked the cpuinfo as listed below
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 63
model name : Intel(R) Xeon(R) CPU E5-2697 v3 @ 2.60GHz
stepping : 2
microcode : 0x27
cpu MHz : 1201.078
cache size : 17920 KB
physical id : 0
siblings : 7
core id : 0
cpu cores : 7
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 15
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid
bogomips : 5200.36
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
No, the answer is the instruction set flags, in your case avx2, sse4_1, sse4_2
, you really should study what they mean https://en.wikipedia.org/wiki/SSE4 https://en.wikipedia.org/wiki/Advanced_Vector_Extensions
The same CPU has different vector instructions with different capabilities. There is no single vector unit with defined length. There (conceptually) is one for each possible instruction set and each datatype. For example, from Wikipedia:
SSE used only a single data type for XMM registers:
four 32-bit single-precision floating point numbers
SSE2 would later expand the usage of the XMM registers to include:
two 64-bit double-precision floating point numbers or two 64-bit integers or four 32-bit integers or eight 16-bit short integers or sixteen 8-bit bytes or characters.
AVX and AVX2 added 256-bit operations, but it depends, if the particular operation you need is among the supported ones, or you need to use SSE(2).