1666338430
Julia bindings to clFFT library.
import OpenCL
import CLFFT
import FFTW
using LinearAlgebra
const cl = OpenCL.cl
const clfft = CLFFT
_, ctx, queue = cl.create_compute_context()
N = 100
X = ones(ComplexF64, N)
bufX = cl.Buffer(ComplexF64, ctx, :copy, hostbuf=X)
p = clfft.Plan(ComplexF64, ctx, size(X))
clfft.set_layout!(p, :interleaved, :interleaved)
clfft.set_result!(p, :inplace)
clfft.bake!(p, queue)
clfft.enqueue_transform(p, :forward, [queue], bufX, nothing)
result = cl.read(queue, bufX)
@assert isapprox(norm(result - FFTW.fft(X)), zero(Float32))
Author: JuliaGPU
Source Code: https://github.com/JuliaGPU/CLFFT.jl
License: View license
1666338430
Julia bindings to clFFT library.
import OpenCL
import CLFFT
import FFTW
using LinearAlgebra
const cl = OpenCL.cl
const clfft = CLFFT
_, ctx, queue = cl.create_compute_context()
N = 100
X = ones(ComplexF64, N)
bufX = cl.Buffer(ComplexF64, ctx, :copy, hostbuf=X)
p = clfft.Plan(ComplexF64, ctx, size(X))
clfft.set_layout!(p, :interleaved, :interleaved)
clfft.set_result!(p, :inplace)
clfft.bake!(p, queue)
clfft.enqueue_transform(p, :forward, [queue], bufX, nothing)
result = cl.read(queue, bufX)
@assert isapprox(norm(result - FFTW.fft(X)), zero(Float32))
Author: JuliaGPU
Source Code: https://github.com/JuliaGPU/CLFFT.jl
License: View license
1665087060
This package provides an interface to the the GraphViz
package for graph visualization. There are two primary entry points:
GraphViz.load
function (not exported) to load graphs from a filedot"""
string macro for literal inline specifications of graphsBoth of these accept Graph
type accepts graph in DOT format. To load a graph from a non-constant string, use GraphViz.load
with an IOBuffer
.
Getting started
If you already have a graph you would like to work with, the following code snippets may be helpful. If not, have a look at the "Simple Examples" section below
using GraphViz
GraphViz.load("mygraph.dot")
dot"""
digraph graphname {
a -> b -> c;
b -> d;
}
""")
Usage
After obtaining the package through the package manager, the following suffices to load the package:
using GraphViz
Note that graphviz has many configuration options. In particular, both the Cairo and the GTK backends may be disabled by default.
Simple Examples
Try the following in an IJulia Notebook (this example is taken from here):
dot"""
graph graphname {
// The label attribute can be used to change the label of a node
a [label="Foo"];
// Here, the node shape is changed.
b [shape=box];
// These edges both have different line properties
a -- b -- c [color=blue];
b -- d [style=dotted];
}
"""
Author: JuliaGraphs
Source Code: https://github.com/JuliaGraphs/GraphViz.jl
License: View license
1665345480
This package provides bindings to the Intel MKL Vector Mathematics Functions. This is often substantially faster than broadcasting Julia's built-in functions, especially when applying a transcendental function over a large array. Until Julia 0.6 the package was registered as VML.jl
.
Similar packages are Yeppp.jl, which wraps the open source Yeppp library, and AppleAccelerate.jl, which provides access to macOS's Accelerate framework.
There is currently the following issue between the CompilerSupportLibraries_jll
artifact, which is used for example by SpecialFunctions.jl
, and MKL_jll
. Unless MKL_jll
is loaded first, there might be wrong results coming from a small number of function for particular input array lengths. If you are unsure which, if any, your used packages might load this artifact, loading IntelVectorMath
as the very first package should be fine.
To install IntelVectorMath.jl run
julia> ] add IntelVectorMath
Since version 0.4 IntelVectorMath
uses the MKL_jll
artifact, which is shared with other packages uses MKL, removing several other dependencies. This has the side effect that from version 0.4 onwards this package requires at least Julia 1.3.
For older versions of Julia IntelVectorMath v0.3
downloads its own version of MKL and keeps only the required files in its own directory. As such installing MKL.jl or MKL via intel are no longer required, and may mean some duplicate files if they are present. However, this package will adopt the new artifact system in the next minor version update and fix this issue. In the event that MKL was not installed properly you will get an error when first using
it. Please try running
julia> ] build IntelVectorMath
If this does not work, please open an issue and include the output of <packagedir>/deps/build.log
.
If you used this package prior to its renaming, you may have to run ] rm VML
first. Otherwise there will be a conflict due to the UUID.
After loading IntelVectorMath
, you have the supported function listed below, for example IntelVectorMath.sin(rand(100))
. These should provide a significant speed-up over broadcasting the Base functions. Since the package name is quite long, an alias IVM
is also exported to allow IVM.sin(rand(100))
after using
the package. If you import
the package, you can add this alias via const IVM = IntelVectorMath
. Equally, you can replace IVM
with another alias of your choice.
julia> using IntelVectorMath, BenchmarkTools
julia> a = randn(10^4);
julia> @btime sin.($a); # apply Base.sin to each element
102.128 μs (2 allocations: 78.20 KiB)
julia> @btime IVM.sin($a); # apply IVM.sin to the whole array
20.900 μs (2 allocations: 78.20 KiB)
julia> b = similar(a);
julia> @btime IVM.sin!(b, a); # in-place version
20.008 μs (0 allocations: 0 bytes)
By default, IntelVectorMath uses VML_HA
mode, which corresponds to an accuracy of <1 ulp, matching the accuracy of Julia's built-in openlibm implementation, although the exact results may be different. To specify low accuracy, use vml_set_accuracy(VML_LA)
. To specify enhanced performance, use vml_set_accuracy(VML_EP)
. More documentation regarding these options is available on Intel's website.
Summary of Results:
Relative speed of IntelVectorMath/Base: The height of the bars is how fast IntelVectorMath is compared to using broadcasting for functions in Base
Full Results:
Real Functions - Full Benchmark Results
Complex Functions - Full Benchmark Results
Real Functions - Performance over dimensions
Tests were performed on an Intel(R) Core(TM) i5-8250U @ 1.6 [GHz] 1800 Mhz. The dashed line indicates equivalent performance for IntelVectorMath versus the implementations in Base.
IntelVectorMath.jl supports the following functions, most for Float32 and Float64, while some also take complex numbers.
Allocating forms have signature f(A)
. Mutating forms have signatures f!(A)
(in place) and f!(out, A)
(out of place). The last 9 functions have been moved from Base to SpecialFunctions.jl
or have no Base equivalent.
Allocating | Mutating |
---|---|
acos | acos! |
asin | asin! |
atan | atan! |
cos | cos! |
sin | sin! |
tan | tan! |
acosh | acosh! |
asinh | asinh! |
atanh | atanh! |
cosh | cosh! |
sinh | sinh! |
tanh | tanh! |
cbrt | cbrt! |
sqrt | sqrt! |
exp | expm1! |
log | log! |
log10 | log10! |
log1p | log1p! |
abs | abs! |
abs2 | abs2! |
ceil | ceil! |
floor | floor! |
round | round! |
trunc | trunc! |
erf | erf! |
erfc | erfc! |
erfinv | erfinv! |
efcinv | efcinv! |
gamma | gamma! |
lgamma | lgamma! |
inv_cbrt | inv_cbrt! |
inv_sqrt | inv_sqrt! |
pow2o3 | pow2o3! |
pow3o2 | pow3o2! |
Allocating forms have signature f(A, B)
. Mutating forms have signature f!(out, A, B)
.
Allocating | Mutating |
---|---|
atan | atan! |
hypot | hypot! |
pow | pow! |
divide | divide! |
Next steps for this package
IntelVectorMath.jl uses CpuId.jl to detect if your processor supports the newer avx2
instructions, and if not defaults to libmkl_vml_avx
. If your system does not have AVX this package will currently not work for you. If the CPU feature detection does not work for you, please open an issue.
Author: JuliaMath
Source Code: https://github.com/JuliaMath/IntelVectorMath.jl
License: View license
1665069260
This is a binding of the C++ game and multimedia library SFML (Simple and Fast Multimedia Library), developed by Laurent Gomila, for Julia. SFML is often used for game development but it can be used for anything graphics-related.
It also has audio libraries and networking libraries.
There is currently almost complete support for graphics, great support for audio, and complete support for network.
SFML.jl works on Mac OS X, Linux, and Windows.
Take a look at the examples
folder to see some usage examples.
For much larger examples (games) see these two examples: Jumping Game and Space Shooter (this one is more complex).
You can view a talk I gave about SFML.jl at JuliaCon 2015 here. All the demos that I used in that talk are available in the JuliaCon-SFML repository.
Installation
To install on any OS, run:
julia> Pkg.add("SFML")
If you want to install the master version use:
julia> Pkg.clone("SFML")
julia> Pkg.build("SFML")
Please make sure you have Glibc 2.14 installed, and let me know if there are any build problems on Linux (I don't use Linux very much). The Linux binaries don't come with any of the dependencies so you have to install them yourself. Here is the list:
On Debian you can install the package libsfml-dev
which will also install all dependencies. You can also run the commands here (you don't need to install cmake-gui).
Screenshots and Gifs
It is very simple to take a screen shot using SFML. Just use screenshot(window, filename)
.
You can also take a screenshot and store it in an Image
object without saving the image using image = capture(window)
To create a gif, you must have imagemagick installed.
Making gifs is only slightly more complicated. You can use the make_gif(window, width, height, duration, filename, delay)
function (duration and delay are in seconds).
When you run the program, it will asynchronously create the gif and will give you constant feedback in the console. If you don't see anything in the console, add a sleep(0)
declaration at the start of the animation loop to allow Julia time to switch between the processes.
The gif creation is done when it says Created gif XXX.gif
.
What has not been bound (yet)
For the first three, we will probably have to wait for Julia to support multithreading.
Author: Zyedidia
Source Code: https://github.com/zyedidia/SFML.jl
License: View license
1666112940
This package provides Julia bindings to the FFTW library for fast Fourier transforms (FFTs), as well as functionality useful for signal processing. These functions were formerly a part of Base Julia.
]add FFTW
using FFTW
fft([0; 1; 2; 1])
returns
4-element Array{Complex{Float64},1}:
4.0 + 0.0im
-2.0 + 0.0im
0.0 + 0.0im
-2.0 + 0.0im
The documentation of generic FFT functionality can be found in the AbstractFFTs.jl package. Additional functionalities supported by the FFTW library are documented in the present package.
Alternatively, the FFTs in Intel's Math Kernel Library (MKL) can be used by running FFTW.set_provider!("mkl")
. MKL will be provided through MKL_jll
. This change of provider is persistent and has to be done only once, i.e., the package will use MKL when building and updating. Note however that MKL provides only a subset of the functionality provided by FFTW. See Intel's documentation for more information about potential differences or gaps in functionality. In case MKL does not fit the needs (anymore), FFTW.set_provider!("fftw")
allows to revert the change of provider.
Author: JuliaMath
Source Code: https://github.com/JuliaMath/FFTW.jl
License: MIT license