Skip to content

Switch to FastTransforms_jll #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
# Documentation: http://www.appveyor.com/docs/appveyor-yml/
image: Visual Studio 2017

cache: c:\tools\vcpkg\installed\

platform: x64

environment:
matrix:
- julia_version: 1.0
- julia_version: 1.1
- julia_version: 1.2
- julia_version: 1.3
- julia_version: nightly

platform:
- x86 # 32-bit
- x64 # 64-bit

# # Uncomment the following lines to allow failures on nightly julia
# # (tests will run but not make your overall status red)
matrix:
Expand All @@ -32,10 +26,6 @@ notifications:

install:
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1"))
- set PATH=%PATH%;c:\tools\vcpkg
- set PATH=%PATH%;C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin\
- vcpkg install openblas:x64-windows fftw3[core,threads]:x64-windows mpfr:x64-windows mpir:x64-windows --recurse
- set PATH=c:\tools\vcpkg\installed\x64-windows\bin;%PATH%

build_script:
- echo "%JL_BUILD_SCRIPT%"
Expand Down
16 changes: 16 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
freebsd_instance:
image: freebsd-12-0-release-amd64
task:
name: FreeBSD
env:
matrix:
- JULIA_VERSION: 1.3
- JULIA_VERSION: nightly
install_script:
- sh -c "$(fetch https://raw.githubusercontent.com/ararslan/CirrusCI.jl/master/bin/install.sh -o -)"
build_script:
- cirrusjl build
test_script:
- cirrusjl test
coverage_script:
- cirrusjl coverage codecov coveralls
10 changes: 0 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,11 @@ os:
- linux
- osx
julia:
- 1.0
- 1.1
- 1.2
- 1.3
- nightly
matrix:
allow_failures:
- julia: nightly
addons:
apt:
packages: ['libquadmath0', 'libgomp1', 'libopenblas-dev', 'libfftw3-dev', 'libmpfr-dev']
homebrew:
packages: ['gcc@8', 'fftw', 'mpfr']
update: true

notifications:
email: false
after_success:
Expand Down
5 changes: 3 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name = "FastTransforms"
uuid = "057dd010-8810-581a-b7be-e3fc3b93f78c"
version = "0.7.0"
version = "0.8.0"

[deps]
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
BinaryProvider = "b99e7846-7c00-51b0-8f62-c81ae34c0232"
DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2"
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
FastGaussQuadrature = "442a2c76-b920-505d-bb47-c5924d526838"
FastTransforms_jll = "34b6f7d7-08f9-5794-9e10-3819e4c7e49a"
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
Expand All @@ -24,4 +25,4 @@ FastGaussQuadrature = "0.4"
Reexport = "0.2"
SpecialFunctions = "0.8"
ToeplitzMatrices = "0.6"
julia = "1"
julia = "≥ 1.3"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# FastTransforms.jl

[![Travis](https://travis-ci.org/JuliaApproximation/FastTransforms.jl.svg?branch=master)](https://travis-ci.org/JuliaApproximation/FastTransforms.jl) [![AppVeyor](https://ci.appveyor.com/api/projects/status/oba9qush15q3x8pb/branch/master?svg=true)](https://ci.appveyor.com/project/MikaelSlevinsky/fasttransforms-jl/branch/master) [![codecov](https://codecov.io/gh/JuliaApproximation/FastTransforms.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaApproximation/FastTransforms.jl) [![](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaApproximation.github.io/FastTransforms.jl/stable) [![](https://img.shields.io/badge/docs-latest-blue.svg)](https://JuliaApproximation.github.io/FastTransforms.jl/latest)
[![Travis](https://travis-ci.org/JuliaApproximation/FastTransforms.jl.svg?branch=master)](https://travis-ci.org/JuliaApproximation/FastTransforms.jl) [![AppVeyor](https://ci.appveyor.com/api/projects/status/oba9qush15q3x8pb/branch/master?svg=true)](https://ci.appveyor.com/project/MikaelSlevinsky/fasttransforms-jl/branch/master) [![Cirrus](https://api.cirrus-ci.com/github/JuliaApproximation/FastTransforms.jl.svg)](https://cirrus-ci.com/github/JuliaApproximation/FastTransforms.jl) [![codecov](https://codecov.io/gh/JuliaApproximation/FastTransforms.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaApproximation/FastTransforms.jl) [![](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaApproximation.github.io/FastTransforms.jl/stable) [![](https://img.shields.io/badge/docs-latest-blue.svg)](https://JuliaApproximation.github.io/FastTransforms.jl/latest)

`FastTransforms.jl` allows the user to conveniently work with orthogonal polynomials with degrees well into the millions.

This package provides a Julia wrapper for the [C library](https://github.com/MikaelSlevinsky/FastTransforms) of the same name. Additionally, all three types of nonuniform fast Fourier transforms are available, as well as the Padua transform.

## Installation

The build script, which works on macOS, Linux, and Windows systems, downloads precompiled binaries of the latest version of [FastTransforms](https://github.com/MikaelSlevinsky/FastTransforms) or builds them from source, as governed by the environment variable `FT_BUILD_FROM_SOURCE=true/false`. This library depends on `FFTW`, `MPFR`, and `OpenBLAS` (on Linux and Windows), which must be present for a successful build. With dependencies, installation may be as straightforward as:
Installation, which uses [BinaryBuilder](https://github.com/JuliaPackaging/BinaryBuilder.jl) for Intel processors (Sandybridge and beyond), may be as straightforward as:

```julia
pkg> add FastTransforms
Expand Down
23 changes: 2 additions & 21 deletions deps/build.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using BinaryProvider
import Libdl

version = v"0.2.9"
version = v"0.2.12"

if arch(platform_key_abi()) != :x86_64
@warn "FastTransforms has only been tested on x86_64 architectures."
Expand All @@ -20,11 +20,7 @@ print_platform_error(p::MacOS) = "On MacOS\n\tbrew install gcc@8 fftw mpfr\n"
print_platform_error(p::Linux) = "On Linux\n\tsudo apt-get install gcc-8 libblas-dev libopenblas-base libfftw3-dev libmpfr-dev\n"
print_platform_error(p::Windows) = "On Windows\n\tvcpkg install openblas:x64-windows fftw3[core,threads]:x64-windows mpir:x64-windows mpfr:x64-windows\n"

# Rationale is as follows: The build is pretty fast, so on Linux it is typically easiest
# to just use the gcc of the system to build the library and include it. On MacOS, however,
# we need to actually install a gcc first, because Apple's OS comes only shipped with clang,
# so here we download the binary.
ft_build_from_source = get(ENV, "FT_BUILD_FROM_SOURCE", Sys.isapple() ? "false" : "true")
ft_build_from_source = get(ENV, "FT_BUILD_FROM_SOURCE", "false")
if ft_build_from_source == "true"
make = Sys.iswindows() ? "mingw32-make" : "make"
compiler = Sys.isapple() ? "CC=gcc-8" : "CC=gcc"
Expand All @@ -51,19 +47,4 @@ if ft_build_from_source == "true"
print_error()
end
println("FastTransforms built from source.")
else
const GCC = BinaryProvider.detect_compiler_abi().gcc_version
namemap = Dict(:gcc4 => "gcc-4.9", :gcc5 => "gcc-5", :gcc6 => "gcc-6",
:gcc7 => "gcc-7", :gcc8 => "gcc-8", :gcc9 => "gcc-9")
if !(GCC in keys(namemap))
error("Please ensure you have a version of gcc from gcc-4.9 to gcc-9.")
end
try
download("https://github.com/MikaelSlevinsky/FastTransforms/releases/download/" *
"v$version/libfasttransforms.v$version.$(namemap[GCC]).$extension",
joinpath(dirname(@__DIR__), "deps", "libfasttransforms.$extension"))
catch
print_error()
end
println("FastTransforms installed by downloading binaries.")
end
9 changes: 5 additions & 4 deletions src/FastTransforms.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module FastTransforms

using DSP, FastGaussQuadrature, Libdl, LinearAlgebra, SpecialFunctions, ToeplitzMatrices
using Reexport
using DSP, FastGaussQuadrature, LinearAlgebra
using Reexport, SpecialFunctions, ToeplitzMatrices

@reexport using AbstractFFTs
@reexport using FFTW

Expand All @@ -19,11 +20,11 @@ import AbstractFFTs: Plan, ScaledPlan,
rfft_output_size, brfft_output_size,
plan_inv, normalization

import DSP: conv

import FFTW: dct, dct!, idct, idct!, plan_dct!, plan_idct!,
plan_dct, plan_idct, fftwNumber

import DSP: conv

import FastGaussQuadrature: unweightedgausshermite

import LinearAlgebra: mul!, lmul!, ldiv!
Expand Down
15 changes: 10 additions & 5 deletions src/libfasttransforms.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
const libfasttransforms = find_library("libfasttransforms", [joinpath(dirname(@__DIR__), "deps")])

if libfasttransforms ≡ nothing || length(libfasttransforms) == 0
error("FastTransforms is not properly installed. Please run Pkg.build(\"FastTransforms\") ",
"and restart Julia.")
ft_build_from_source = get(ENV, "FT_BUILD_FROM_SOURCE", "false")
if ft_build_from_source == "true"
using Libdl
const libfasttransforms = find_library("libfasttransforms", [joinpath(dirname(@__DIR__), "deps")])
if libfasttransforms ≡ nothing || length(libfasttransforms) == 0
error("FastTransforms is not properly installed. Please run Pkg.build(\"FastTransforms\") ",
"and restart Julia.")
end
else
using FastTransforms_jll
end

function ft_fftw_plan_with_nthreads(n::Integer)
Expand Down
2 changes: 1 addition & 1 deletion test/hermitetests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ hermitepoints(n) = FastGaussQuadrature.unweightedgausshermite( n )[1]
@test hermitepoints(100_000)[end] ≈ 446.9720305443094

@test weightedhermitetransform([1.0]) == [1.0]
@test weightedhermitetransform(exp.(-hermitepoints(2).^2/2)) == [1.0,0.0]
@test weightedhermitetransform(exp.(-hermitepoints(2).^2/2)) [1.0,0.0]
@test weightedhermitetransform(exp.(-hermitepoints(3).^2/2)) ≈ [1.0,0.0,0.0]
@test weightedhermitetransform(exp.(-hermitepoints(1000).^2/2)) ≈ [1.0; zeros(999)]
@test weightedhermitetransform(exp.(-hermitepoints(3000).^2/2)) ≈ [1.0; zeros(2999)]
Expand Down