Skip to content

Commit

Permalink
SoA: Fix CuPy
Browse files Browse the repository at this point in the history
Fix two errors in SoA runtime and `idcpu` representation in CuPy.
  • Loading branch information
ax3l committed May 2, 2024
1 parent 76c43ec commit 619480a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/amrex/StructOfArrays.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,21 +165,23 @@ def soa_to_cupy(self, copy=False):
else:
soa_view = SoA_cp({}, {}, None)

real_comp_names = self.soa_real_comps(self.num_real_comps)
# for the legacy data layout, do not start with x, y, z but with a, b, c, ...
if self.has_idcpu:
real_comp_names = self.soa_real_comps(self.num_real_comps)
else:
real_comp_names = self.soa_real_comps(self.num_real_comps, rotate=False)

for idx_real in range(self.num_real_comps):
soa_view.real[real_comp_names[idx_real]] = self.get_real_data(idx_real).to_cupy(
copy=copy
)

int_comp_names = self.soa_int_comps(self.num_int_comps)
for idx_int in range(self.num_int_comps):
soa_view.int[int_comp_names[idx_real]] = self.get_int_data(idx_int).to_cupy(
soa_view.int[int_comp_names[idx_int]] = self.get_int_data(idx_int).to_cupy(
copy=copy
)

if self.has_idcpu:
soa_view.idcpu = self.get_idcpu_data().to_cupy(copy=copy)

return soa_view


Expand Down

0 comments on commit 619480a

Please sign in to comment.