Skip to content

Commit

Permalink
Merge pull request #102 from cpmech/remove-fftw
Browse files Browse the repository at this point in the history
Remove fftw
  • Loading branch information
cpmech authored Apr 24, 2024
2 parents 4467bf7 + 037bacb commit 683bc2c
Show file tree
Hide file tree
Showing 23 changed files with 12 additions and 2,584 deletions.
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"erfinv",
"FACCON",
"Fehlberg",
"fftw",
"Flannery",
"Forsythe",
"frexp",
Expand Down
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends \
g++ \
gdb \
gfortran \
libfftw3-dev \
liblapacke-dev \
libmumps-seq-dev \
libopenblas-dev \
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ sudo apt-get install -y --no-install-recommends \
g++ \
gdb \
gfortran \
libfftw3-dev \
liblapacke-dev \
libmumps-seq-dev \
libopenblas-dev \
Expand Down Expand Up @@ -729,9 +728,6 @@ fn main() -> Result<(), StrError> {
- [ ] Implement Orthogonal polynomials
- [x] Implement Lagrange interpolation
- [ ] Implement Fourier interpolation
- [x] Implement FFT
- [x] Partially wrap FFTW (with warnings about it being thread-unsafe)
- [ ] Implement a Rust-native FFT solver
- [x] Improve `russell_sparse`
- [x] Wrap the KLU solver (in addition to MUMPS and UMFPACK)
- [x] Implement the Compressed Sparse Column format (CSC)
Expand Down
1 change: 0 additions & 1 deletion case-a-openblas-debian.bash
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ sudo apt-get install -y --no-install-recommends \
g++ \
gdb \
gfortran \
libfftw3-dev \
liblapacke-dev \
libmumps-seq-dev \
libopenblas-dev \
Expand Down
1 change: 0 additions & 1 deletion case-a-openblas-local-libs.bash
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ sudo apt-get install -y --no-install-recommends \
gdb \
gfortran \
git \
libfftw3-dev \
liblapacke-dev \
libmetis-dev \
libopenblas-dev \
Expand Down
1 change: 0 additions & 1 deletion case-b-intel-mkl-local-libs.bash
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ sudo apt-get install -y --no-install-recommends \
g++ \
gdb \
git \
libfftw3-dev \
libmetis-dev \
make \
patch
Expand Down
4 changes: 2 additions & 2 deletions russell_lab/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ keywords = ["matrix", "vector", "linspace"]
intel_mkl = []

[dependencies]
criterion = "0.5"
num-complex = { version = "0.4", features = ["serde"] }
num-traits = "0.2"
serde = { version = "1.0", features = ["derive"] }

[dev-dependencies]
criterion = "0.5"
plotpy = "0.6"
serde_json = "1.0"
serial_test = "3.0"
Expand All @@ -29,5 +29,5 @@ serial_test = "3.0"
cc = "1.0"

[[bench]]
name = "lab_benches"
name = "matvec_benchmark"
harness = false
15 changes: 0 additions & 15 deletions russell_lab/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ _This crate is part of [Russell - Rust Scientific Library](https://github.com/cp
- [Matrix visualization](#matrix-visualization)
- [Computing eigenvalues and eigenvectors](#computing-eigenvalues-and-eigenvectors)
- [Cholesky factorization](#cholesky-factorization)
- [Simple discrete Fourier transform](#simple-discrete-fourier-transform)
- [About the column major representation](#about-the-column-major-representation)
- [Benchmarks](#benchmarks)
- [Jacobi Rotation versus LAPACK DSYEV](#jacobi-rotation-versus-lapack-dsyev)
Expand All @@ -48,7 +47,6 @@ The code is organized in modules:
* `algo` — algorithms that depend on the other modules (e.g, Lagrange interpolation)
* `base` — "base" functionality to help other modules
* `check` — functions to assist in unit and integration testing
* `fftw` — light interface to a few [FFTW](https://www.fftw.org/) routines. Warning: these routines are thread-unsafe
* `math` — mathematical (specialized) functions and constants
* `matrix`[NumMatrix] struct and associated functions
* `matvec` — functions operating on matrices and vectors
Expand Down Expand Up @@ -86,7 +84,6 @@ sudo apt-get install -y --no-install-recommends \
g++ \
gdb \
gfortran \
libfftw3-dev \
liblapacke-dev \
libmumps-seq-dev \
libopenblas-dev \
Expand Down Expand Up @@ -667,18 +664,6 @@ fn main() -> Result<(), StrError> {



### Simple discrete Fourier transform

Generate a signal with a 50 Hz sinusoid of amplitude 0.7 and a 120 Hz sinusoid of amplitude 1.0. Then, use [FFTW](https://www.fftw.org/) to determine the spectrum.

[See the code](https://github.com/cpmech/russell/tree/main/russell_lab/examples/fftw_simple_example.rs)

The output is illustrated below:

![Simple FFTw example](data/figures/fftw_simple_example.svg)



## About the column major representation

Only the COL-MAJOR representation is considered here.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ use criterion::BenchmarkId;
use criterion::Criterion;
use criterion::Throughput;
use criterion::{criterion_group, criterion_main};
use russell_lab::{mat_eigen_sym, mat_eigen_sym_jacobi, vec_add, Matrix, Vector};
use russell_lab::{mat_eigen_sym, mat_eigen_sym_jacobi, vec_add};
use russell_lab::{Matrix, Vector};

fn _bench_vec_add(c: &mut Criterion) {
let sizes = &[1, 4, 16, 32, 64, 128];
let mut group = c.benchmark_group("lab_vec_add");
fn bench_vec_add(c: &mut Criterion) {
// let sizes = &[1, 4, 16, 32, 64, 128];
let sizes = &[1];
let mut group = c.benchmark_group("vec_add");
for size in sizes {
group.throughput(Throughput::Elements(*size as u64));
group.bench_with_input(BenchmarkId::from_parameter(size), size, |b, &size| {
Expand All @@ -20,8 +22,9 @@ fn _bench_vec_add(c: &mut Criterion) {
}

fn bench_mat_eigen_sym(c: &mut Criterion) {
let sizes: Vec<usize> = (1..33).collect();
let mut group = c.benchmark_group("lab_mat_eigen_sym");
// let sizes: Vec<usize> = (1..33).collect();
let sizes = [1];
let mut group = c.benchmark_group("mat_eigen_sym");
for size in &sizes {
group.throughput(Throughput::Elements(*size as u64));
group.bench_with_input(BenchmarkId::new("JacobiRotation", size), size, |b, &size| {
Expand All @@ -39,6 +42,5 @@ fn bench_mat_eigen_sym(c: &mut Criterion) {
group.finish();
}

// criterion_group!(benches, bench_vec_add, bench_mat_eigen_sym);
criterion_group!(benches, bench_mat_eigen_sym);
criterion_group!(benches, bench_vec_add, bench_mat_eigen_sym);
criterion_main!(benches);
4 changes: 0 additions & 4 deletions russell_lab/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ fn handle_intel_mkl() {
}

fn main() {
// fftw and math functions
cc::Build::new().file("c_code/interface_fftw.c").compile("c_code");
println!("cargo:rustc-link-lib=fftw3");

// BLAS functions
handle_intel_mkl();
}
4 changes: 0 additions & 4 deletions russell_lab/c_code/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,3 @@
#define SVD_CODE_S 1
#define SVD_CODE_O 2
#define SVD_CODE_N 3

// Error codes
#define SUCCESSFUL_EXIT 0
#define UNKNOWN_ERROR 1
88 changes: 0 additions & 88 deletions russell_lab/c_code/interface_fftw.c

This file was deleted.

Loading

0 comments on commit 683bc2c

Please sign in to comment.