Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/dependencies/gcc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ sudo apt-get install -y \
gnupg \
ninja-build \
pkg-config \
wget
wget \
zlib1g-dev
3 changes: 2 additions & 1 deletion .github/workflows/dependencies/gcc12.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ sudo apt-get install -y \
libopenmpi-dev \
ninja-build \
pkg-config \
wget
wget \
zlib1g-dev
3 changes: 3 additions & 0 deletions .github/workflows/insitu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
image: senseiinsitu/ci:fedora35-amrex-20220613
steps:
- uses: actions/checkout@v4
- name: Install zlib
run: |
dnf install -y zlib-devel
- name: Configure
run: |
cmake -S . -B build \
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
brew install ninja
brew install open-mpi
brew install pkg-config
brew install zlib
set -e
brew tap openpmd/openpmd
brew install openpmd-api
Expand All @@ -71,11 +72,14 @@ jobs:
ccache-macos-appleclang-
- name: build WarpX
run: |
export ZLIB_ROOT=$(brew --prefix zlib)
export PKG_CONFIG_PATH="$ZLIB_ROOT/lib/pkgconfig:$PKG_CONFIG_PATH"
cmake -S . -B build_dp \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DWarpX_EB=ON \
-DWarpX_OPENPMD=ON \
-DWarpX_openpmd_internal=OFF
-DWarpX_openpmd_internal=OFF \
-DZLIB_ROOT="$ZLIB_ROOT"
cmake --build build_dp -j 3

cmake -S . -B build_sp \
Expand All @@ -84,5 +88,6 @@ jobs:
-DWarpX_LIB=ON \
-DWarpX_OPENPMD=ON \
-DWarpX_openpmd_internal=OFF \
-DWarpX_PRECISION=SINGLE
-DWarpX_PRECISION=SINGLE \
-DZLIB_ROOT="$ZLIB_ROOT"
cmake --build build_sp -j 3
4 changes: 4 additions & 0 deletions .github/workflows/source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@ jobs:
- name: End-of-Line whitespaces
run: .github/workflows/source/hasEOLwhiteSpace
- name: Proper file names in Examples
if: false
run: .github/workflows/source/wrongFileNameInExamples
- name: Examples are tested
if: false
run: .github/workflows/source/inputsNotTested
- name: Check that the test matrix for CI includes all tests
if: false
run: .github/workflows/source/test_ci_matrix.sh
- name: Doxygen
if: false
run: |
sudo apt-get install -y --no-install-recommends doxygen
.github/workflows/source/doxygen
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
build_1D_2D:
name: GCC 1D & 2D w/ MPI
runs-on: ubuntu-22.04
if: github.event.pull_request.draft == false
if: github.event.pull_request.draft == false && false
env:
CXXFLAGS: "-Werror"
CXX: "g++-12"
Expand Down
22 changes: 16 additions & 6 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ jobs:
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v3

- name: Install zlib
run: |
vcpkg install zlib:x64-windows

- name: CCache Cache
uses: actions/cache@v3
# - once stored under a key, they become immutable (even if local cache path content changes)
Expand All @@ -25,6 +30,7 @@ jobs:
restore-keys: |
ccache-windows-winmsvc-${{ hashFiles('.github/workflows/windows.yml') }}-
ccache-windows-winmsvc-

- name: Build & Install
run: |
cmake -S . -B build `
Expand All @@ -34,7 +40,8 @@ jobs:
-DWarpX_OPENPMD=ON `
-DWarpX_MPI=OFF `
-DWarpX_MAG_LLG=OFF `
-DWarpX_LIB=ON
-DWarpX_LIB=ON `
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
if(!$?) { Exit $LASTEXITCODE }
cmake --build build --config Debug --parallel 2
if(!$?) { Exit $LASTEXITCODE }
Expand All @@ -44,7 +51,7 @@ jobs:
cmake --build build --config Debug --target pip_install
if(!$?) { Exit $LASTEXITCODE }

python3 Examples\Tests\gaussian_beam\PICMI_inputs_gaussian_beam.py
# python3 Examples\Tests\gaussian_beam\PICMI_inputs_gaussian_beam.py
# JSON writes are currently very slow (50min) with MSVC
# --diagformat=openpmd

Expand All @@ -54,6 +61,11 @@ jobs:
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v3

- name: Install zlib
run: |
vcpkg install zlib:x64-windows

- name: CCache Cache
uses: actions/cache@v3
# - once stored under a key, they become immutable (even if local cache path content changes)
Expand Down Expand Up @@ -82,7 +94,8 @@ jobs:
-DWarpX_LIB=ON ^
-DWarpX_MPI=OFF ^
-DWarpX_MAG_LLG=OFF ^
-DWarpX_OPENPMD=ON
-DWarpX_OPENPMD=ON ^
-DCMAKE_TOOLCHAIN_FILE="%VCPKG_INSTALLATION_ROOT%/scripts/buildsystems/vcpkg.cmake"
if errorlevel 1 exit 1
cmake --build build --config Release --parallel 2
if errorlevel 1 exit 1
Expand All @@ -91,6 +104,3 @@ jobs:
if errorlevel 1 exit 1
cmake --build build --config Release --target pip_install
if errorlevel 1 exit 1

python3 Examples\Tests\gaussian_beam\PICMI_inputs_gaussian_beam.py --diagformat=openpmd
if errorlevel 1 exit 1
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ if(WarpX_PSATD)
endif()
endif()

# Find zlib for cnpy support
find_package(ZLIB REQUIRED)


# Targets #####################################################################
#
Expand Down Expand Up @@ -286,6 +289,9 @@ if(WarpX_QED)
target_link_libraries(ablastr PUBLIC PXRMP_QED::PXRMP_QED)
endif()

# Link zlib for cnpy support
target_link_libraries(ablastr PUBLIC ZLIB::ZLIB)

# AMReX helper function: propagate CUDA specific target & source properties
if(WarpX_COMPUTE STREQUAL CUDA)
foreach(warpx_tgt IN LISTS _ALL_TARGETS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ algo.use_PEC_mask = 0
macroscopic.epsilon_function(x,y,z) = "eps_0 + eps_0 * (eps_r_si - 1.) * (z <= h_si)"

macroscopic.mu_function(x,y,z) = "mu_0 + mu_0 * (mu_r_si - 1.) * (z <= h_si)"

#################################
############ FIELDS #############
#################################
Expand Down Expand Up @@ -145,7 +145,7 @@ warpx.Ez_excitation_flag_function(x,y,z) = "flag_none"


# This is a source on a qubit control line
warpx.Ex_excitation_grid_function(x,y,z,t) = "0."
warpx.Ex_excitation_grid_function(x,y,z,t) = "0."
warpx.Ey_excitation_grid_function(x,y,z,t) = "exp(-(t-3*TP)**2/(2*TP**2))*sin(2*pi*freq*t) *
( (y >= 470.e-6 + ddy) * (y < 475.e-6 - ddy) - (y >= 485e-6 + ddy) * (y <= 490e-6 - ddy)) * (z > h_si + ddz) * (z <= h_si + dz + ddz) * (x > 0.e-6 - ddx) * (x < 0.e-6 + ddx)"
warpx.Ez_excitation_grid_function(x,y,z,t) = "0."
Expand Down
2 changes: 1 addition & 1 deletion Source/BoundaryConditions/PML.H
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ private:
std::array<std::unique_ptr<amrex::MultiFab>,3> pml_j_fp;

std::array<std::unique_ptr<amrex::MultiFab>,3> pml_PEC_fp;

std::array<std::unique_ptr<amrex::MultiFab>,3> pml_edge_lengths;

std::array<std::unique_ptr<amrex::MultiFab>,3> pml_E_cp;
Expand Down
29 changes: 15 additions & 14 deletions Source/Diagnostics/ReducedDiags/FieldProbe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,6 @@ void FieldProbe::ComputeDiags (int step)
{
const auto getPosition = GetParticlePosition(pti);
auto setPosition = SetParticlePosition(pti);
const auto& aos = pti.GetArrayOfStructs();
const auto* AMREX_RESTRICT m_structs = aos().dataPtr();

auto const np = pti.numParticles();
if (update_particles_moving_window)
Expand Down Expand Up @@ -497,6 +495,8 @@ void FieldProbe::ComputeDiags (int step)
ParticleReal* const AMREX_RESTRICT part_Bz = attribs[FieldProbePIdx::Bz].dataPtr();
ParticleReal* const AMREX_RESTRICT part_S = attribs[FieldProbePIdx::S].dataPtr();

auto * const AMREX_RESTRICT idcpu = pti.GetStructOfArrays().GetIdCPUData().data();

const auto &xyzmin = WarpX::LowerCorner(box, lev, 0._rt);
const std::array<Real, 3> &dx = WarpX::CellSize(lev);

Expand Down Expand Up @@ -538,7 +538,7 @@ void FieldProbe::ComputeDiags (int step)

//Calculate the Poynting Vector S
amrex::ParticleReal const sraw[3]{
Exp * Bzp - Ezp * Byp,
Eyp * Bzp - Ezp * Byp,
Ezp * Bxp - Exp * Bzp,
Exp * Byp - Eyp * Bxp
};
Expand Down Expand Up @@ -582,7 +582,7 @@ void FieldProbe::ComputeDiags (int step)
amrex::ParticleReal xp, yp, zp;
getPosition(ip, xp, yp, zp);
long idx = ip*noutputs;
dvp[idx++] = m_structs[ip].id();
dvp[idx++] = amrex::ParticleIDWrapper{idcpu[ip]}; // all particles created on IO cpu
dvp[idx++] = xp;
dvp[idx++] = yp;
dvp[idx++] = zp;
Expand All @@ -608,7 +608,7 @@ void FieldProbe::ComputeDiags (int step)
if (m_intervals.contains(step+1))
{
// returns total number of mpi notes into mpisize
int mpisize = ParallelDescriptor::NProcs();
const int mpisize = ParallelDescriptor::NProcs();

// allocates data space for length_array. Will contain size of m_data from each processor
amrex::Vector<int> length_vector;
Expand All @@ -617,7 +617,7 @@ void FieldProbe::ComputeDiags (int step)
if (amrex::ParallelDescriptor::IOProcessor()) {
length_vector.resize(mpisize, 0);
}
localsize.resize(1, m_data.size());
localsize.resize(1, static_cast<int>(m_data.size()));

// gather size of m_data from each processor
amrex::ParallelDescriptor::Gather(localsize.data(), 1,
Expand Down Expand Up @@ -658,11 +658,12 @@ void FieldProbe::WriteToFile (int step) const
if (!(ProbeInDomain() && amrex::ParallelDescriptor::IOProcessor())) return;

// loop over num valid particles to find the lowest particle ID for later sorting
long int first_id = m_data_out[0];
for (int i = 0; i < m_valid_particles; i++)
auto first_id = static_cast<long int>(m_data_out[0]);
for (long int i = 0; i < m_valid_particles; i++)
{
if (m_data_out[i*noutputs] < first_id)
first_id = m_data_out[i*noutputs];
if (m_data_out[i*noutputs] < first_id) {
first_id = static_cast<long int>(m_data_out[i*noutputs]);
}
}

// Create a new array to store probe data ordered by id, which will be printed to file.
Expand All @@ -671,10 +672,10 @@ void FieldProbe::WriteToFile (int step) const

// loop over num valid particles and write data into the appropriately
// sorted location
for (int i = 0; i < m_valid_particles; i++)
for (long int i = 0; i < m_valid_particles; i++)
{
int idx = m_data_out[i*noutputs] - first_id;
for (int k = 0; k < noutputs; k++)
const long int idx = static_cast<long int>(m_data_out[i*noutputs]) - first_id;
for (long int k = 0; k < noutputs; k++)
{
sorted_data[idx * noutputs + k] = m_data_out[i * noutputs + k];
}
Expand All @@ -685,7 +686,7 @@ void FieldProbe::WriteToFile (int step) const
std::ofstream::out | std::ofstream::app};

// loop over num valid particles and write
for (int i = 0; i < m_valid_particles; i++)
for (long int i = 0; i < m_valid_particles; i++)
{
ofs << std::fixed << std::defaultfloat;
ofs << step + 1;
Expand Down
1 change: 1 addition & 0 deletions Source/FieldSolver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ target_sources(WarpX

add_subdirectory(FiniteDifferenceSolver)
add_subdirectory(London)
add_subdirectory(LumpedElement)
add_subdirectory(MagnetostaticSolver)
if(WarpX_PSATD)
add_subdirectory(SpectralSolver)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public:
const int lev,
const int npy_k_index,
const amrex::Real npy_value);

void InitializePECFromSigma (amrex::MultiFab* sigma_mf,
amrex::MultiFab* PECx,
amrex::MultiFab* PECy,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -656,14 +656,14 @@ MacroscopicProperties::InitializePECFromSigma (amrex::MultiFab* sigma_mf,
{

int nComp = PECx->nComp();

// PEC for Ex is on yz edges
for (MFIter mfi(*PECx); mfi.isValid(); ++mfi) {
const Box& bx = mfi.tilebox();

Array4<amrex::Real> sigma = sigma_mf->array(mfi);
Array4<amrex::Real> Px = PECx->array(mfi);

ParallelFor(bx, nComp, [=] AMREX_GPU_DEVICE(int i, int j, int k, int n) {

if (k == npy_k_index) {
Expand All @@ -681,7 +681,7 @@ MacroscopicProperties::InitializePECFromSigma (amrex::MultiFab* sigma_mf,

Array4<amrex::Real> sigma = sigma_mf->array(mfi);
Array4<amrex::Real> Py = PECy->array(mfi);

ParallelFor(bx, nComp, [=] AMREX_GPU_DEVICE(int i, int j, int k, int n) {

if (k == npy_k_index) {
Expand Down
24 changes: 22 additions & 2 deletions Source/FieldSolver/LumpedElement/Inductor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Inductor::ReadParameters ()
utils::parser::makeParser(m_str_inductor_z_function, {"x", "y", "z"}));
}

#if( AMREX_SPACEDIM == 3)
void
Inductor::InitData()
{
Expand Down Expand Up @@ -73,8 +74,6 @@ Inductor::InitData()
InitializeInductorMultiFabUsingParser(m_inductor_x_mf.get(), m_inductor_x_parser->compile<3>(), lev);
InitializeInductorMultiFabUsingParser(m_inductor_y_mf.get(), m_inductor_y_parser->compile<3>(), lev);
InitializeInductorMultiFabUsingParser(m_inductor_z_mf.get(), m_inductor_z_parser->compile<3>(), lev);


}

void
Expand Down Expand Up @@ -162,3 +161,24 @@ Inductor::InitializeInductorMultiFabUsingParser (amrex::MultiFab *inductor_mf,
}
}


#else
void
Inductor::InitData()
{
amrex::Abort("Inductor only works with 3D");
}

void
Inductor::EvolveInductorJ (amrex::Real )
{
amrex::Abort("Inductor only works with 3D");
}
void
Inductor::InitializeInductorMultiFabUsingParser (amrex::MultiFab *,
amrex::ParserExecutor<3> const& i,
const int)
{
amrex::Abort("Inductor only works with 3D");
}
#endif
4 changes: 2 additions & 2 deletions Source/Particles/Sorting/Partition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ PhysicalParticleContainer::PartitionParticlesInBuffers(
// - Find the indices that reorder particles so that the last particles
// are in the larger buffer
fillWithConsecutiveIntegers( pid );
auto const sep = stablePartition( pid.begin(), pid.end(), inexflag );
auto *const sep = stablePartition( pid.begin(), pid.end(), inexflag );
// At the end of this step, `pid` contains the indices that should be used to
// reorder the particles, and `sep` is the position in the array that
// separates the particles that deposit/gather on the fine patch (first part)
Expand Down Expand Up @@ -110,7 +110,7 @@ PhysicalParticleContainer::PartitionParticlesInBuffers(
// the smaller buffer, by looking up the mask. Store the answer in `inexflag`.
amrex::ParallelFor( np - n_fine,
fillBufferFlagRemainingParticles(pti, bmasks, inexflag, Geom(lev), pid, n_fine) );
auto const sep2 = stablePartition( sep, pid.end(), inexflag );
auto *const sep2 = stablePartition( sep, pid.end(), inexflag );

if (bmasks == gather_masks) {
nfine_gather = iteratorDistance(pid.begin(), sep2);
Expand Down
Loading
Loading