File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -26,10 +26,12 @@ using namespace Cabana;
2626
2727template <class ExecutionSpace , class MemorySpace , class ... Ts>
2828class CabSliceFactory {
29- static constexpr int vecLen = Impl::PerformanceTraits<ExecutionSpace>::vector_length/8 ;
3029 using TypeTuple = std::tuple<Ts...>;
3130 using DeviceType = Kokkos::Device<ExecutionSpace, MemorySpace>;
3231 using DataTypes = Cabana::MemberTypes<Ts...>;
32+ public:
33+ static constexpr int vecLen = Cabana::AoSoA<DataTypes, DeviceType>::vector_length;
34+ private:
3335 using soa_t = SoA<DataTypes, vecLen>;
3436
3537 template <class T , int stride>
@@ -47,7 +49,7 @@ class CabSliceFactory {
4749 template <std::size_t index>
4850 auto makeSliceCab () {
4951 using type = std::tuple_element_t <index, TypeTuple>;
50- const int stride = (vecLen * sizeof (soa_t )) / ( 4 * sizeof (type) );
52+ const int stride = sizeof (soa_t ) / sizeof (type);
5153 auto slice = Cabana::slice<index>(aosoa);
5254 return wrapper_slice_t < type, stride >(std::move (slice));
5355 }
Original file line number Diff line number Diff line change 22
33int main (int argc, char * argv[]) {
44 // AoSoA parameters
5- const int vecLen = 4 ;
65 int num_tuples = 10 ;
76
87 Kokkos::ScopeGuard scope_guard (argc, argv);
@@ -20,7 +19,7 @@ int main(int argc, char* argv[]) {
2019 auto slice_wrapper3 = cabSliceFactory.makeSliceCab <3 >();
2120
2221 // simd_parallel_for setup
23- Cabana::SimdPolicy<vecLen, ExecutionSpace> simd_policy (0 , num_tuples);
22+ Cabana::SimdPolicy<cabSliceFactory. vecLen , ExecutionSpace> simd_policy (0 , num_tuples);
2423
2524 // kernel that reads and writes
2625 auto vector_kernel = KOKKOS_LAMBDA (const int s, const int a) {
You can’t perform that action at this time.
0 commit comments