Skip to content

Commit

Permalink
Add execution space as a first argument of APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuuichi Asahi committed Dec 19, 2023
1 parent 0b2f651 commit b453a15
Show file tree
Hide file tree
Showing 6 changed files with 262 additions and 254 deletions.
8 changes: 4 additions & 4 deletions examples/01_1DFFT/01_1DFFT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ int main( int argc, char* argv[] ) {
Kokkos::Random_XorShift64_Pool<> random_pool(12345);
Kokkos::fill_random(xc2c, random_pool, I);

KokkosFFT::fft(xc2c, xc2c_hat);
KokkosFFT::ifft(xc2c_hat, xc2c_inv);
KokkosFFT::fft(execution_space(), xc2c, xc2c_hat);
KokkosFFT::ifft(execution_space(), xc2c_hat, xc2c_inv);

// 1D R2C FFT
View1D<double> xr2c("xr2c", n0);
View1D<Kokkos::complex<double> > xr2c_hat("xr2c_hat", n0/2+1);
Kokkos::fill_random(xr2c, random_pool, 1);

KokkosFFT::rfft(xr2c, xr2c_hat);
KokkosFFT::rfft(execution_space(), xr2c, xr2c_hat);

// 1D C2R FFT
View1D<Kokkos::complex<double> > xc2r("xr2c_hat", n0/2+1);
View1D<double> xc2r_hat("xc2r", n0);
Kokkos::fill_random(xc2r, random_pool, I);

KokkosFFT::irfft(xc2r, xc2r_hat);
KokkosFFT::irfft(execution_space(), xc2r, xc2r_hat);
}
Kokkos::finalize();

Expand Down
8 changes: 4 additions & 4 deletions examples/02_2DFFT/02_2DFFT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ int main( int argc, char* argv[] ) {
Kokkos::Random_XorShift64_Pool<> random_pool(12345);
Kokkos::fill_random(xc2c, random_pool, I);

KokkosFFT::fft2(xc2c, xc2c_hat);
KokkosFFT::ifft2(xc2c_hat, xc2c_inv);
KokkosFFT::fft2(execution_space(), xc2c, xc2c_hat);
KokkosFFT::ifft2(execution_space(), xc2c_hat, xc2c_inv);

// 2D R2C FFT
View2D<double> xr2c("xr2c", n0, n1);
View2D<Kokkos::complex<double> > xr2c_hat("xr2c_hat", n0, n1/2+1);
Kokkos::fill_random(xr2c, random_pool, 1);

KokkosFFT::rfft2(xr2c, xr2c_hat);
KokkosFFT::rfft2(execution_space(), xr2c, xr2c_hat);

// 2D C2R FFT
View2D<Kokkos::complex<double> > xc2r("xr2c_hat", n0, n1/2+1);
View2D<double> xc2r_hat("xc2r", n0, n1);
Kokkos::fill_random(xc2r, random_pool, I);

KokkosFFT::irfft2(xc2r, xc2r_hat);
KokkosFFT::irfft2(execution_space(), xc2r, xc2r_hat);
}
Kokkos::finalize();

Expand Down
8 changes: 4 additions & 4 deletions examples/03_NDFFT/03_NDFFT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ int main( int argc, char* argv[] ) {
Kokkos::Random_XorShift64_Pool<> random_pool(12345);
Kokkos::fill_random(xc2c, random_pool, I);

KokkosFFT::fftn(xc2c, xc2c_hat);
KokkosFFT::ifftn(xc2c_hat, xc2c_inv);
KokkosFFT::fftn(execution_space(), xc2c, xc2c_hat);
KokkosFFT::ifftn(execution_space(), xc2c_hat, xc2c_inv);

// 3D R2C FFT
View3D<double> xr2c("xr2c", n0, n1, n2);
View3D<Kokkos::complex<double> > xr2c_hat("xr2c_hat", n0, n1, n2/2+1);
Kokkos::fill_random(xr2c, random_pool, 1);

KokkosFFT::rfftn(xr2c, xr2c_hat);
KokkosFFT::rfftn(execution_space(), xr2c, xr2c_hat);

// 3D C2R FFT
View3D<Kokkos::complex<double> > xc2r("xr2c_hat", n0, n1, n2/2+1);
View3D<double> xc2r_hat("xc2r", n0, n1, n2);
Kokkos::fill_random(xc2r, random_pool, I);

KokkosFFT::irfftn(xc2r, xc2r_hat);
KokkosFFT::irfftn(execution_space(), xc2r, xc2r_hat);
}
Kokkos::finalize();

Expand Down
8 changes: 4 additions & 4 deletions examples/04_batchedFFT/04_batchedFFT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ int main( int argc, char* argv[] ) {
Kokkos::Random_XorShift64_Pool<> random_pool(12345);
Kokkos::fill_random(xc2c, random_pool, I);

KokkosFFT::fft(xc2c, xc2c_hat, KokkosFFT::Normalization::BACKWARD, /*axis=*/-1);
KokkosFFT::ifft(xc2c_hat, xc2c_inv, KokkosFFT::Normalization::BACKWARD, /*axis=*/-1);
KokkosFFT::fft(execution_space(), xc2c, xc2c_hat, KokkosFFT::Normalization::BACKWARD, /*axis=*/-1);
KokkosFFT::ifft(execution_space(), xc2c_hat, xc2c_inv, KokkosFFT::Normalization::BACKWARD, /*axis=*/-1);

// 1D batched R2C FFT
View3D<double> xr2c("xr2c", n0, n1, n2);
View3D<Kokkos::complex<double> > xr2c_hat("xr2c_hat", n0, n1, n2/2+1);
Kokkos::fill_random(xr2c, random_pool, 1);

KokkosFFT::rfft(xr2c, xr2c_hat, KokkosFFT::Normalization::BACKWARD, /*axis=*/-1);
KokkosFFT::rfft(execution_space(), xr2c, xr2c_hat, KokkosFFT::Normalization::BACKWARD, /*axis=*/-1);

// 1D batched C2R FFT
View3D<Kokkos::complex<double> > xc2r("xr2c_hat", n0, n1, n2/2+1);
View3D<double> xc2r_hat("xc2r", n0, n1, n2);
Kokkos::fill_random(xc2r, random_pool, I);

KokkosFFT::irfft(xc2r, xc2r_hat, KokkosFFT::Normalization::BACKWARD, /*axis=*/-1);
KokkosFFT::irfft(execution_space(), xc2r, xc2r_hat, KokkosFFT::Normalization::BACKWARD, /*axis=*/-1);
}
Kokkos::finalize();

Expand Down
Loading

0 comments on commit b453a15

Please sign in to comment.