JuliaMath / JuliaMath/IntelVectorMath.jl

Scalar Calculation?

Offen
#44 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Enhancement
Vorherrschende Sprache
Julia
Sterne
75
Forks
17
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Now the library only supports doing a calculation on an `Array` and also returns an `Array`.

It may be worth while to define scalar methods too.
```julia
julia> IVM.sin(1.1)
ERROR: MethodError: no method matching sin(::Float64)
You may have intended to import Base.sin
Closest candidates are:
sin(::Array{Float32,N} where N) at C:\Users\yahyaaba\.julia\packages\IntelVectorMath\Gb348\src\setup.jl:72
sin(::Array{Float64,N} where N) at C:\Users\yahyaaba\.julia\packages\IntelVectorMath\Gb348\src\setup.jl:72
Stacktrace:
[1] top-level scope at none:0
```

This way we only use Intel for calculating one scalar number, which (if possible) helps to fuse for-loops with broadcasted functions and use `@avx` or `@simd` features of Julia instead for parallelization.

We should see if Intel provides scalar API. Because if it only provides Vector API, and the function call uses the Vector Processor Unit of the CPU, we cannot parallelize the function. This is like vectorizing an already vectorized function (although having a size of 1), which doesn't have an effect.

Related to https://github.com/JuliaMath/IntelVectorMath.jl/issues/43, which can help to implement the 3rd macro.

This can also solve https://github.com/JuliaMath/IntelVectorMath.jl/issues/22, by using Intel-only for a scalar call and provide an SVML like behavior using `@avx` or `@simd`.

Places to look into:
- https://software.intel.com/en-us/cpp-compiler-developer-guide-and-reference-intrinsics-for-short-vector-math-library-operations
- https://software.intel.com/sites/landingpage/IntrinsicsGuide/#
- http://openpowerfoundation.org/wp-content/uploads/resources/Vector-Intrinsics-4/content/sec_packed_vs_scalar_intrinsics.html
- https://stackoverflow.com/questions/37290544/is-there-an-intrinsic-instruction-for-resulti-ak-sinbk-ci-dk

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Start by inspecting the scalar method definitions in src/setup.jl and the Intel scalar and vector intrinsic references linked in the issue. Determine whether scalar APIs are available, then assess how scalar methods should interact with @avx and @simd; done means scalar calls such as IVM.sin(1.1) work without disrupting array calculations.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
julia
Bereich
performance
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.