Skip to content

Commit

Permalink
fix 'pure virtual method called' error (#774)
Browse files Browse the repository at this point in the history
### Description
Move `DeviceVector` inside `setInitialConditionsOnGrid` to avoid the
`pure virtual method called` error, first seen in #761 .

This branch is based on dependabot/submodules/extern/amrex-6d9c25b . 

### Related issues
Fix issues in PR #761 

### Checklist
_Before this pull request can be reviewed, all of these tasks should be
completed. Denote completed tasks with an `x` inside the square brackets
`[ ]` in the Markdown source below:_
- [ ] I have added a description (see above).
- [ ] I have added a link to any related issues see (see above).
- [ ] I have read the [Contributing
Guide](https://github.com/quokka-astro/quokka/blob/development/CONTRIBUTING.md).
- [ ] I have added tests for any new physics that this PR adds to the
code.
- [ ] I have tested this PR on my local computer and all tests pass.
- [ ] I have manually triggered the GPU tests with the magic comment
`/azp run`.
- [ ] I have requested a reviewer for this PR.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
chongchonghe and dependabot[bot] authored Oct 14, 2024
1 parent 5f84397 commit 30bc694
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion extern/amrex
Submodule amrex updated 78 files
+1 −0 .github/workflows/cuda.yml
+10 −14 .github/workflows/gcc.yml
+3 −3 .github/workflows/hip.yml
+5 −5 .github/workflows/intel.yml
+1 −1 .github/workflows/smoke.yml
+1 −1 .github/workflows/style/check_tabs.sh
+1 −1 .github/workflows/style/check_trailing_whitespaces.sh
+2 −2 Docs/sphinx_documentation/source/Basics.rst
+16 −3 Docs/sphinx_documentation/source/EB.rst
+2 −2 Docs/sphinx_documentation/source/RuntimeParameters.rst
+106 −0 Src/AmrCore/AMReX_FillPatchUtil.H
+221 −63 Src/AmrCore/AMReX_FillPatchUtil_I.H
+42 −1 Src/Base/AMReX_Arena.H
+65 −2 Src/Base/AMReX_Arena.cpp
+4 −1 Src/Base/AMReX_BArena.cpp
+0 −12 Src/Base/AMReX_CArena.H
+8 −31 Src/Base/AMReX_CArena.cpp
+183 −86 Src/Base/AMReX_CTOParallelForImpl.H
+76 −2 Src/Base/AMReX_CoordSys.cpp
+2 −2 Src/Base/AMReX_DistributionMapping.cpp
+83 −21 Src/Base/AMReX_Enum.H
+14 −1 Src/Base/AMReX_Geometry.H
+3 −3 Src/Base/AMReX_GpuPrint.H
+51 −0 Src/Base/AMReX_IOFormat.H
+3 −0 Src/Base/AMReX_IntVect.H
+67 −0 Src/Base/AMReX_Math.H
+7 −0 Src/Base/AMReX_NonLocalBC.H
+2 −0 Src/Base/AMReX_PArena.cpp
+265 −30 Src/Base/AMReX_ParmParse.H
+60 −32 Src/Base/AMReX_ParmParse.cpp
+50 −0 Src/Base/AMReX_PhysBCFunct.H
+2 −1 Src/Base/AMReX_RKIntegrator.H
+24 −0 Src/Base/AMReX_Stack.H
+2 −1 Src/Base/AMReX_TinyProfiler.H
+58 −30 Src/Base/AMReX_TinyProfiler.cpp
+3 −5 Src/Base/AMReX_VisMF.cpp
+5 −0 Src/Base/AMReX_iMultiFab.H
+45 −0 Src/Base/AMReX_iMultiFab.cpp
+4 −0 Src/Base/AMReX_parmparse_mod.F90
+2 −0 Src/Base/CMakeLists.txt
+3 −0 Src/Base/Make.package
+2 −13 Src/Base/Parser/AMReX_IParser_Exe.H
+2 −13 Src/Base/Parser/AMReX_Parser_Exe.H
+8 −12 Src/Base/Parser/AMReX_Parser_Y.H
+1 −2 Src/EB/AMReX_EB2_2D_C.cpp
+3 −1 Src/EB/AMReX_EB2_3D_C.cpp
+5 −2 Src/EB/AMReX_EB2_IndexSpace_STL.cpp
+5 −2 Src/EB/AMReX_EB2_IndexSpace_chkpt_file.cpp
+4 −0 Src/F_Interfaces/AmrCore/AMReX_fluxregister_mod.F90
+4 −0 Src/F_Interfaces/Base/AMReX_boxarray_mod.F90
+4 −0 Src/F_Interfaces/Base/AMReX_distromap_mod.F90
+4 −0 Src/F_Interfaces/Base/AMReX_fab_mod.F90
+4 −0 Src/F_Interfaces/Base/AMReX_geometry_mod.F90
+12 −0 Src/F_Interfaces/Base/AMReX_multifab_mod.F90
+8 −2 Src/F_Interfaces/Base/AMReX_multifabutil_fi.cpp
+25 −1 Src/F_Interfaces/Base/AMReX_multifabutil_mod.F90
+4 −0 Src/F_Interfaces/Base/AMReX_physbc_mod.F90
+4 −0 Src/F_Interfaces/LinearSolvers/AMReX_abeclaplacian_mod.F90
+4 −0 Src/F_Interfaces/LinearSolvers/AMReX_multigrid_mod.F90
+4 −0 Src/F_Interfaces/LinearSolvers/AMReX_poisson_mod.F90
+4 −0 Src/F_Interfaces/Particle/AMReX_particlecontainer_mod.F90
+1 −1 Src/LinearSolvers/MLMG/AMReX_MLABecLaplacian.H
+111 −73 Src/LinearSolvers/MLMG/AMReX_MLALaplacian.H
+2 −2 Src/LinearSolvers/MLMG/AMReX_MLCellLinOp.H
+10 −5 Src/LinearSolvers/MLMG/AMReX_MLLinOp.H
+111 −73 Src/LinearSolvers/MLMG/AMReX_MLPoisson.H
+20 −0 Src/Particle/AMReX_Particle_mod_K.H
+4 −2 Src/Particle/AMReX_WriteBinaryParticleData.H
+1 −1 Tests/CMakeLists.txt
+1 −2 Tests/Enum/inputs
+45 −0 Tests/Enum/main.cpp
+9 −0 Tests/ParmParse/CMakeLists.txt
+24 −0 Tests/ParmParse/GNUmakefile
+1 −0 Tests/ParmParse/Make.package
+64 −0 Tests/ParmParse/inputs
+143 −0 Tests/ParmParse/main.cpp
+1 −1 Tools/CMake/AMReXSetDefines.cmake
+2 −2 Tools/GNUMake/Make.defs
48 changes: 24 additions & 24 deletions src/problems/RadTube/test_radiation_tube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,12 @@ RadSystem<TubeProblem>::DefineOpacityExponentsAndLowerValues(amrex::GpuArray<dou
return exponents_and_values;
}

// declare global variables
// initial conditions read from file
amrex::Gpu::HostVector<double> x_arr;
amrex::Gpu::HostVector<double> rho_arr;
amrex::Gpu::HostVector<double> Pgas_arr;
amrex::Gpu::HostVector<double> Erad_arr;

amrex::Gpu::DeviceVector<double> x_arr_g;
amrex::Gpu::DeviceVector<double> rho_arr_g;
amrex::Gpu::DeviceVector<double> Pgas_arr_g;
amrex::Gpu::DeviceVector<double> Erad_arr_g;
template <> struct SimulationData<TubeProblem> {
amrex::Gpu::DeviceVector<double> x_arr_g;
amrex::Gpu::DeviceVector<double> rho_arr_g;
amrex::Gpu::DeviceVector<double> Pgas_arr_g;
amrex::Gpu::DeviceVector<double> Erad_arr_g;
};

template <> void QuokkaSimulation<TubeProblem>::preCalculateInitialConditions()
{
Expand All @@ -106,6 +101,11 @@ template <> void QuokkaSimulation<TubeProblem>::preCalculateInitialConditions()
std::string header;
std::getline(fstream, header);

std::vector<double> x_arr;
std::vector<double> rho_arr;
std::vector<double> Pgas_arr;
std::vector<double> Erad_arr;

for (std::string line; std::getline(fstream, line);) {
std::istringstream iss(line);
std::vector<double> values;
Expand All @@ -123,16 +123,16 @@ template <> void QuokkaSimulation<TubeProblem>::preCalculateInitialConditions()
Erad_arr.push_back(Erad);
}

x_arr_g.resize(x_arr.size());
rho_arr_g.resize(rho_arr.size());
Pgas_arr_g.resize(Pgas_arr.size());
Erad_arr_g.resize(Erad_arr.size());
userData_.x_arr_g.resize(x_arr.size());
userData_.rho_arr_g.resize(rho_arr.size());
userData_.Pgas_arr_g.resize(Pgas_arr.size());
userData_.Erad_arr_g.resize(Erad_arr.size());

// copy to device
amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice, x_arr.begin(), x_arr.end(), x_arr_g.begin());
amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice, rho_arr.begin(), rho_arr.end(), rho_arr_g.begin());
amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice, Pgas_arr.begin(), Pgas_arr.end(), Pgas_arr_g.begin());
amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice, Erad_arr.begin(), Erad_arr.end(), Erad_arr_g.begin());
amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice, x_arr.begin(), x_arr.end(), userData_.x_arr_g.begin());
amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice, rho_arr.begin(), rho_arr.end(), userData_.rho_arr_g.begin());
amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice, Pgas_arr.begin(), Pgas_arr.end(), userData_.Pgas_arr_g.begin());
amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice, Erad_arr.begin(), Erad_arr.end(), userData_.Erad_arr_g.begin());
amrex::Gpu::streamSynchronizeAll();
}

Expand All @@ -144,11 +144,11 @@ template <> void QuokkaSimulation<TubeProblem>::setInitialConditionsOnGrid(quokk
const amrex::Box &indexRange = grid_elem.indexRange_;
const amrex::Array4<double> &state_cc = grid_elem.array_;

auto const &x_ptr = x_arr_g.dataPtr();
auto const &rho_ptr = rho_arr_g.dataPtr();
auto const &Pgas_ptr = Pgas_arr_g.dataPtr();
auto const &Erad_ptr = Erad_arr_g.dataPtr();
int x_size = static_cast<int>(x_arr_g.size());
auto const &x_ptr = userData_.x_arr_g.dataPtr();
auto const &rho_ptr = userData_.rho_arr_g.dataPtr();
auto const &Pgas_ptr = userData_.Pgas_arr_g.dataPtr();
auto const &Erad_ptr = userData_.Erad_arr_g.dataPtr();
int x_size = static_cast<int>(userData_.x_arr_g.size());

const auto radBoundaries_g = RadSystem_Traits<TubeProblem>::radBoundaries;

Expand Down

0 comments on commit 30bc694

Please sign in to comment.