forked from ECP-WarpX/WarpX
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' into add_feature_projection_div_cleaner
- Loading branch information
Showing
18 changed files
with
196 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* Copyright 2024 Axel Huebl | ||
* | ||
* This file is part of WarpX. | ||
* | ||
* License: BSD-3-Clause-LBNL | ||
*/ | ||
#ifndef WARPX_EB_ENABLED_H_ | ||
#define WARPX_EB_ENABLED_H_ | ||
|
||
#include <AMReX_ParmParse.H> | ||
|
||
namespace EB | ||
{ | ||
/** Are embedded boundaries enabled? */ | ||
bool enabled (); | ||
|
||
} // namespace EB | ||
#endif // WARPX_EB_ENABLED_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* Copyright 2024 Axel Huebl | ||
* | ||
* This file is part of WarpX. | ||
* | ||
* License: BSD-3-Clause-LBNL | ||
*/ | ||
#include "Enabled.H" | ||
|
||
#ifdef AMREX_USE_EB | ||
#include <AMReX_ParmParse.H> | ||
#endif | ||
#if defined(AMREX_USE_EB) && defined(WARPX_DIM_RZ) | ||
#include <stdexcept> | ||
#endif | ||
|
||
|
||
namespace EB | ||
{ | ||
bool enabled () | ||
{ | ||
#ifndef AMREX_USE_EB | ||
return false; | ||
#else | ||
amrex::ParmParse const pp_warpx("warpx"); | ||
amrex::ParmParse const pp_eb2("eb2"); | ||
|
||
// test various runtime options to enable EBs | ||
std::string eb_implicit_function; | ||
bool eb_enabled = pp_warpx.query("eb_implicit_function", eb_implicit_function); | ||
|
||
// https://amrex-codes.github.io/amrex/docs_html/EB.html | ||
std::string eb_stl; | ||
eb_enabled |= pp_eb2.query("geom_type", eb_stl); | ||
|
||
return eb_enabled; | ||
#endif | ||
} | ||
|
||
} // namespace EB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/* Copyright 2019-2023 | ||
* | ||
* This file is part of ABLASTR. | ||
* | ||
* License: BSD-3-Clause-LBNL | ||
*/ | ||
|
||
#include "AnyFFT.H" | ||
|
||
#include "ablastr/utils/TextMsg.H" | ||
#include "ablastr/profiler/ProfilerWrapper.H" | ||
|
||
#include <cstdint> | ||
|
||
namespace ablastr::math::anyfft | ||
{ | ||
|
||
void setup () {/*nothing to do*/} | ||
|
||
void cleanup () {/*nothing to do*/} | ||
|
||
FFTplan CreatePlan (const amrex::IntVect& real_size, amrex::Real * const real_array, | ||
Complex * const complex_array, const direction dir, const int dim) | ||
{ | ||
FFTplan fft_plan; | ||
ABLASTR_PROFILE("ablastr::math::anyfft::CreatePlan"); | ||
|
||
// Initialize fft_plan.m_plan with the vendor fft plan. | ||
std::vector<std::int64_t> strides(dim+1); | ||
if (dim == 3) { | ||
fft_plan.m_plan = new std::remove_pointer_t<VendorFFTPlan>( | ||
{std::int64_t(real_size[2]), | ||
std::int64_t(real_size[1]), | ||
std::int64_t(real_size[0])}); | ||
strides[0] = 0; | ||
strides[1] = real_size[0] * real_size[1]; | ||
strides[2] = real_size[0]; | ||
strides[3] = 1; | ||
} else if (dim == 2) { | ||
fft_plan.m_plan = new std::remove_pointer_t<VendorFFTPlan>( | ||
{std::int64_t(real_size[1]), | ||
std::int64_t(real_size[0])}); | ||
strides[0] = 0; | ||
strides[1] = real_size[0]; | ||
strides[2] = 1; | ||
} else if (dim == 1) { | ||
strides[0] = 0; | ||
strides[1] = 1; | ||
fft_plan.m_plan = new std::remove_pointer_t<VendorFFTPlan>( | ||
std::int64_t(real_size[0])); | ||
} else { | ||
ABLASTR_ABORT_WITH_MESSAGE("only dim2 =1, dim=2 and dim=3 have been implemented"); | ||
} | ||
|
||
fft_plan.m_plan->set_value(oneapi::mkl::dft::config_param::PLACEMENT, | ||
DFTI_NOT_INPLACE); | ||
fft_plan.m_plan->set_value(oneapi::mkl::dft::config_param::FWD_STRIDES, | ||
strides.data()); | ||
fft_plan.m_plan->commit(amrex::Gpu::Device::streamQueue()); | ||
|
||
// Store meta-data in fft_plan | ||
fft_plan.m_real_array = real_array; | ||
fft_plan.m_complex_array = complex_array; | ||
fft_plan.m_dir = dir; | ||
fft_plan.m_dim = dim; | ||
fft_plan.m_stream = amrex::Gpu::gpuStream(); | ||
|
||
return fft_plan; | ||
} | ||
|
||
void DestroyPlan (FFTplan& fft_plan) | ||
{ | ||
delete fft_plan.m_plan; | ||
} | ||
|
||
void Execute (FFTplan& fft_plan) | ||
{ | ||
if (!(fft_plan.m_stream == amrex::Gpu::gpuStream())) { | ||
amrex::Gpu::streamSynchronize(); | ||
} | ||
|
||
sycl::event r; | ||
if (fft_plan.m_dir == direction::R2C) { | ||
r = oneapi::mkl::dft::compute_forward( | ||
*fft_plan.m_plan, | ||
fft_plan.m_real_array, | ||
reinterpret_cast<std::complex<amrex::Real>*>(fft_plan.m_complex_array)); | ||
} else { | ||
r = oneapi::mkl::dft::compute_backward( | ||
*fft_plan.m_plan, | ||
reinterpret_cast<std::complex<amrex::Real>*>(fft_plan.m_complex_array), | ||
fft_plan.m_real_array); | ||
} | ||
r.wait(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters