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

Try to run stlbm #1016

Open
lanwatch opened this issue Jul 4, 2023 · 1 comment
Open

Try to run stlbm #1016

lanwatch opened this issue Jul 4, 2023 · 1 comment

Comments

@lanwatch
Copy link

lanwatch commented Jul 4, 2023

stlbm is a very good example of high-performance scientific computation using C++ which can be offloaded sucessfully to accelerators with top-notch performance.

I have tried to compile it using oneDPL, by modifying the cavity.cpp source to add the

#include <oneapi/dpl/execution>
#include <oneapi/dpl/algorithm>
#include <sycl/sycl.hpp>

includes before the standard ones, and defining a policy like:

static sycl::queue q;
static const auto mypolicy = dpl::execution::make_device_policy(q);

which then gets passed to the std::for_each invocations, instead of std::execution::par_unseq.

When doing that I get a rather long C++ error that boils down to:

/work/stlbm/apps/cavity.cpp:300:9: note: in instantiation of function template specialization 'oneapi::dpl::for_each<const oneapi::dpl::execution::device_policy<> &, std::array<double, 19> *, twopop_aos_bgk_unrolled::LBM>' requested here
  300 |         for_each(mypolicy, lattice, lattice + dim.nelem, lbm);
      |         ^
/work/oneDPL/include/oneapi/dpl/pstl/hetero/dpcpp/unseq_backend_sycl.h:90:5: note: candidate template ignored: substitution failure [with _ItemId = size_t, _Ranges = <const oneapi::dpl::__ranges::guard_view<std::array<double, 19> *> &>]: no matching function for call to object of type 'const twopop_aos_bgk_unrolled::LBM'
   90 |     operator()(const _ItemId __idx, _Ranges&&... __rngs) const -> decltype(__f(__rngs[__idx]...))

Seems like the argument to LBM::operator() should be a CellData = std::array<double, 19> instead of a std::array<double, 19> * (I believe, from cursory examination of the guard_view class). Maybe some "type dressing" has gone wrong?

@MikeDvorskiy
Copy link
Contributor

MikeDvorskiy commented Jul 17, 2023

Hello @lanwatch ,
Firstly,
It seems you pass into for_each algorithm a data type (aka std::array<double, 19> * ), which is not supported by oneDPL.

OneAPI library documentation tells:

"You can use one of the following ways to pass data to an algorithm executed with a device policy:

  • oneapi:dpl::begin and oneapi::dpl::end functions
  • Unified shared memory (USM) pointers and std::vector with USM allocators
  • Iterators of host-side std::vector
    "
    Secondly, what is a twopop_aos_bgk_unrolled::LBM type?
    Probably, you should add const modificator for LBM::operator(..) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants