Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
Prepare tagging 1.0.1 (#195)
Browse files Browse the repository at this point in the history
* Lift GPU restrictions on using typical values for chemistry.

* Fix fuelName handling.

* Update release_notes in preparation for 1.0.1

* Skip ReSetTolODE on GPU. Used to set the global user_data used on CPU.

* Update submodules to match release notes.

* Start implementing ParallelFor(MF).

* Need to pass class indices into lambdas.

* Missing one.
  • Loading branch information
esclapez authored Sep 8, 2021
1 parent 8e39a1f commit 6add625
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 83 deletions.
13 changes: 12 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
# 1.0.1
Release version 1.0.1 (In preparation)
Release version 1.0.1 (Sept. 2021)
### Major changes:
* EB new uses a 2nd order Godunov method with State Redistribution of the
expl. advection fluxes and Flux Redistribution of the expl. diffusion fluxes
* Advection functionalities now requires the AMReX-Hydro repository

### Minor changes
* Revert some of HIP changes (AMREX_GPU_DEVICE -> AMREX_GPU_HOST_DEVICE)
* Setup CMAKE compilation, AMReX/IAMR/PelePhysics submodules and automated testing (J. Rood)
* Update EOS/Transport calls to match templated PelePhysics (L. Owen)
* Reduction of the number of fillPatch operation
* Species linear diffusion solve/apply are performed on species groups (default size NUM_SPECIES)

### Dependencies stable \#
* PelePhysics : b2d45f0f68
* IAMR : 80ca2cdc23
* AMReX : a8fe43774d
* AMReX-Hydro : bea9f07d95

# 1.0.0
Release version 1.0.0 (January, 2021)
Expand Down
118 changes: 47 additions & 71 deletions Source/PeleLM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1349,6 +1349,9 @@ PeleLM::init_mixture_fraction()
Abort("Unknown mixtureFraction.format ! Should be 'Cantera' or 'RealList'");
}
}
if (fuelName.empty() && !hasUserMF) {
Print() << " Mixture fraction definition lacks fuelName: consider using ns.fuelName keyword \n";
}

// Only interested in CHON -in that order. Compute Bilger weights
amrex::Real atwCHON[4] = {0.0};
Expand Down Expand Up @@ -1493,8 +1496,7 @@ PeleLM::update_typical_values_chem ()
{
#ifdef USE_SUNDIALS_PP
if (use_typ_vals_chem) {
#ifndef AMREX_USE_GPU
if (verbose) amrex::Print() << "Using typical values for the absolute tolerances of the ode solver\n";
if (verbose>1) amrex::Print() << "Using typical values for the absolute tolerances of the ode solver\n";
#ifdef AMREX_USE_OMP
#pragma omp parallel if (Gpu::notInLaunchRegion())
#endif
Expand All @@ -1508,12 +1510,10 @@ PeleLM::update_typical_values_chem ()
}
typical_values_chem[NUM_SPECIES] = typical_values[Temp];
SetTypValsODE(typical_values_chem);
#ifndef AMREX_USE_GPU
ReSetTolODE();
}
#else
// TODO: set this option back on in PP
amrex::Print() << "Using typical values for the absolute tolerances of the ode solver not available on GPU right now\n";
#endif
}
}
#endif
}
Expand Down Expand Up @@ -1952,24 +1952,16 @@ PeleLM::initData ()
ProbParm const* lprobparm = prob_parm.get();
PmfData const* lpmfdata = pmf_data_g;

#ifdef AMREX_USE_OMP
#pragma omp parallel if (Gpu::notInLaunchRegion())
#endif
for (MFIter mfi(S_new,TilingIfNotGPU()); mfi.isValid(); ++mfi)
auto const& sma = S_new.arrays();
amrex::ParallelFor(S_new,
[=] AMREX_GPU_DEVICE (int box_no, int i, int j, int k) noexcept
{
const Box& box = mfi.tilebox();
auto sfab = S_new.array(mfi);

amrex::ParallelFor(box,
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
#ifdef AMREX_USE_NEWMECH
amrex::Abort("USE_NEWMECH feature no longer working and has to be fixed/redone");
amrex::Abort("USE_NEWMECH feature no longer working and has to be fixed/redone");
#else
pelelm_initdata(i, j, k, sfab, geomdata, *lprobparm, lpmfdata);
pelelm_initdata(i, j, k, sma[box_no], geomdata, *lprobparm, lpmfdata);
#endif
});
}
});
}

showMFsub("1D",S_new,stripBox,"1D_S",level);
Expand Down Expand Up @@ -2152,24 +2144,19 @@ PeleLM::compute_instantaneous_reaction_rates (MultiFab& R,
maskMF.ParallelCopy(ebmask,0,0,1);
#endif

#ifdef AMREX_USE_OMP
#pragma omp parallel if (Gpu::notInLaunchRegion())
#endif
for (MFIter mfi(S,TilingIfNotGPU()); mfi.isValid(); ++mfi)
auto const& sma = S.const_arrays();
auto const& maskma = maskMF.const_arrays();
auto const& rma = R.arrays();
amrex::ParallelFor(S, [=,FS=first_spec,RH=RhoH,Temp=Temp]
AMREX_GPU_DEVICE (int box_no, int i, int j, int k) noexcept
{
const Box& bx = mfi.tilebox();
auto const& rhoY = S.const_array(mfi,first_spec);
auto const& rhoH = S.const_array(mfi,RhoH);
auto const& T = S.const_array(mfi,Temp);
auto const& mask = maskMF.const_array(mfi);
auto const& rhoYdot = R.array(mfi);

amrex::ParallelFor(bx, [rhoY, rhoH, T, mask, rhoYdot]
AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
reactionRateRhoY( i, j, k, rhoY, rhoH, T, mask, rhoYdot );
});
}
reactionRateRhoY(i, j, k,
Array4<Real const>(sma[box_no],FS),
Array4<Real const>(sma[box_no],RH),
Array4<Real const>(sma[box_no],Temp),
maskma[box_no],
rma[box_no]);
});

if ((nGrow>0) && (how == HT_EXTRAP_GROW_CELLS))
{
Expand Down Expand Up @@ -2210,25 +2197,18 @@ PeleLM::init (AmrLevel& old)
FillPatchIterator FctCntfpi(*oldht,FuncCount,FuncCount.nGrow(),tnp1,FuncCount_Type,0,1);
const MultiFab& FuncCount_old = FctCntfpi.get_mf();

#ifdef AMREX_USE_OMP
#pragma omp parallel if (Gpu::notInLaunchRegion())
#endif
for (MFIter mfi(Ydot_old,TilingIfNotGPU()); mfi.isValid(); ++mfi)
auto const& orYdotma = Ydot_old.const_arrays();
auto const& nrYdotma = Ydot.arrays();
auto const& oFctCma = FuncCount_old.const_arrays();
auto const& nFctCma = FuncCount.arrays();
amrex::ParallelFor(Ydot_old,
[=] AMREX_GPU_DEVICE (int box_no, int i, int j, int k) noexcept
{
const Box& bx = mfi.tilebox();
auto const& rhoYdot_n = Ydot.array(mfi);
auto const& rhoYdot_o = Ydot_old.const_array(mfi);
auto const& FctCnt_n = FuncCount.array(mfi);
auto const& FctCnt_o = FuncCount_old.const_array(mfi);
amrex::ParallelFor(bx, [rhoYdot_n, rhoYdot_o, FctCnt_n, FctCnt_o]
AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
for (int n = 0; n < NUM_SPECIES; n++) {
rhoYdot_n(i,j,k,n) = rhoYdot_o(i,j,k,n);
}
FctCnt_n(i,j,k) = FctCnt_o(i,j,k);
});
}
nFctCma[box_no](i,j,k) = oFctCma[box_no](i,j,k);
for (int n = 0; n < NUM_SPECIES; n++) {
nrYdotma[box_no](i,j,k,n) = orYdotma[box_no](i,j,k,n);
}
});
}

//
Expand Down Expand Up @@ -8374,23 +8354,16 @@ PeleLM::RhoH_to_Temp (MultiFab& S,
AMREX_ALWAYS_ASSERT(nGrow <= S.nGrow());

// TODO: simplified version of that function for now: no iters, no tols, ... PPhys need to be fixed

#ifdef AMREX_USE_OMP
#pragma omp parallel if (Gpu::notInLaunchRegion())
#endif
for (MFIter mfi(S,TilingIfNotGPU()); mfi.isValid(); ++mfi)
auto const& sma = S.arrays();
amrex::ParallelFor(S, [=,Dens=Density,FS=first_spec,RH=RhoH,Temp=Temp]
AMREX_GPU_DEVICE (int box_no, int i, int j, int k) noexcept
{
const Box& bx = mfi.tilebox();
auto const& T = S.array(mfi,Temp);
auto const& rho = S.const_array(mfi,Density);
auto const& rhoY = S.const_array(mfi,first_spec);
auto const& rhoH = S.const_array(mfi,RhoH);
amrex::ParallelFor(bx, [T,rho,rhoY,rhoH]
AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
getTfromHY(i,j,k, rho, rhoY, rhoH, T);
});
}
getTfromHY(i, j, k,
Array4<Real const>(sma[box_no],Dens),
Array4<Real const>(sma[box_no],FS),
Array4<Real const>(sma[box_no],RH),
Array4<Real>(sma[box_no],Temp));
});

/*
//
Expand Down Expand Up @@ -9346,6 +9319,9 @@ PeleLM::initActiveControl()

if ( !ctrl_use_temp ) {
// Get the fuel rhoY
if (fuelName.empty()) {
Abort("Using activeControl based on fuel mass requires ns.fuelName !");
}
Vector<std::string> specNames;
pele::physics::eos::speciesNames<pele::physics::PhysicsType::eos_type>(specNames);
int fuelidx = -1;
Expand Down
14 changes: 7 additions & 7 deletions Source/PeleLM_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,9 @@ set_species_bc (BCRec& bc,
//
// Indices of fuel and oxidizer -- ParmParsed in & used in a couple places.
//
std::string PeleLM::fuelName = "CH4";
std::string PeleLM::fuelName = "";
std::string PeleLM::productName = "CO2";
Vector<std::string> PeleLM::consumptionName(1);
Vector<std::string> PeleLM::consumptionName;
static std::string oxidizerName = "O2";

//
Expand Down Expand Up @@ -376,15 +376,12 @@ PeleLM::variableSetUp ()

amrex::Print() << " Initialization of reactor... \n";
int reactor_type = 2;
#ifdef _OPENMP
#ifdef AMREX_USE_OMP
#pragma omp parallel if (Gpu::notInLaunchRegion())
#endif
{
// TODO: restore this option for GPU in PP
#ifndef AMREX_USE_GPU
#ifdef USE_SUNDIALS_PP
SetTolFactODE(relative_tol_chem,absolute_tol_chem);
#endif
#endif
reactor_init(reactor_type,ncells_chem);
}
Expand Down Expand Up @@ -418,7 +415,10 @@ PeleLM::variableSetUp ()
//
ParmParse ppns("ns");
ppns.query("fuelName",fuelName);
consumptionName[0] = fuelName;
if ( !fuelName.empty() ) {
consumptionName.resize(1);
consumptionName[0] = fuelName;
}
if (int nc = ppns.countval("consumptionName"))
{
consumptionName.resize(nc);
Expand Down
2 changes: 1 addition & 1 deletion Submodules/AMReX-Hydro
2 changes: 1 addition & 1 deletion Submodules/IAMR
Submodule IAMR updated from df8b26 to 80ca2c
2 changes: 1 addition & 1 deletion Submodules/amrex
Submodule amrex updated 42 files
+23 −1 .github/workflows/linux.yml
+105 −0 CHANGES
+12 −21 Docs/sphinx_documentation/source/Introduction.rst
+270 −3 Docs/sphinx_documentation/source/Post_Processing.rst
+ Docs/sphinx_documentation/source/figs/ex_fsnapshot_resize.png
+0 −3 Src/AmrCore/AMReX_TagBox.cpp
+9 −0 Src/Base/AMReX_Functional.H
+109 −0 Src/Base/AMReX_GpuAtomic.H
+68 −27 Src/Base/AMReX_PlotFileUtil.cpp
+78 −0 Src/Extern/SENSEI/AMReX_AmrMeshParticleDataAdaptor.H
+226 −0 Src/Extern/SENSEI/AMReX_AmrMeshParticleDataAdaptorI.H
+104 −0 Src/Extern/SENSEI/AMReX_AmrMeshParticleInSituBridge.H
+99 −127 Src/Extern/SENSEI/AMReX_ParticleDataAdaptorI.H
+4 −1 Src/Extern/SENSEI/CMakeLists.txt
+367 −348 Src/LinearSolvers/MLMG/AMReX_MLCellLinOp.cpp
+378 −0 Src/LinearSolvers/MLMG/AMReX_MLLinOp_K.H
+2 −2 Src/LinearSolvers/MLMG/AMReX_MLNodeLap_1D_K.H
+9 −15 Src/LinearSolvers/MLMG/AMReX_MLNodeLap_2D_K.H
+15 −21 Src/LinearSolvers/MLMG/AMReX_MLNodeLap_3D_K.H
+4 −7 Src/LinearSolvers/MLMG/AMReX_MLNodeLap_K.H
+61 −21 Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian.cpp
+1 −1 Src/Particle/AMReX_NeighborList.H
+542 −630 Src/Particle/AMReX_ParticleHDF5.H
+259 −57 Src/Particle/AMReX_Particles.H
+458 −0 Src/Particle/AMReX_WriteBinaryParticleData.H
+13 −5 Tests/Amr/Advection_AmrLevel/Source/AmrLevelAdv.cpp
+23 −0 Tests/GPU/AtomicIf/GNUmakefile
+2 −0 Tests/GPU/AtomicIf/Make.package
+84 −0 Tests/GPU/AtomicIf/main.cpp
+7 −2 Tests/HDF5Benchmark/GNUmakefile
+4 −4 Tests/HDF5Benchmark/inputs
+18 −8 Tests/HDF5Benchmark/main.cpp
+7 −0 Tools/C_util/Convergence/ComparePlotfiles.cpp
+7 −0 Tools/C_util/Convergence/DiffSameDomainRefined.cpp
+7 −0 Tools/C_util/Convergence/DiffSameDomainRefinedComposite.cpp
+7 −0 Tools/C_util/Convergence/DiffSameDomainRefinedStag.cpp
+7 −0 Tools/C_util/Convergence/DiffSameGrid.cpp
+7 −0 Tools/C_util/Convergence/DiffSameGrid2.cpp
+7 −0 Tools/C_util/Convergence/DiffSameGridRefined.cpp
+1 −30 Tools/C_util/DiffMultiFab/GNUmakefile
+39 −34 Tools/C_util/DiffMultiFab/diffmultifab.cpp
+14 −0 Tools/GNUMake/packages/Make.hdf5

0 comments on commit 6add625

Please sign in to comment.