Skip to content
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

Renamed "traits" namespace to "trait" #1651

Merged
merged 1 commit into from
Mar 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/source/basic/cheatsheet.rst
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ Allocate static shared memory variable
Get dynamic shared memory pool, requires the kernel to specialize
.. code-block:: c++

traits::BlockSharedMemDynSizeBytes
trait::BlockSharedMemDynSizeBytes
Type * dynamicSharedMemoryPool = getDynSharedMem<Type>(acc);

Synchronize threads of the same block
Expand Down
6 changes: 3 additions & 3 deletions docs/source/dev/details.rst
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,10 @@ These functions are dispatched in two ways to support user defined overloads of

Let's take `alpaka::math::abs` as an example:
When `alpaka::math::abs(acc, value)` is called, a concrete implementation of `abs` is picked via template specialization.
Concretely, something similar to `alpaka::math::traits::Abs<decltype(acc), decltype(value)>{}(acc, value)` is called.
This allows alpaka (and the user) to specialize the template `alpaka::math::traits::Abs` for various backends and various argument types.
Concretely, something similar to `alpaka::math::trait::Abs<decltype(acc), decltype(value)>{}(acc, value)` is called.
This allows alpaka (and the user) to specialize the template `alpaka::math::trait::Abs` for various backends and various argument types.
E.g. alpaka contains specializations for `float` and `double`.
If there is no specialization within alpaka (or by the user), the default implementation of `alpaka::math::traits::Abs<....>{}(acc, value)` will just call `abs(value)`.
If there is no specialization within alpaka (or by the user), the default implementation of `alpaka::math::trait::Abs<....>{}(acc, value)` will just call `abs(value)`.
This is called an unqualified call and C++ will try to find a function called `abs` in the namespace where the type of `value` is defined.
This feature is called Argument Dependent Lookup (ADL).
Using ADL for types which are not covered by specializations in alpaka allows a user to bring their own implementation for which `abs` is meaningful, e.g. a custom implementation of complex numbers or a fixed precision type.
4 changes: 2 additions & 2 deletions example/openMPSchedule/src/openMPSchedule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ struct OpenMPScheduleTraitKernel : public OpenMPScheduleDefaultKernel
{
};

namespace alpaka::traits
namespace alpaka::trait
{
//! Schedule trait specialization for OpenMPScheduleTraitKernel.
//! This is the most general way to define a schedule.
Expand All @@ -90,7 +90,7 @@ namespace alpaka::traits
return alpaka::omp::Schedule{alpaka::omp::Schedule::Dynamic, 2};
}
};
} // namespace alpaka::traits
} // namespace alpaka::trait

auto main() -> int
{
Expand Down
4 changes: 2 additions & 2 deletions include/alpaka/acc/AccCpuFibers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ namespace alpaka
boost::fibers::fiber::id mutable m_masterFiberId; //!< The id of the master fiber.
};

namespace traits
namespace trait
{
//! The CPU fibers accelerator accelerator type trait specialization.
template<typename TDim, typename TIdx>
Expand Down Expand Up @@ -218,7 +218,7 @@ namespace alpaka
{
using type = TIdx;
};
} // namespace traits
} // namespace trait
} // namespace alpaka

#endif
4 changes: 2 additions & 2 deletions include/alpaka/acc/AccCpuOmp2Blocks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ namespace alpaka
Vec<TDim, TIdx> mutable m_gridBlockIdx; //!< The index of the currently executed block.
};

namespace traits
namespace trait
{
//! The CPU OpenMP 2.0 block accelerator accelerator type trait specialization.
template<typename TDim, typename TIdx>
Expand Down Expand Up @@ -201,7 +201,7 @@ namespace alpaka
{
using type = TIdx;
};
} // namespace traits
} // namespace trait
} // namespace alpaka

#endif
4 changes: 2 additions & 2 deletions include/alpaka/acc/AccCpuOmp2Threads.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ namespace alpaka
Vec<TDim, TIdx> mutable m_gridBlockIdx; //!< The index of the currently executed block.
};

namespace traits
namespace trait
{
//! The CPU OpenMP 2.0 thread accelerator accelerator type trait specialization.
template<typename TDim, typename TIdx>
Expand Down Expand Up @@ -211,7 +211,7 @@ namespace alpaka
{
using type = TIdx;
};
} // namespace traits
} // namespace trait
} // namespace alpaka

#endif
4 changes: 2 additions & 2 deletions include/alpaka/acc/AccCpuSerial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ namespace alpaka
Vec<TDim, TIdx> mutable m_gridBlockIdx; //!< The index of the currently executed block.
};

namespace traits
namespace trait
{
//! The CPU serial accelerator accelerator type trait specialization.
template<typename TDim, typename TIdx>
Expand Down Expand Up @@ -195,7 +195,7 @@ namespace alpaka
{
using type = TIdx;
};
} // namespace traits
} // namespace trait
} // namespace alpaka

#endif
4 changes: 2 additions & 2 deletions include/alpaka/acc/AccCpuSyclIntel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace alpaka::experimental
};
} // namespace alpaka::experimental

namespace alpaka::traits
namespace alpaka::trait
{
//! The Intel CPU SYCL accelerator name trait specialization.
template<typename TDim, typename TIdx>
Expand Down Expand Up @@ -81,6 +81,6 @@ namespace alpaka::traits
{
using type = experimental::PltfCpuSyclIntel;
};
} // namespace alpaka::traits
} // namespace alpaka::trait

#endif
4 changes: 2 additions & 2 deletions include/alpaka/acc/AccCpuTbbBlocks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ namespace alpaka
Vec<TDim, TIdx> mutable m_gridBlockIdx; //!< The index of the currently executed block.
};

namespace traits
namespace trait
{
//! The CPU TBB block accelerator type trait specialization.
template<typename TDim, typename TIdx>
Expand Down Expand Up @@ -192,7 +192,7 @@ namespace alpaka
{
using type = TIdx;
};
} // namespace traits
} // namespace trait
} // namespace alpaka

#endif
4 changes: 2 additions & 2 deletions include/alpaka/acc/AccCpuThreads.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ namespace alpaka
std::thread::id mutable m_idMasterThread; //!< The id of the master thread.
};

namespace traits
namespace trait
{
//! The CPU threads accelerator accelerator type trait specialization.
template<typename TDim, typename TIdx>
Expand Down Expand Up @@ -217,7 +217,7 @@ namespace alpaka
{
using type = TIdx;
};
} // namespace traits
} // namespace trait
} // namespace alpaka

#endif
4 changes: 2 additions & 2 deletions include/alpaka/acc/AccFpgaSyclIntel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace alpaka::experimental
};
} // namespace alpaka::experimental

namespace alpaka::traits
namespace alpaka::trait
{
//! The Intel FPGA SYCL accelerator name trait specialization.
template<typename TDim, typename TIdx>
Expand Down Expand Up @@ -80,6 +80,6 @@ namespace alpaka::traits
{
using type = experimental::PltfFpgaSyclIntel;
};
} // namespace alpaka::traits
} // namespace alpaka::trait

#endif
4 changes: 2 additions & 2 deletions include/alpaka/acc/AccFpgaSyclXilinx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace alpaka::experimental
};
} // namespace alpaka::experimental

namespace alpaka::traits
namespace alpaka::trait
{
//! The Xilinx FPGA SYCL accelerator name trait specialization.
template<typename TDim, typename TIdx>
Expand Down Expand Up @@ -80,6 +80,6 @@ namespace alpaka::traits
{
using type = experimental::PltfFpgaSyclXilinx;
};
} // namespace alpaka::traits
} // namespace alpaka::trait

#endif
4 changes: 2 additions & 2 deletions include/alpaka/acc/AccGenericSycl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ namespace alpaka::experimental
};
} // namespace alpaka::experimental

namespace alpaka::traits
namespace alpaka::trait
{
//! The SYCL accelerator type trait specialization.
template<template<typename, typename> typename TAcc, typename TDim, typename TIdx>
Expand Down Expand Up @@ -179,6 +179,6 @@ namespace alpaka::traits
{
using type = TIdx;
};
} // namespace alpaka::traits
} // namespace alpaka::trait

#endif
4 changes: 2 additions & 2 deletions include/alpaka/acc/AccGpuCudaRt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace alpaka
}
};

namespace traits
namespace trait
{
//! The GPU CUDA accelerator accelerator type trait specialization.
template<typename TDim, typename TIdx>
Expand Down Expand Up @@ -83,7 +83,7 @@ namespace alpaka
std::forward<TArgs>(args)...);
}
};
} // namespace traits
} // namespace trait
} // namespace alpaka

#endif
4 changes: 2 additions & 2 deletions include/alpaka/acc/AccGpuHipRt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace alpaka
}
};

namespace traits
namespace trait
{
//! The GPU HIP accelerator accelerator type trait specialization.
template<typename TDim, typename TIdx>
Expand Down Expand Up @@ -83,7 +83,7 @@ namespace alpaka
std::forward<TArgs>(args)...);
}
};
} // namespace traits
} // namespace trait
} // namespace alpaka

#endif
4 changes: 2 additions & 2 deletions include/alpaka/acc/AccGpuSyclIntel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace alpaka::experimental
};
} // namespace alpaka::experimental

namespace alpaka::traits
namespace alpaka::trait
{
//! The Intel GPU SYCL accelerator name trait specialization.
template<typename TDim, typename TIdx>
Expand Down Expand Up @@ -80,6 +80,6 @@ namespace alpaka::traits
{
using type = experimental::PltfGpuSyclIntel;
};
} // namespace alpaka::traits
} // namespace alpaka::trait

#endif
8 changes: 4 additions & 4 deletions include/alpaka/acc/AccGpuUniformCudaHipRt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ namespace alpaka
}
};

namespace traits
namespace trait
{
//! The GPU CUDA accelerator accelerator type trait specialization.
template<typename TDim, typename TIdx>
Expand Down Expand Up @@ -222,7 +222,7 @@ namespace alpaka
{
using type = TDim;
};
} // namespace traits
} // namespace trait
namespace detail
{
//! specialization of the TKernelFnObj return type evaluation
Expand All @@ -239,7 +239,7 @@ namespace alpaka
}
};
} // namespace detail
namespace traits
namespace trait
{
//! The GPU CUDA accelerator execution task type trait specialization.
template<typename TDim, typename TIdx, typename TWorkDiv, typename TKernelFnObj, typename... TArgs>
Expand Down Expand Up @@ -272,7 +272,7 @@ namespace alpaka
{
using type = TIdx;
};
} // namespace traits
} // namespace trait
} // namespace alpaka

#endif
4 changes: 2 additions & 2 deletions include/alpaka/acc/AccOacc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ namespace alpaka
CtxBlockOacc<TDim, TIdx>& m_blockShared;
};

namespace traits
namespace trait
{
//! The OpenACC accelerator accelerator type trait specialization.
template<typename TDim, typename TIdx>
Expand Down Expand Up @@ -344,7 +344,7 @@ namespace alpaka
workDiv.m_blockShared);
}
};
} // namespace traits
} // namespace trait
} // namespace alpaka

#endif
4 changes: 2 additions & 2 deletions include/alpaka/acc/AccOmp5.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ namespace alpaka
}
};

namespace traits
namespace trait
{
//! The OpenMP 5.0 accelerator accelerator type trait specialization.
template<typename TDim, typename TIdx>
Expand Down Expand Up @@ -280,7 +280,7 @@ namespace alpaka
{
using type = TIdx;
};
} // namespace traits
} // namespace trait
} // namespace alpaka

#endif
Loading