Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects

Resolve "mixed-precision"

Merged montan_v requested to merge 146-mixed-precision into master
Compare and
29 files
+ 1420
594
Compare changes
  • Side-by-side
  • Inline
Files
29
@@ -156,7 +156,8 @@ double CDF(const double& x, const double& delta, const double& k, const unsigned
}
KOKKOS_FUNCTION
double PDF(const Vector_t<Dim>& xvec, const double& delta, const Vector_t<Dim>& kw) {
double PDF(const Vector_t<double, Dim>& xvec, const double& delta,
const Vector_t<double, Dim>& kw) {
double pdf = 1.0 * 1.0 * (1.0 + delta * Kokkos::cos(kw[Dim - 1] * xvec[Dim - 1]));
return pdf;
}
@@ -171,8 +172,8 @@ struct PhaseDump {
ippl::NDIndex<2> owned(I, I);
layout = FieldLayout_t<2>(owned, serial);
ippl::Vector<double, 2> hx = {domain / nr, 16. / nr};
ippl::Vector<double, 2> origin{0, -8};
Vector_t<double, 2> hx = {domain / nr, 16. / nr};
Vector_t<double, 2> origin{0, -8};
mesh = Mesh_t<2>(owned, hx, origin);
phaseSpace.initialize(mesh, layout);
@@ -229,7 +230,7 @@ private:
FieldLayout_t<2> layout;
Mesh_t<2> mesh;
Field_t<2> phaseSpace, phaseSpaceBuf;
ippl::ParticleAttrib<Vector<double, 2>> phase;
ippl::ParticleAttrib<Vector_t<double, 2>> phase;
double maxValue = 0, minValue = 0;
};
@@ -245,7 +246,7 @@ int main(int argc, char* argv[]) {
int arg = 1;
auto start = std::chrono::high_resolution_clock::now();
ippl::Vector<int, Dim> nr;
Vector_t<int, Dim> nr;
for (unsigned d = 0; d < Dim; d++) {
nr[d] = std::atoi(argv[arg++]);
};
@@ -267,7 +268,7 @@ int main(int argc, char* argv[]) {
msg << TestName << endl << "nt " << nt << " Np= " << totalP << " grid = " << nr << endl;
using bunch_type = ChargedParticles<PLayout_t<Dim>, Dim>;
using bunch_type = ChargedParticles<PLayout_t<double, Dim>, double, Dim>;
std::shared_ptr<bunch_type> P;
@@ -281,7 +282,7 @@ int main(int argc, char* argv[]) {
decomp[d] = ippl::PARALLEL;
}
Vector_t<Dim> kw;
Vector_t<double, Dim> kw;
double sigma, muBulk, muBeam, epsilon, delta;
if (std::strcmp(TestName, "TwoStreamInstability") == 0) {
@@ -310,20 +311,20 @@ int main(int argc, char* argv[]) {
delta = 0.01;
}
Vector_t<Dim> rmin(0.0);
Vector_t<Dim> rmax = 2 * pi / kw;
Vector_t<double, Dim> rmin(0.0);
Vector_t<double, Dim> rmax = 2 * pi / kw;
Vector_t<Dim> hr;
Vector_t<double, Dim> hr;
for (unsigned d = 0; d < Dim; d++) {
hr[d] = rmax[d] / nr[d];
}
Vector_t<Dim> origin = rmin;
const double dt = std::min(.05, 0.5 * *std::min_element(hr.begin(), hr.end()));
Vector_t<double, Dim> origin = rmin;
const double dt = std::min(.05, 0.5 * *std::min_element(hr.begin(), hr.end()));
const bool isAllPeriodic = true;
Mesh_t<Dim> mesh(domain, hr, origin);
FieldLayout_t<Dim> FL(domain, decomp, isAllPeriodic);
PLayout_t<Dim> PL(FL, mesh);
PLayout_t<double, Dim> PL(FL, mesh);
// Q = -\int\int f dx dv
double Q = std::reduce(rmax.begin(), rmax.end(), -1., std::multiplies<double>());
@@ -355,7 +356,7 @@ int main(int argc, char* argv[]) {
"Assign initial rho based on PDF", ippl::getRangePolicy<Dim>(rhoview, nghost),
KOKKOS_LAMBDA(const index_array_type& args) {
// local to global index conversion
Vector_t<Dim> xvec = args;
Vector_t<double, Dim> xvec = args;
for (unsigned d = 0; d < Dim; d++) {
xvec[d] = (xvec[d] + lDom[d].first() - nghost + 0.5) * hr[d] + origin[d];
}
@@ -378,7 +379,7 @@ int main(int argc, char* argv[]) {
typedef ippl::detail::RegionLayout<double, Dim, Mesh_t<Dim>> RegionLayout_t;
const RegionLayout_t& RLayout = PL.getRegionLayout();
const typename RegionLayout_t::host_mirror_type Regions = RLayout.gethLocalRegions();
Vector_t<Dim> Nr, Dr, minU, maxU;
Vector_t<double, Dim> Nr, Dr, minU, maxU;
int myRank = Ippl::Comm->rank();
for (unsigned d = 0; d < Dim; ++d) {
Nr[d] = CDF(Regions(myRank)[d].max(), delta, kw[d], d)
@@ -422,7 +423,7 @@ int main(int argc, char* argv[]) {
Kokkos::Random_XorShift64_Pool<> rand_pool64((size_type)(42 + 100 * Ippl::Comm->rank()));
Kokkos::parallel_for(
nloc, generate_random<Vector_t<Dim>, Kokkos::Random_XorShift64_Pool<>, Dim>(
nloc, generate_random<Vector_t<double, Dim>, Kokkos::Random_XorShift64_Pool<>, Dim>(
P->R.getView(), P->P.getView(), rand_pool64, delta, kw, sigma, muBulk, muBeam,
nlocBulk, minU, maxU));
Kokkos::fence();
Loading