Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work around compiler bug in nvcc 12.2 by using functor instead of lambda #3653

Merged
merged 3 commits into from
Dec 2, 2023
Merged
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
38 changes: 14 additions & 24 deletions Src/Particle/AMReX_ParticleIO.H
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssig
}
}

struct FilterPositiveID {
template <typename P>
AMREX_GPU_HOST_DEVICE
int operator() (const P& p) const {
return p.id() > 0;
}
};

template <typename ParticleType, int NArrayReal, int NArrayInt,
template<class> class Allocator, class CellAssignor>
void
Expand Down Expand Up @@ -77,10 +85,7 @@ ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssig

WriteBinaryParticleData(dir, name, write_real_comp, write_int_comp,
tmp_real_comp_names, tmp_int_comp_names,
[=] AMREX_GPU_HOST_DEVICE (const SuperParticleType& p) -> int
{
return p.id() > 0;
}, true);
FilterPositiveID{}, true);
}

template <typename ParticleType, int NArrayReal, int NArrayInt,
Expand Down Expand Up @@ -111,10 +116,7 @@ ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssig

WriteBinaryParticleData(dir, name, write_real_comp, write_int_comp,
real_comp_names, int_comp_names,
[=] AMREX_GPU_HOST_DEVICE (const SuperParticleType& p)
{
return p.id() > 0;
});
FilterPositiveID{});
}

template <typename ParticleType, int NArrayReal, int NArrayInt,
Expand All @@ -141,10 +143,7 @@ ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssig
WriteBinaryParticleData(dir, name,
write_real_comp, write_int_comp,
real_comp_names, int_comp_names,
[=] AMREX_GPU_HOST_DEVICE (const SuperParticleType& p)
{
return p.id() > 0;
});
FilterPositiveID{});
}

template <typename ParticleType, int NArrayReal, int NArrayInt,
Expand Down Expand Up @@ -177,10 +176,7 @@ ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssig
WriteBinaryParticleData(dir, name,
write_real_comp, write_int_comp,
real_comp_names, int_comp_names,
[=] AMREX_GPU_HOST_DEVICE (const SuperParticleType& p)
{
return p.id() > 0;
});
FilterPositiveID{});
}

template <typename ParticleType, int NArrayReal, int NArrayInt,
Expand Down Expand Up @@ -213,10 +209,7 @@ ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssig

WriteBinaryParticleData(dir, name, write_real_comp, write_int_comp,
real_comp_names, int_comp_names,
[=] AMREX_GPU_HOST_DEVICE (const SuperParticleType& p)
{
return p.id() > 0;
});
FilterPositiveID{});
}

template <typename ParticleType, int NArrayReal, int NArrayInt,
Expand All @@ -234,10 +227,7 @@ WritePlotFile (const std::string& dir, const std::string& name,
WriteBinaryParticleData(dir, name,
write_real_comp, write_int_comp,
real_comp_names, int_comp_names,
[=] AMREX_GPU_HOST_DEVICE (const SuperParticleType& p)
{
return p.id() > 0;
});
FilterPositiveID{});
}

template <typename ParticleType, int NArrayReal, int NArrayInt,
Expand Down