hpx icon indicating copy to clipboard operation
hpx copied to clipboard

HPX headers in device builds

Open opensdh opened this issue 5 months ago • 2 comments

GPU kernels cannot appear in translation units that make any non-trivial use of HPX, because many HPX declarations are removed by the preprocessor when compiling for the device. Obviously many HPX features cannot be used on a GPU, but the implicit __host__ everywhere should generally be sufficient to enforce that without having simple name lookup fail in any class that uses HPX in one member function and launches a kernel in another.

(We've discussed this in the past; sorry if I just failed to find an existing formal issue for it.)

opensdh avatar Jul 15 '25 02:07 opensdh

This is a lot of work. Would you have specific headers that are most important for you to be changed?

hkaiser avatar Jul 15 '25 11:07 hkaiser

Well, I can make a list for FleCSI with g++ -E and filter for !defined(HPX_COMPUTE_DEVICE_CODE):

  • [ ] hpx/agas_base/server/primary_namespace.hpp
  • [ ] hpx/async_colocated/async_colocated.hpp
  • [ ] hpx/async_colocated/post_colocated.hpp
  • [ ] hpx/async_distributed/base_lco_with_value.hpp
  • [ ] hpx/async_distributed/trigger_lco.hpp
  • [ ] hpx/collectives/all_gather.hpp
  • [ ] hpx/collectives/all_reduce.hpp
  • [ ] hpx/collectives/all_to_all.hpp
  • [ ] hpx/collectives/broadcast_direct.hpp
  • [ ] hpx/collectives/broadcast.hpp
  • [ ] hpx/collectives/channel_communicator.hpp
  • [ ] hpx/collectives/create_communicator.hpp
  • [ ] hpx/collectives/detail/channel_communicator.hpp
  • [ ] hpx/collectives/detail/communicator.hpp
  • [ ] hpx/collectives/exclusive_scan.hpp
  • [ ] hpx/collectives/gather.hpp
  • [ ] hpx/collectives/inclusive_scan.hpp
  • [ ] hpx/collectives/reduce.hpp
  • [ ] hpx/collectives/scatter.hpp
  • [ ] hpx/collectives/spmd_block.hpp
  • [ ] hpx/config/compiler_specific.hpp
  • [ ] hpx/execution/algorithms/just.hpp
  • [ ] hpx/execution/executors/execution.hpp
  • [ ] hpx/functional/detail/tag_fallback_invoke.hpp
  • [ ] hpx/functional/detail/tag_priority_invoke.hpp
  • [ ] hpx/functional/tag_invoke.hpp
  • [ ] hpx/parallel/algorithms/detail/reduce.hpp
  • [ ] hpx/parallel/util/loop.hpp
  • [ ] hpx/parallel/util/partitioner.hpp
  • [ ] hpx/parallel/util/scan_partitioner.hpp
  • [ ] hpx/parcelset/coalescing_message_handler_registration.hpp
  • [ ] hpx/runtime_configuration/component_factory_base.hpp
  • [ ] hpx/runtime_distributed/server/runtime_support.hpp

opensdh avatar Jul 15 '25 15:07 opensdh