Skip to content

Commit 0cba2de

Browse files
add developer documentation
close #134
1 parent 17be0ef commit 0cba2de

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

docs/make.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ makedocs(
3636
authors = "Richard Mikael Slevinsky",
3737
pages = Any[
3838
"Home" => "index.md",
39+
"Development" => "dev.md",
3940
"Examples" => [
4041
"generated/automaticdifferentiation.md",
4142
"generated/chebyshev.md",

docs/src/dev.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Development Documentation
2+
3+
The core of `FastTransforms.jl` is developed in parallel with the [C library](https://github.com/MikaelSlevinsky/FastTransforms) of the same name. Julia and C interoperability is enhanced by the [BinaryBuilder](https://github.com/JuliaPackaging/BinaryBuilder.jl) infrastructure, which provides the user a safe and seamless experience using a package in a different language.
4+
5+
## Why two packages?
6+
7+
Orthogonal polynomial transforms are performance-sensitive imperative tasks. Yet, many of Julia's rich and evolving language features are simply unnecessary for defining these computational routines. Moreover, rapid language changes in Julia (as compared to C) have been more than a perturbation to this repository in the past.
8+
9+
The C library generates assembly for vectorized operations such as single instruction multiple data (SIMD) that is more efficient than that generated by a compiler without human intervention. It also uses OpenMP to introduce shared memory parallelism for large tasks. Finally, calling into precompiled binaries reduces the Julia package's pre-compilation, improving the user experience. Some of these capabilities also exist in Julia, but with C there is just more control over performance.
10+
11+
C libraries are easier to call from any other language, partly explaining why the Python package manager Spack [already supports the C library](https://spack.readthedocs.io/en/latest/package_list.html#fasttransforms) through third-party efforts.
12+
13+
## The developer's right to build from source
14+
15+
Precompiled binaries are important for users, but development in C may be greatly accelerated by coupling it with a dynamic language such as Julia. For this reason, the repository preserves the developer's right to build the C library from source by setting an environment variable to trigger the build script:
16+
17+
```julia
18+
julia> ENV["FT_BUILD_FROM_SOURCE"] = "true"
19+
"true"
20+
21+
(@v1.5) pkg> build FastTransforms
22+
Building FFTW ────────── `~/.julia/packages/FFTW/ayqyZ/deps/build.log`
23+
Building TimeZones ───── `~/.julia/packages/TimeZones/K98G0/deps/build.log`
24+
Building FastTransforms `~/.julia/dev/FastTransforms/deps/build.log`
25+
26+
julia> using FastTransforms
27+
[ Info: Precompiling FastTransforms [057dd010-8810-581a-b7be-e3fc3b93f78c]
28+
29+
```
30+
31+
This lets the developer experiment with new features through `ccall`ing into bleeding edge source code. Customizing the build script further allows the developer to track a different branch or even a fork.
32+
33+
## From release to release to release
34+
35+
To get from a C library release to a Julia package release, the developer needs to update Yggdrasil's [build_tarballs.jl](https://github.com/JuliaPackaging/Yggdrasil/blob/master/F/FastTransforms/build_tarballs.jl) script for the new version and its 256-bit SHA. On macOS, the SHA can be found by:
36+
37+
```julia
38+
julia> run(`curl https://codeload.github.com/MikaelSlevinsky/FastTransforms/tar.gz/v0.5.0 --output FastTransforms-0.5.0.tar.gz`)
39+
% Total % Received % Xferd Average Speed Time Time Time Current
40+
Dload Upload Total Spent Left Speed
41+
100 156k 0 156k 0 0 351k 0 --:--:-- --:--:-- --:--:-- 350k
42+
Process(`curl https://codeload.github.com/MikaelSlevinsky/FastTransforms/tar.gz/v0.5.0 --output FastTransforms-0.5.0.tar.gz`, ProcessExited(0))
43+
44+
julia> run(`shasum -a 256 FastTransforms-0.5.0.tar.gz`)
45+
9556d0037bd5348a33f15ad6100e32053b6e22cab16a97c504f30d6c52fd0efd FastTransforms-0.5.0.tar.gz
46+
Process(`shasum -a 256 FastTransforms-0.5.0.tar.gz`, ProcessExited(0))
47+
48+
julia> run(`rm -f FastTransforms-0.5.0.tar.gz`)
49+
Process(`rm -f FastTransforms-0.5.0.tar.gz`, ProcessExited(0))
50+
```
51+
52+
Then we wait for the friendly folks at [JuliaPackaging](https://github.com/JuliaPackaging) to merge the pull request to Yggdrasil, triggering a new release of the [FastTransforms_jll.jl](https://github.com/JuliaBinaryWrappers/FastTransforms_jll.jl) meta package that stores all precompiled binaries. With this release, we update the FastTransforms.jl [Project.toml](https://github.com/JuliaApproximation/FastTransforms.jl/blob/master/Project.toml) to point to the latest release and register the new version.
53+
54+
Since development of Yggdrasil is quite rapid, a fork may easily become stale. Git permits the developer to forcibly make a master branch on a fork even with upstream master:
55+
56+
```
57+
git fetch upstream
58+
git checkout master
59+
git reset --hard upstream/master
60+
git push origin master --force
61+
```

0 commit comments

Comments
 (0)