Conversation
|
Running on device performance annotations: |
|
Running with much larger arrays, src starting on host des starting on device |
|
|
||
| // Compute face centers and normals. | ||
| conduit::execution::for_all<ExecPolicy>(0, totalNumFaces, [=](conduit::index_t f) { | ||
| conduit::execution::forall<ExecPolicy>(0, totalNumFaces, [=](conduit::index_t f) { |
There was a problem hiding this comment.
I am confused by this
There was a problem hiding this comment.
wherever this method is called, we want to take a look at the template and consider switching to a policy object choice.
There was a problem hiding this comment.
look into RDC before getting Cyrus' blessing
| bool | ||
| ExecutionPolicy::is_parallel_policy() const | ||
| { | ||
| return is_cuda() || is_hip() || is_openmp(); |
There was a problem hiding this comment.
to look at in the future - we don't have consistency here.
You can create a "parallel" exec policy that is_parallel_policy() returns false for. We should make a ticket to examine in the future.
There was a problem hiding this comment.
maybe a note in the code too.
There was a problem hiding this comment.
I added the note in the code; we just need a ticket with follow-on work now.
| }; | ||
|
|
||
| //----------------------------------------------------------------------------- | ||
| void init_device_memory_handlers(); |
There was a problem hiding this comment.
this should be a static function that people only have to do once. We should have a conduit utility somewhere that should be able to do this somewhere. It should see if the handlers are installed and do it, otherwise do nothing.
There was a problem hiding this comment.
could be a TODO for later
| // Build capability answers "was this Conduit build configured with a RAJA | ||
| // backend?", while TU capability answers "is this translation unit actually | ||
| // being compiled with that device compiler right now?" | ||
| #if defined(CONDUIT_USE_RAJA) && defined(CONDUIT_USE_CUDA) | ||
| #define CONDUIT_EXEC_BUILD_HAS_CUDA | ||
| #endif | ||
|
|
||
| #if defined(CONDUIT_USE_RAJA) && defined(CONDUIT_USE_HIP) | ||
| #define CONDUIT_EXEC_BUILD_HAS_HIP | ||
| #endif | ||
|
|
||
| #if defined(CONDUIT_EXEC_BUILD_HAS_CUDA) || defined(CONDUIT_EXEC_BUILD_HAS_HIP) | ||
| #define CONDUIT_EXEC_BUILD_HAS_DEVICE | ||
| #endif | ||
|
|
||
| #if defined(CONDUIT_EXEC_BUILD_HAS_CUDA) && defined(__CUDACC__) | ||
| #define CONDUIT_EXEC_TU_HAS_CUDA | ||
| #endif | ||
|
|
||
| #if defined(CONDUIT_EXEC_BUILD_HAS_HIP) && defined(__HIPCC__) | ||
| #define CONDUIT_EXEC_TU_HAS_HIP | ||
| #endif | ||
|
|
||
| #if defined(CONDUIT_EXEC_TU_HAS_CUDA) || defined(CONDUIT_EXEC_TU_HAS_HIP) | ||
| #define CONDUIT_EXEC_TU_HAS_DEVICE | ||
| #endif |
There was a problem hiding this comment.
codex disaster
we will never have to worry about cuda or hip
we have duplicated this in the conduit_execution.hpp header
we want to use what is there and not have all this madness
| inline void | ||
| validate_runtime_policy(const ExecutionPolicy &policy, | ||
| const char *context) | ||
| { | ||
| if (policy.is_empty()) | ||
| { | ||
| CONDUIT_ERROR(context << " does not support an empty policy."); | ||
| } | ||
|
|
||
| if (policy.is_openmp()) | ||
| { | ||
| #if !defined(CONDUIT_USE_OPENMP) | ||
| CONDUIT_ERROR(context << " requires OpenMP support in this translation unit."); | ||
| #endif | ||
| } | ||
| else if (policy.is_cuda()) | ||
| { | ||
| #if !defined(CONDUIT_EXEC_TU_HAS_CUDA) | ||
| CONDUIT_ERROR(context << " requires CUDA support in this translation unit."); | ||
| #endif | ||
| } | ||
| else if (policy.is_hip()) | ||
| { | ||
| #if !defined(CONDUIT_EXEC_TU_HAS_HIP) | ||
| CONDUIT_ERROR(context << " requires HIP support in this translation unit."); | ||
| #endif | ||
| } | ||
| } |
There was a problem hiding this comment.
what is this and these strange ifdefs. Why do we need this?
There was a problem hiding this comment.
won't the policy creation fail? shouldn't it?
There was a problem hiding this comment.
runtime error for compile errors is strange. We should find a way to error earlier if someone wants to run on a GPU and we can't.
There was a problem hiding this comment.
not clear we need to validate like this right now.
| #if defined(CONDUIT_USE_OPENMP) | ||
| detail::ReduceSumImpl<OpenMPExec, T> m_openmp_reduce; | ||
| #endif | ||
| #if defined(CONDUIT_EXEC_TU_HAS_CUDA) |
There was a problem hiding this comment.
name is not great :/
|
use hatchet/thicket to compare speedup |
Resolves #1358