Skip to content

Commit

Permalink
Merge branch 'development' of https://github.com/ECP-WarpX/WarpX into…
Browse files Browse the repository at this point in the history
… HSdevmerge_240304
  • Loading branch information
RevathiJambunathan committed Mar 5, 2024
2 parents 1efba85 + c4b1266 commit e0ce85e
Show file tree
Hide file tree
Showing 63 changed files with 539 additions and 571 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/clang_tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v4
- name: install dependencies
run: |
.github/workflows/dependencies/clang14.sh
.github/workflows/dependencies/clang15.sh
- name: set up cache
uses: actions/cache@v4
with:
Expand All @@ -32,8 +32,8 @@ jobs:
export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt
ccache -z
export CXX=$(which clang++)
export CC=$(which clang)
export CXX=$(which clang++-15)
export CC=$(which clang-15)
cmake -S . -B build_clang_tidy \
-DCMAKE_VERBOSE_MAKEFILE=ON \
Expand All @@ -51,7 +51,7 @@ jobs:
${{github.workspace}}/.github/workflows/source/makeMakefileForClangTidy.py --input ${{github.workspace}}/ccache.log.txt
make -j4 --keep-going -f clang-tidy-ccache-misses.mak \
CLANG_TIDY=clang-tidy \
CLANG_TIDY=clang-tidy-15 \
CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*"
ccache -s
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
which nvcc || echo "nvcc not in PATH!"
git clone https://github.com/AMReX-Codes/amrex.git ../amrex
cd ../amrex && git checkout --detach 2ecafcff40132f56eb2b494e1a374684ff97117a && cd -
cd ../amrex && git checkout --detach 3525b4a3f27eb64f746dd69b6613f71bb02d6e63 && cd -
make COMP=gcc QED=FALSE USE_MPI=TRUE USE_GPU=TRUE USE_OMP=FALSE USE_PSATD=TRUE USE_CCACHE=TRUE -j 4
ccache -s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ echo 'Acquire::Retries "3";' | sudo tee /etc/apt/apt.conf.d/80-retries
sudo apt-get -qqq update
sudo apt-get install -y \
cmake \
clang-14 \
clang-tidy-14 \
clang-15 \
clang-tidy-15 \
libblas-dev \
libc++-14-dev \
libc++-15-dev \
libboost-math-dev \
libfftw3-dev \
libfftw3-mpi-dev \
libhdf5-openmpi-dev \
liblapack-dev \
libopenmpi-dev \
libomp-dev \
libomp-15-dev \
ninja-build

# ccache
Expand Down
14 changes: 14 additions & 0 deletions Docs/source/developers/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@ For instance, compiling with ``clang++ -Werror`` would be:
export CXXFLAGS="-Werror"
Run Pre-Commit Tests Locally
----------------------------

When proposing code changes to Warpx, we perform a couple of automated stylistic and correctness checks on the code change.
You can run those locally before you push to save some time, install them once like this:

.. code-block:: sh
python -m pip install -U pre-commit
pre-commit install
See `pre-commit.com <https://pre-commit.com>`__ and our ``.pre-commit-config.yaml`` file in the repository for more details.


Run the test suite locally
--------------------------

Expand Down
8 changes: 4 additions & 4 deletions Docs/source/install/cmake.rst
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,11 @@ For PICMI Python bindings, configure WarpX to produce a library and call our ``p
.. code-block:: bash
# find dependencies & configure for all WarpX dimensionalities
cmake -S . -B build -DWarpX_DIMS="1;2;RZ;3" -DWarpX_PYTHON=ON
cmake -S . -B build_py -DWarpX_DIMS="1;2;RZ;3" -DWarpX_PYTHON=ON
# build and then call "python3 -m pip install ..."
cmake --build build --target pip_install -j 4
cmake --build build_py --target pip_install -j 4
**That's it!**
You can now :ref:`run a first 3D PICMI script <usage-picmi>` from our :ref:`examples <usage-examples>`.
Expand Down Expand Up @@ -324,10 +324,10 @@ This is the workflow most developers will prefer as it allows rapid re-compiles:
.. code-block:: bash
# build WarpX executables and libraries
cmake -S . -B build -DWarpX_DIMS="1;2;RZ;3" -DWarpX_PYTHON=ON
cmake -S . -B build_py -DWarpX_DIMS="1;2;RZ;3" -DWarpX_PYTHON=ON
# build & install Python only
cmake --build build -j 4 --target pip_install
cmake --build build_py -j 4 --target pip_install
There is also a ``--target pip_install_nodeps`` option that :ref:`skips pip-based dependency checks <developers-local-compile-pylto>`.

Expand Down
10 changes: 9 additions & 1 deletion Examples/Tests/particles_in_pml/analysis_particles_in_pml.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,16 @@
filename = sys.argv[1]
ds = yt.load( filename )

# When extracting the fields, choose the right dimensions
dimensions = [ n_pts for n_pts in ds.domain_dimensions ]
if ds.max_level == 1:
dimensions[0] *= 2
dimensions[1] *= 2
if ds.dimensionality == 3:
dimensions[2] *= 2

# Check that the field is low enough
ad0 = ds.covering_grid(level=0, left_edge=ds.domain_left_edge, dims=ds.domain_dimensions)
ad0 = ds.covering_grid(level=ds.max_level, left_edge=ds.domain_left_edge, dims=dimensions)
Ex_array = ad0[('mesh','Ex')].to_ndarray()
Ey_array = ad0[('mesh','Ey')].to_ndarray()
Ez_array = ad0[('mesh','Ez')].to_ndarray()
Expand Down
68 changes: 0 additions & 68 deletions Examples/Tests/particles_in_pml/analysis_particles_in_pml_2dmr.py

This file was deleted.

5 changes: 3 additions & 2 deletions Python/pywarpx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
# add anything in PATH
paths = os.environ.get("PATH", "")
for p in paths.split(";"):
if os.path.exists(p):
os.add_dll_directory(p)
p_abs = os.path.abspath(os.path.expanduser(os.path.expandvars(p)))
if os.path.exists(p_abs):
os.add_dll_directory(p_abs)

from .Algo import algo
from .Amr import amr
Expand Down
2 changes: 1 addition & 1 deletion Regression/WarpX-GPU-tests.ini
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ emailBody = Check https://ccse.lbl.gov/pub/GpuRegressionTesting/WarpX/ for more

[AMReX]
dir = /home/regtester/git/amrex/
branch = 2ecafcff40132f56eb2b494e1a374684ff97117a
branch = 3525b4a3f27eb64f746dd69b6613f71bb02d6e63

[source]
dir = /home/regtester/git/WarpX
Expand Down
4 changes: 2 additions & 2 deletions Regression/WarpX-tests.ini
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ emailBody = Check https://ccse.lbl.gov/pub/RegressionTesting/WarpX/ for more det

[AMReX]
dir = /home/regtester/AMReX_RegTesting/amrex/
branch = 2ecafcff40132f56eb2b494e1a374684ff97117a
branch = 3525b4a3f27eb64f746dd69b6613f71bb02d6e63

[source]
dir = /home/regtester/AMReX_RegTesting/warpx
Expand Down Expand Up @@ -2525,7 +2525,7 @@ numthreads = 1
compileTest = 0
doVis = 0
compareParticles = 0
analysisRoutine = Examples/Tests/particles_in_pml/analysis_particles_in_pml_2dmr.py
analysisRoutine = Examples/Tests/particles_in_pml/analysis_particles_in_pml.py

[particles_in_pml_3d_MR]
buildDir = .
Expand Down
2 changes: 1 addition & 1 deletion Source/AcceleratorLattice/AcceleratorLattice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,6 @@ AcceleratorLattice::UpdateElementFinder (int const lev) // NOLINT(readability-ma
LatticeElementFinderDevice
AcceleratorLattice::GetFinderDeviceInstance (WarpXParIter const& a_pti, int const a_offset) const
{
LatticeElementFinder & finder = (*m_element_finder)[a_pti];
const LatticeElementFinder & finder = (*m_element_finder)[a_pti];
return finder.GetFinderDeviceInstance(a_pti, a_offset, *this);
}
4 changes: 2 additions & 2 deletions Source/BoundaryConditions/WarpX_PEC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ PEC::ApplyPECtoElectronPressure (amrex::MultiFab* Pefield, const int lev,

amrex::Box domain_box = warpx.Geom(lev).Domain();
if (patch_type == PatchType::coarse) {
amrex::IntVect ref_ratio = ( (lev > 0) ? WarpX::RefRatio(lev-1) : amrex::IntVect(1) );
const amrex::IntVect ref_ratio = ( (lev > 0) ? WarpX::RefRatio(lev-1) : amrex::IntVect(1) );
domain_box.coarsen(ref_ratio);
}
domain_box.convert(Pefield->ixType());
Expand Down Expand Up @@ -552,7 +552,7 @@ PEC::ApplyPECtoElectronPressure (amrex::MultiFab* Pefield, const int lev,
amrex::ignore_unused(j,k);
#endif
// Store the array index
amrex::IntVect iv(AMREX_D_DECL(i,j,k));
const amrex::IntVect iv(AMREX_D_DECL(i,j,k));

PEC::SetNeumannOnPEC(n, iv, Pe_array, mirrorfac, is_pec, fabbox);
});
Expand Down
6 changes: 3 additions & 3 deletions Source/Diagnostics/BTDiagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ BTDiagnostics::DefineFieldBufferMultiFab (const int i_buffer, const int lev)
const int hi_k_lab = m_buffer_k_index_hi[i_buffer];
m_buffer_box[i_buffer].setSmall( m_moving_window_dir, hi_k_lab - m_buffer_size + 1);
m_buffer_box[i_buffer].setBig( m_moving_window_dir, hi_k_lab );
amrex::BoxArray buffer_ba( m_buffer_box[i_buffer] );
const amrex::BoxArray buffer_ba( m_buffer_box[i_buffer] );
// Generate a new distribution map for the back-transformed buffer multifab
const amrex::DistributionMapping buffer_dmap(buffer_ba);
// Number of guard cells for the output buffer is zero.
Expand Down Expand Up @@ -1040,7 +1040,7 @@ BTDiagnostics::Flush (int i_buffer, bool force_flush)
m_buffer_box[i_buffer].setSmall(m_moving_window_dir, (m_buffer_box[i_buffer].smallEnd(m_moving_window_dir) - 1) );
m_buffer_box[i_buffer].setBig(m_moving_window_dir, (m_buffer_box[i_buffer].bigEnd(m_moving_window_dir) + 1) );
const amrex::Box particle_buffer_box = m_buffer_box[i_buffer];
amrex::BoxArray buffer_ba( particle_buffer_box );
const amrex::BoxArray buffer_ba( particle_buffer_box );
m_particles_buffer[i_buffer][0]->SetParticleBoxArray(0, buffer_ba);
for (int isp = 0; isp < m_particles_buffer.at(i_buffer).size(); ++isp) {
// BTD output is single level. Setting particle geometry, dmap, boxarray to level0
Expand Down Expand Up @@ -1467,7 +1467,7 @@ BTDiagnostics::PrepareParticleDataForOutput()
DefineFieldBufferMultiFab(i_buffer, lev);
}
const amrex::Box particle_buffer_box = m_buffer_box[i_buffer];
amrex::BoxArray buffer_ba( particle_buffer_box );
const amrex::BoxArray buffer_ba( particle_buffer_box );
const amrex::DistributionMapping buffer_dmap(buffer_ba);
m_particles_buffer[i_buffer][i]->SetParticleBoxArray(lev, buffer_ba);
m_particles_buffer[i_buffer][i]->SetParticleDistributionMap(lev, buffer_dmap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ BackTransformFunctor::operator ()(amrex::MultiFab& mf_dst, int /*dcomp*/, const
slice_box.setBig(moving_window_dir, i_boost);

// Make it a BoxArray
amrex::BoxArray slice_ba(slice_box);
const amrex::BoxArray slice_ba(slice_box);
// Define MultiFab with the distribution map of the destination multifab and
// containing all ten components that were in the slice generated from m_mf_src.
std::unique_ptr< amrex::MultiFab > tmp_slice_ptr = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ FlushFormatPlotfile::WriteWarpXHeader(

warpx.GetPartContainer().WriteHeader(HeaderFile);

MultiParticleContainer& mypc = warpx.GetPartContainer();
const MultiParticleContainer& mypc = warpx.GetPartContainer();
const int n_species = mypc.nSpecies();
for (int i=0; i<n_species; i++)
{
Expand Down
4 changes: 2 additions & 2 deletions Source/Diagnostics/FullDiagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ using namespace amrex::literals;
FullDiagnostics::FullDiagnostics (int i, std::string name):
Diagnostics{i, name},
m_solver_deposits_current{
!(WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::None &&
WarpX::electrostatic_solver_id != ElectrostaticSolverAlgo::LabFrameElectroMagnetostatic)}
(WarpX::electromagnetic_solver_id != ElectromagneticSolverAlgo::None) ||
(WarpX::electrostatic_solver_id == ElectrostaticSolverAlgo::LabFrameElectroMagnetostatic)}
{
ReadParameters();
BackwardCompatibility();
Expand Down
6 changes: 3 additions & 3 deletions Source/Diagnostics/ReducedDiags/ColliderRelevant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ ColliderRelevant::ColliderRelevant (std::string rd_name)
: ReducedDiags{std::move(rd_name)}
{
// read colliding species names - must be 2
amrex::ParmParse pp_rd_name(m_rd_name);
const amrex::ParmParse pp_rd_name(m_rd_name);
pp_rd_name.getarr("species", m_beam_name);

WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
Expand Down Expand Up @@ -203,7 +203,7 @@ void ColliderRelevant::ComputeDiags (int step)

// get cell volume
amrex::Geometry const & geom = warpx.Geom(0);
amrex::Real dV = AMREX_D_TERM(geom.CellSize(0), *geom.CellSize(1), *geom.CellSize(2));
const amrex::Real dV = AMREX_D_TERM(geom.CellSize(0), *geom.CellSize(1), *geom.CellSize(2));

const auto get_idx = [&](const std::string& name){
return m_headers_indices.at(name).idx;
Expand Down Expand Up @@ -544,7 +544,7 @@ void ColliderRelevant::ComputeDiags (int step)

// make density MultiFabs from nodal to cell centered
amrex::BoxArray ba = warpx.boxArray(0);
amrex::DistributionMapping dmap = warpx.DistributionMap(0);
const amrex::DistributionMapping dmap = warpx.DistributionMap(0);
constexpr int ncomp = 1;
constexpr int ngrow = 0;
amrex::MultiFab mf_dst1(ba.convert(amrex::IntVect::TheCellVector()), dmap, ncomp, ngrow);
Expand Down
2 changes: 1 addition & 1 deletion Source/Diagnostics/ReducedDiags/FieldReduction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ FieldReduction::FieldReduction (std::string rd_name)

void FieldReduction::BackwardCompatibility ()
{
amrex::ParmParse pp_rd_name(m_rd_name);
const amrex::ParmParse pp_rd_name(m_rd_name);
std::vector<std::string> backward_strings;
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
!pp_rd_name.queryarr("reduced_function(x,y,z,Ex,Ey,Ez,Bx,By,Bz)", backward_strings),
Expand Down
6 changes: 4 additions & 2 deletions Source/Diagnostics/ReducedDiags/ParticleHistogram2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,12 @@ void ParticleHistogram2D::WriteToFile (int step) const
const std::string fileSuffix = std::string("_%0") + std::to_string(m_file_min_digits) + std::string("T");
filename = filename.append(fileSuffix).append(".").append(m_openpmd_backend);

std::string filepath = m_path + m_rd_name + "/" + filename;
// transform paths for Windows
#ifdef _WIN32
filepath = openPMD::auxiliary::replace_all(filepath, "/", "\\");
const std::string filepath = openPMD::auxiliary::replace_all(
m_path + m_rd_name + "/" + filename, "/", "\\");
#else
const std::string filepath = m_path + m_rd_name + "/" + filename;
#endif

// Create the OpenPMD series
Expand Down
4 changes: 2 additions & 2 deletions Source/Diagnostics/ReducedDiags/ReducedDiags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ReducedDiags::ReducedDiags (std::string rd_name)
std::string restart_chkfile;
const ParmParse pp_amr("amr");
pp_amr.query("restart", restart_chkfile);
bool IsNotRestart = restart_chkfile.empty();
const bool IsNotRestart = restart_chkfile.empty();

if (ParallelDescriptor::IOProcessor())
{
Expand All @@ -50,7 +50,7 @@ ReducedDiags::ReducedDiags (std::string rd_name)
{ amrex::CreateDirectoryFailed(m_path); }

// replace / create output file
std::string rd_full_file_name = m_path + m_rd_name + "." + m_extension;
const std::string rd_full_file_name = m_path + m_rd_name + "." + m_extension;
m_write_header = IsNotRestart || !amrex::FileExists(rd_full_file_name); // not a restart or file doesn't exist
if (m_write_header)
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Diagnostics/WarpXOpenPMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ WarpXOpenPMDPlot::DumpToFile (ParticleContainer* pc,
openPMD::ParticleSpecies currSpecies = currIteration.particles[name];

// only BTD writes multiple times into the same step, zero for other methods
unsigned long ParticleFlushOffset = isBTD ? num_already_flushed(currSpecies) : 0;
const unsigned long ParticleFlushOffset = isBTD ? num_already_flushed(currSpecies) : 0;

// prepare data structures the first time BTD has non-zero particles
// we set some of them to zero extent, so we need to time that well
Expand Down
Loading

0 comments on commit e0ce85e

Please sign in to comment.