Skip to content

Commit

Permalink
Begin cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
skailasa committed Dec 14, 2023
1 parent 7fb10cd commit a7e2e5e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 32 deletions.
1 change: 0 additions & 1 deletion field/src/fft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use fftw::{plan::*, types::*};
use num::Complex;
use rayon::prelude::*;

use crate::types::{FftMatrixc32, FftMatrixc64, FftMatrixf32, FftMatrixf64};

pub trait Fft
where
Expand Down
2 changes: 1 addition & 1 deletion field/src/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use crate::{
fft::Fft,
transfer_vector::compute_transfer_vectors,
types::{
FftFieldTranslationKiFmm, FftM2lOperatorData, FftMatrix, SvdFieldTranslationKiFmm,
FftFieldTranslationKiFmm, FftM2lOperatorData, SvdFieldTranslationKiFmm,
SvdM2lOperatorData, TransferVector,
},
};
Expand Down
19 changes: 0 additions & 19 deletions field/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,22 +127,3 @@ where
}
}

/// Type alias for real coefficients for into FFTW wrappers
// pub type FftMatrixf64 = Matrix<f64, BaseMatrix<f64, VectorContainer<f64>, Dynamic>, Dynamic>;
pub type FftMatrixf64 = Vec<f64>;

/// Type alias for real coefficients for into FFTW wrappers
// pub type FftMatrixf32 = Matrix<f32, BaseMatrix<f32, VectorContainer<f32>, Dynamic>, Dynamic>;
pub type FftMatrixf32 = Vec<f32>;

/// Type alias for complex coefficients for FFTW wrappers
// pub type FftMatrixc64 = Matrix<c64, BaseMatrix<c64, VectorContainer<c64>, Dynamic>, Dynamic>;
pub type FftMatrixc64 = Vec<c64>;

/// Type alias for complex coefficients for FFTW wrappers
// pub type FftMatrixc32 = Matrix<c32, BaseMatrix<c32, VectorContainer<c32>, Dynamic>, Dynamic>;
pub type FftMatrixc32 = Vec<c32>;

/// Type alias for real coefficients for into FFTW wrappers
// pub type FftMatrix<T> = Matrix<T, BaseMatrix<T, VectorContainer<T>, Dynamic>, Dynamic>;
pub type FftMatrix<T> = Vec<T>;
2 changes: 1 addition & 1 deletion fmm/src/field_translation/hashmap/source_to_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use rayon::prelude::*;
use bempp_field::{
array::pad3,
fft::Fft,
types::{FftFieldTranslationKiFmm, FftMatrix, SvdFieldTranslationKiFmm},
types::{FftFieldTranslationKiFmm, SvdFieldTranslationKiFmm},
};

use bempp_traits::{
Expand Down
16 changes: 7 additions & 9 deletions fmm/src/field_translation/linear/source_to_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use std::{
use bempp_field::{
array::pad3,
fft::Fft,
types::{FftFieldTranslationKiFmm, FftMatrix, SvdFieldTranslationKiFmm},
types::{FftFieldTranslationKiFmm, SvdFieldTranslationKiFmm},
};

use bempp_traits::{
Expand Down Expand Up @@ -338,7 +338,7 @@ where
let Some(targets) = self.fmm.tree().get_keys(level) else {
return;
};
let s = Instant::now();
// let s = Instant::now();
// Form signals to use for convolution first
let n = 2 * self.fmm.order - 1;
let ntargets = targets.len();
Expand Down Expand Up @@ -449,7 +449,7 @@ where
let ptr = check_potentials_hat_f_buffer.as_mut_ptr() as *mut Complex<U>;
check_potentials_hat_f = std::slice::from_raw_parts_mut(ptr, size_real * ntargets);
}
println!("l={:?} Pre processing time {:?}", level, s.elapsed());
// println!("l={:?} Pre processing time {:?}", level, s.elapsed());

// // Test that the signals in frequency order are correct
// if level == 3 {
Expand All @@ -461,7 +461,7 @@ where
////////////////////////////////////////////////////////////////////////////////////
let zeros = vec![Complex::<U>::zero(); nsiblings];
let scale = Complex::from(self.m2l_scale(level));
let s = Instant::now();
// let s = Instant::now();
let kernel_data_halo = &self.fmm.m2l.operator_data.kernel_data_rearranged;
(0..size_real)
.into_par_iter()
Expand Down Expand Up @@ -498,14 +498,12 @@ where
// if level == 2 {
// println!("check_potentials_hat_f {:?}", &check_potentials_hat_f[ntargets..2*ntargets]);
// }
println!("l={:?} kernel time {:?}", level, s.elapsed());
// println!("l={:?} kernel time {:?}", level, s.elapsed());
////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////
let s = Instant::now();
// let s = Instant::now();

let level_locals = &self.level_locals[level as usize];

// First step is to get check potentials back into target order from frequency order
let mut check_potential_hat = vec![U::zero(); size_real * ntargets * 2];
let mut check_potential = vec![U::zero(); size * ntargets];
Expand Down Expand Up @@ -568,7 +566,7 @@ where

});

println!("l={:?} post processing time {:?}", level, s.elapsed());
// println!("l={:?} post processing time {:?}", level, s.elapsed());
////////////////////////////////////////////////////////////////////////////////////
}

Expand Down
4 changes: 3 additions & 1 deletion fmm/src/fmm/linear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,9 @@ mod test {

let datatree = FmmDataLinear::new(fmm, &charge_dict).unwrap();

datatree.run(false);
let s = Instant::now();
let times = datatree.run(true);
println!("runtime {:?}, operator times {:?}", s.elapsed(), times);

// Test that direct computation is close to the FMM.
let leaf = &datatree.fmm.tree.get_all_leaves().unwrap()[0];
Expand Down

0 comments on commit a7e2e5e

Please sign in to comment.