Nalu icon indicating copy to clipboard operation
Nalu copied to clipboard

Eliminate explicit use of node types

Open crtrott opened this issue 9 years ago • 3 comments

Currently Nalu explicitly uses Kokkos::SerialNode in some places. It would be better to use: KokkosClassic::DefaultNode::DefaultNodeType which would allow Nalu to pick up the Node type from the Trilinos configuration. THis is for example important when trying to build with OpenMP. It would be even better to not specifiy Node at all but simply let Tpetra use its defaults. I.e. Tpetra::Export< LocalOrdinal, GlobalOrdinal> instead of Tpetra::Export< LocalOrdinal, GlobalOrdinal, Node >

crtrott avatar Dec 23 '14 21:12 crtrott

Another option would be to get default types from Tpetra::Map. If you want Tpetra's default Node type, just use Tpetra::Map<LO, GO>::node_type. Tpetra::Map<LO, GO>::device_type (preferred) works, as does Tpetra::Map<LO, GO>::node_type::device_type (not preferred).

The eventual plan is to replace Node entirely, in favor of some Kokkos thing. I'm pretty sure we can use C++11 template typedefs for backwards compatibility (using Node where a Kokkos thing would do), without increasing the amount of code to build.

mhoemmen avatar Feb 28 '16 22:02 mhoemmen

Is this still an issue?

spdomin avatar Aug 04 '16 04:08 spdomin

Is this still an issue?

Hi @spdomin ! Kokkos::SerialNode hasn't existed for a while. I would recommend getting the default Node type from Tpetra::Map<LO, GO>::node_type, rather than using the KokkosClassic typedef (which will go away at some point).

There are cases you might want a nondefault Node type. For example:

  1. You want to build Nalu against an installed Trilinos whose configuration is outside of your control. In that case, the default Node type may not be what you want.
  2. You want to do performance comparisons within Nalu of different Kokkos back-ends, without reconfiguring Trilinos in between. In that case, you would need to enable all the Node types in Trilinos that you plan to compare.

Otherwise, it's usually a good idea to use the default Node type. For example: Suppose that Nalu wants to use OpenMP. Trilinos would need to be built with OpenMP enabled anyway. In that case, the default Node type uses OpenMP. One can always command Tpetra at configure time to use a different default, but that takes extra effort.

Nalu's approach of having a typedef to specify its Node type works just fine.

mhoemmen avatar Aug 05 '16 17:08 mhoemmen