Skip to content

Commit

Permalink
Merge pull request ComputationalRadiationPhysics#3323 from psychocode…
Browse files Browse the repository at this point in the history
…rHPC/topic-reduceExampleComplexity

reduce example complexity
  • Loading branch information
sbastrakov authored Aug 10, 2020
2 parents 867a3c1 + d2b65c0 commit 360f616
Show file tree
Hide file tree
Showing 31 changed files with 1,379 additions and 97 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test-rebase-to-mainline:
# "examples/KelvinHelmholtz" compile all cases within one gitlab job
generate-reduced-matrix:
variables:
PIC_INPUTS: "examples"
PIC_INPUTS: "examples tests"
TEST_TUPLE_NUM_ELEM: 1
extends: ".base_generate-reduced-matrix"

Expand Down
5 changes: 0 additions & 5 deletions share/picongpu/examples/KelvinHelmholtz/cmakeFlags
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@
flags[0]=""
flags[1]="-DPARAM_OVERWRITES:LIST='-DPARAM_DIMENSION=DIM2'"
flags[2]="-DPARAM_OVERWRITES:LIST='-DPARAM_RADIATION=1'"
flags[3]="-DPARAM_OVERWRITES:LIST='-DPARAM_CURRENTSOLVER=EmZ<UsedParticleShape>;-DPARAM_PARTICLESHAPE=CIC'"
flags[4]="-DPARAM_OVERWRITES:LIST='-DPARAM_CURRENTSOLVER=EmZ<UsedParticleShape>;-DPARAM_PARTICLESHAPE=PCS'"
flags[5]="-DPARAM_OVERWRITES:LIST='-DPARAM_CURRENTSOLVER=EmZ<UsedParticleShape>;-DPARAM_PARTICLESHAPE=TSC'"
flags[6]="-DPARAM_OVERWRITES:LIST='-DPARAM_CURRENTSOLVER=EmZ<UsedParticleShape>;-DPARAM_PARTICLESHAPE=TSC;-DPARAM_DIMENSION=DIM2'"
flags[7]="-DPARAM_OVERWRITES:LIST='-DPARAM_FIELDSOLVER=DirSplitting;-DPARAM_CURRENTINTERPOLATION=NoneDS'"


################################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ namespace fields
* - experimental assignment for all-centered/directional splitting
* - updates E & B at the same time
*/
#ifndef PARAM_CURRENTINTERPOLATION
# define PARAM_CURRENTINTERPOLATION None
#endif
using CurrentInterpolation = currentInterpolation::PARAM_CURRENTINTERPOLATION;
using CurrentInterpolation = currentInterpolation::None;

/** FieldSolver
*
Expand All @@ -72,7 +69,7 @@ namespace fields
* - None< CurrentInterpolation >: disable the vacuum update of E and B
*/

using Solver = maxwellSolver::PARAM_FIELDSOLVER< CurrentInterpolation >;
using Solver = maxwellSolver::Yee< CurrentInterpolation >;

} // namespace fields
} // namespace picongpu
Original file line number Diff line number Diff line change
Expand Up @@ -34,53 +34,9 @@ namespace picongpu
/** equals X
* unit: meter */

#ifndef PARAM_FIELDSOLVER
# define PARAM_FIELDSOLVER Yee
#endif

#define DirSplitting 1

#if( PMACC_CUDA_ENABLED != 1 )
/* DirSplitting is only available for the CUDA accelerator.
* Automatically switch back to Yee when we compile for non CUDA accelerator.
*/
# if (PARAM_FIELDSOLVER == 1)
# warning "DirSplitting is only for CUDA available, solver will be set to Yee."
# warning "CurrentInterpolation solver will be set to None."
// rest current interpolation
# ifdef PARAM_CURRENTINTERPOLATION
# undef PARAM_CURRENTINTERPOLATION
# endif
# define PARAM_CURRENTINTERPOLATION None
# undef DirSplitting
// switch to the field solver Yee
# undef PARAM_FIELDSOLVER
# define PARAM_FIELDSOLVER Yee
// define DirSplitting to two to force cell size calculation based on Yee solver conditions
# define DirSplitting 2
# endif
#endif
// check if DirSplitting is activated
#if (PARAM_FIELDSOLVER == 1)
/* THIS CODE PATH IS ONLY USED IF `PARAM_FIELDSOLVER` IS CHANGED IN
* `cmakeFlags` and the field solver there is set to fieldSolverDirSplitting
*
* Directional Splitting requires a fixed ratio between dt and dx
* and in addition cubic cells.
* conditions: dX == dt * c
* dX == dY
* dX == dZ
*/
constexpr float_64 CELL_WIDTH_SI = DELTA_T_SI*SPEED_OF_LIGHT_SI;
#else
/* cell size for Yee solver (must fulfill CFL)
* WARNING: if you change the field solver in `componentsConfig` you
* have to change the CELL_SIZE in this code path
*/
/** equals X
* unit: meter */
constexpr float_64 CELL_WIDTH_SI = 9.34635e-8;
#endif
#undef DirSplitting

/** equals Y
* unit: meter */
constexpr float_64 CELL_HEIGHT_SI = CELL_WIDTH_SI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ namespace picongpu
*
* example: using UsedParticleShape = particles::shapes::CIC;
*/
#ifndef PARAM_PARTICLESHAPE
#define PARAM_PARTICLESHAPE TSC
#endif
using UsedParticleShape = particles::shapes::PARAM_PARTICLESHAPE;
using UsedParticleShape = particles::shapes::TSC;

/* define which interpolation method is used to interpolate fields to particle*/
using UsedField2Particle = FieldToParticleInterpolation< UsedParticleShape, AssignedTrilinearInterpolation >;
Expand All @@ -62,10 +59,7 @@ using UsedField2Particle = FieldToParticleInterpolation< UsedParticleShape, Assi
* - currentSolver::strategy::CachedSupercells
* - currentSolver::strategy::NonCachedSupercells
*/
#ifndef PARAM_CURRENTSOLVER
#define PARAM_CURRENTSOLVER Esirkepov<UsedParticleShape>
#endif
using UsedParticleCurrentSolver = currentSolver::PARAM_CURRENTSOLVER;
using UsedParticleCurrentSolver = currentSolver::Esirkepov<UsedParticleShape>;

/*! particle pusher configuration ----------------------------------------------
*
Expand Down
11 changes: 2 additions & 9 deletions share/picongpu/examples/LaserWakefield/cmakeFlags
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,8 @@
# - increase by 1, no gaps

flags[0]=""
flags[1]="-DPARAM_OVERWRITES:LIST='-DPARAM_FIELDSOLVER=Lehe;-DPARAM_PARTICLEPUSHER=Vay'"
flags[2]="-DPARAM_OVERWRITES:LIST='-DPARAM_CURRENTSOLVER=Esirkepov;-DPARAM_PARTICLESHAPE=CIC'"
flags[3]="-DPARAM_OVERWRITES:LIST='-DPARAM_CURRENTSOLVER=VillaBune;-DPARAM_PARTICLESHAPE=CIC'"
flags[4]="-DPARAM_OVERWRITES:LIST='-DPARAM_PRECISION=precision64Bit'"
flags[5]="-DPARAM_OVERWRITES:LIST='-DPARAM_DIMENSION=DIM2'"
flags[6]="-DPARAM_OVERWRITES:LIST='-DPARAM_CURRENTSOLVER=Esirkepov;-DPARAM_PARTICLESHAPE=CIC;-DPARAM_DIMENSION=DIM2'"
flags[7]="-DPARAM_OVERWRITES:LIST='-DPARAM_PRECISION=precision64Bit;-DPARAM_DIMENSION=DIM2'"
flags[8]="-DPARAM_OVERWRITES:LIST='-DPARAM_DIMENSION=DIM2'"
flags[9]="-DPARAM_OVERWRITES:LIST='-DPARAM_IONS=1;-DPARAM_IONIZATION=1'"
flags[1]="-DPARAM_OVERWRITES:LIST='-DPARAM_DIMENSION=DIM2'"
flags[2]="-DPARAM_OVERWRITES:LIST='-DPARAM_IONS=1;-DPARAM_IONIZATION=1'"

################################################################################
# execution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,8 @@ namespace fields
* - experimental assignment for all-centered/directional splitting
* - updates E & B at the same time
*/
#ifndef PARAM_CURRENTINTERPOLATION
# define PARAM_CURRENTINTERPOLATION None
#endif
using CurrentInterpolation = currentInterpolation::PARAM_CURRENTINTERPOLATION;

using CurrentInterpolation = currentInterpolation::None;

/** FieldSolver
*
Expand All @@ -72,13 +70,7 @@ namespace fields
* - None< CurrentInterpolation >: disable the vacuum update of E and B
*/

#ifndef PARAM_FIELDSOLVER
/* WARNING: if you change field solver by hand please update your CELL_WIDTH_SI
* in `grid.param` to fulfill the convergence condition (CFL)
*/
# define PARAM_FIELDSOLVER Yee
#endif
using Solver = maxwellSolver::PARAM_FIELDSOLVER< CurrentInterpolation >;
using Solver = maxwellSolver::Yee< CurrentInterpolation >;

} // namespace fields
} // namespace picongpu
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ namespace picongpu
*
* example: using UsedParticleShape = particles::shapes::CIC;
*/
#ifndef PARAM_PARTICLESHAPE
#define PARAM_PARTICLESHAPE TSC
#endif
using UsedParticleShape = particles::shapes::PARAM_PARTICLESHAPE;
using UsedParticleShape = particles::shapes::TSC;

/* define which interpolation method is used to interpolate fields to particle*/
using UsedField2Particle = FieldToParticleInterpolation< UsedParticleShape, AssignedTrilinearInterpolation >;
Expand All @@ -62,10 +59,7 @@ using UsedField2Particle = FieldToParticleInterpolation< UsedParticleShape, Assi
* - currentSolver::strategy::CachedSupercells
* - currentSolver::strategy::NonCachedSupercells
*/
#ifndef PARAM_CURRENTSOLVER
#define PARAM_CURRENTSOLVER Esirkepov
#endif
using UsedParticleCurrentSolver = currentSolver::PARAM_CURRENTSOLVER< UsedParticleShape >;
using UsedParticleCurrentSolver = currentSolver::Esirkepov< UsedParticleShape >;

/*! particle pusher configuration ----------------------------------------------
*
Expand All @@ -87,9 +81,6 @@ using UsedParticleCurrentSolver = currentSolver::PARAM_CURRENTSOLVER< UsedPartic
* For development purposes: --------------------------------------------------
* - particles::pusher::Axel : a pusher developed at HZDR during 2011 (testing)
*/
#ifndef PARAM_PARTICLEPUSHER
#define PARAM_PARTICLEPUSHER Boris
#endif
using UsedParticlePusher = particles::pusher::PARAM_PARTICLEPUSHER;
using UsedParticlePusher = particles::pusher::Boris;

}//namespace picongpu
5 changes: 5 additions & 0 deletions share/picongpu/tests/compileCurrentSolver/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Compile Test for Selected Species Solver
========================================

This test compiles current solver for different partcle shapes.
Particle pusher are checked in the example SingleParticleTest.
50 changes: 50 additions & 0 deletions share/picongpu/tests/compileCurrentSolver/cmakeFlags
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
#
# Copyright 2013-2020 Axel Huebl, Rene Widera
#
# This file is part of PIConGPU.
#
# PIConGPU is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# PIConGPU is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with PIConGPU.
# If not, see <http://www.gnu.org/licenses/>.
#

#
# generic compile options
#

################################################################################
# add presets here
# - default: index 0
# - start with zero index
# - increase by 1, no gaps

flags[0]="-DPARAM_OVERWRITES:LIST='-DPARAM_CURRENTSOLVER=EmZ<UsedParticleShape>;-DPARAM_PARTICLESHAPE=PCS'"
flags[1]="-DPARAM_OVERWRITES:LIST='-DPARAM_CURRENTSOLVER=EmZ<UsedParticleShape>;-DPARAM_PARTICLESHAPE=P4S;-DPARAM_DIMENSION=DIM2'"
# Esirkepov and TSC is tested in most examples
flags[2]="-DPARAM_OVERWRITES:LIST='-DPARAM_CURRENTSOLVER=Esirkepov<UsedParticleShape>;-DPARAM_PARTICLESHAPE=CIC'"
flags[3]="-DPARAM_OVERWRITES:LIST='-DPARAM_CURRENTSOLVER=Esirkepov<UsedParticleShape>;-DPARAM_PARTICLESHAPE=PCS;-DPARAM_DIMENSION=DIM2'"
flags[4]="-DPARAM_OVERWRITES:LIST='-DPARAM_CURRENTSOLVER=VillaBune<>;-DPARAM_PARTICLESHAPE=CIC'"


################################################################################
# execution

case "$1" in
-l) echo ${#flags[@]}
;;
-ll) for f in "${flags[@]}"; do echo $f; done
;;
*) echo -n ${flags[$1]}
;;
esac
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/* Copyright 2013-2020 Axel Huebl, Heiko Burau, Rene Widera, Felix Schmitt,
* Richard Pausch
*
* This file is part of PIConGPU.
*
* PIConGPU is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PIConGPU is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PIConGPU.
* If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include "picongpu/particles/densityProfiles/profiles.def"


namespace picongpu
{
namespace SI
{
/** Base density in particles per m^3 in the density profiles.
*
* This is often taken as reference maximum density in normalized profiles.
* Individual particle species can define a `densityRatio` flag relative
* to this value.
*
* unit: ELEMENTS/m^3
*/
constexpr float_64 BASE_DENSITY_SI = 1.e25;
}

namespace densityProfiles
{
/* definition of homogenous profile */
using Homogenous = HomogenousImpl;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* Copyright 2014-2020 Axel Huebl, Rene Widera
*
* This file is part of PIConGPU.
*
* PIConGPU is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PIConGPU is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PIConGPU.
* If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#ifndef PARAM_DIMENSION
#define PARAM_DIMENSION DIM3
#endif

#define SIMDIM PARAM_DIMENSION

namespace picongpu
{
constexpr uint32_t simDim = SIMDIM;
} // namespace picongpu
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/* Copyright 2013-2020 Axel Huebl, Rene Widera, Felix Schmitt,
* Benjamin Worpitz, Richard Pausch
*
* This file is part of PIConGPU.
*
* PIConGPU is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PIConGPU is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PIConGPU.
* If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include <pmacc/meta/conversion/MakeSeq.hpp>

/* some forward declarations we need */
#include "picongpu/fields/Fields.def"
#include "picongpu/particles/particleToGrid/ComputeGridValuePerFrame.def"

#include <boost/mpl/vector.hpp>


namespace picongpu
{

/** FieldTmpSolvers groups all solvers that create data for FieldTmp ******
*
* FieldTmpSolvers is used in @see FieldTmp to calculate the exchange size
*/
using FieldTmpSolvers = MakeSeq_t<>;

/** FileOutputFields: Groups all Fields that shall be dumped *************/

/** Possible native fields: FieldE, FieldB, FieldJ
*/
using NativeFileOutputFields = MakeSeq_t<>;

using FileOutputFields = MakeSeq_t<>;


/** FileOutputParticles: Groups all Species that shall be dumped **********
*
* hint: to disable particle output set to
* using FileOutputParticles = MakeSeq_t< >;
*/
using FileOutputParticles = MakeSeq_t<>;

}
Loading

0 comments on commit 360f616

Please sign in to comment.