-
Notifications
You must be signed in to change notification settings - Fork 43
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
Separate RAJA execution policies specification from linear algebra classes implementations #240
Comments
Possible solution could be to create policy specification containers like this: // hiopExecPolicies.hpp
#include <hiop_defs.hpp>
#ifdef HIOP_USE_RAJA
#ifdef HIOP_USE_GPU
struct hiopCudaPolicies
{
hiopExecutionPolicies() = default;
using hiop_raja_exec = RAJA::cuda_exec<HIOP_CUDA_BLOCK_SIZE>;
using hiop_raja_reduce = RAJA::cuda_reduce;
using hiop_raja_atomic = RAJA::cuda_atomic;
namespace policy_namespace = RAJA;
};
#endif // HIOP_USE_GPU
struct hiopOmpPolicies
{
hiopExecutionPolicies() = default;
using hiop_raja_exec = RAJA::omp_parallel_for_exec;
using hiop_raja_reduce = RAJA::omp_reduce;
using hiop_raja_atomic = RAJA::omp_atomic;
namespace policy_namespace = RAJA;
};
#endif // HIOP_USE_RAJA Then in, for example, // hiopVectorRajaPar.cpp
#include <hiopExecPolicies.hpp>
// some code
#ifdef HIOP_USE_GPU
#include "cuda.h"
#define RAJA_LAMBDA [=] __device__
using hiop_policy_type = hiopCudaPolicies;
#else
#define RAJA_LAMBDA [=]
using hiop_policy_type = hiopOmpPolicies;
#endif
using hiop_raja_exec = hiop_policy_type::hiop_raja_exec;
using hiop_raja_reduce = hiop_policy_type::hiop_raja_reduce;
using hiop_raja_atomic = hiop_policy_type::hiop_raja_atomic;
namespace policy_namespace = hiop_policy_type::policy_namespace;
// more code ... |
I think these are great ideas, but what's the point of |
Yes, indeed. This could allow for replacing RAJA function |
Linear algebra classes that use preprocessor directives to specify RAJA execution policies. This may become cumbersome as we add more execution policies (CUDA, HIP, etc.). Furthermore, each linear algebra object implementation duplicates part of policy specifications adding some maintenance overhead. Consider specifying RAJA policies within a container class in a separate source file.
CC @ashermancinelli @cameronrutherford @nychiang @cnpetra
Potential additional benefits: In addition to making linear algebra code more compact, this could simplify creation of linear algebra class templates parametrized by execution type. See #241 for more details. Currently, same execution policies are set at configure time for all linear algebra objects in HiOp.
The text was updated successfully, but these errors were encountered: