scream icon indicating copy to clipboard operation
scream copied to clipboard

MAM4xx sycl errors

Open oksanaguba opened this issue 1 year ago • 5 comments

Tagging @odiazib @overfelt @tcclevenger @bartgol .

There is an error i do not know how to resolve

In file included from /home/onguba/scream-b2/components/../externals/mam4xx/src/mam4xx/calcsize.hpp:14:
/home/onguba/scream-b2/components/../externals/mam4xx/src/mam4xx/conversions.hpp:253:19: error: SYCL kernel cannot call through a function pointer
  253 |   const auto ws = wsat(T, p);
      |                   ^

pointing to code

KOKKOS_INLINE_FUNCTION Real relative_humidity_from_vapor_mixing_ratio(
    Real w, Real T, Real p,
    Real (*wsat)(Real, Real) = saturation_mixing_ratio_hardy) {
  const auto ws = wsat(T, p);
  return w / ws;
}

Other errros so far are only about printf, where i use the same workaround as in homme,

#ifdef KOKKOS_ENABLE_SYCL
    Kokkos::printf ("k = %d\n",k);
#else
    printf ("k = %d\n",k);
#endif

though i am not sure why it is not just kokkos::printf for all builds (maybe i tried that and it did not work).

oksanaguba avatar May 22 '24 16:05 oksanaguba

Re printf: I believe this is something that is fixed in later Kokkos versions (I think 4.2 on, and E3SM is using 3.7). Once we can update kokkos I think these workarounds won't be necessary.

tcclevenger avatar May 22 '24 16:05 tcclevenger

@tcclevenger thanks -- my kokkos is pretty updated (branch develop from Apr 26, 2024)

oksanaguba avatar May 22 '24 16:05 oksanaguba

I guess passing a function pointer is problematic. Perhaps you could template on a function type, and pass a lambda.

bartgol avatar May 22 '24 16:05 bartgol

@tcclevenger thanks -- my kokkos is pretty updated (branch develop from Apr 26, 2024)

Oh interesting. I can find some time to look into the specifics of that change and the SYCL backend.. But if your using april develop those changes would definitely be included.

tcclevenger avatar May 22 '24 16:05 tcclevenger

Hi @oksanaguba, do you require MAM4XX for your simulation? If not, you can disable it by using -DSCREAM_ENABLE_MAM=OFF as suggested by @jeff-cohere in the Emaxx change discussion on Slack. I will proceed to open an issue in the MAM4XX repository to address this.

odiazib avatar May 22 '24 16:05 odiazib

closing for now -- someone will hit this issue soon enough of aurora, or it will be fixed before then.

oksanaguba avatar Dec 06 '24 19:12 oksanaguba