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

Rework Container Type Traits and GlobRef Conversion Rules #630

Open
wants to merge 16 commits into
base: development
Choose a base branch
from
Open
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
7 changes: 5 additions & 2 deletions dart-impl/mpi/src/dart_communication.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,11 @@ dart__mpi__get_basic(
}

if (remainder > 0) {
DART_LOG_TRACE("dart_get: MPI_Get (dest %p, size %zu)",
dest_ptr, remainder);
DART_LOG_TRACE(
"dart_get: MPI_Get (dest %p, size %zu, bytes: %zu)",
dest_ptr,
remainder,
remainder * dart__mpi__datatype_sizeof(dtype));
CHECK_MPI_RET(
dart__mpi__get(dest_ptr,
remainder,
Expand Down
54 changes: 26 additions & 28 deletions dash/include/dash/Atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
#define DASH__ATOMIC_H__INCLUDED

#include <dash/Meta.h>
#include <dash/TypeTraits.h>

#include <type_traits>
#include <sstream>

#include <type_traits>

namespace dash {

Expand Down Expand Up @@ -46,32 +46,33 @@ namespace dash {
* \endcode
*/
template <typename T>
class Atomic
{
class Atomic {
static_assert(
dash::is_atomic_compatible<T>::value,
"Type not supported for atomic operations");
dash::is_atomic_compatible<T>::value,
"Type not supported for atomic operations");

private:
T _value;
private:
T _value;
typedef Atomic<T> self_t;

public:
public:
typedef T value_type;

constexpr Atomic() = default;
constexpr Atomic(const Atomic<T>& other) = default;
constexpr Atomic(Atomic<T>&& other) = default;

self_t& operator=(const self_t& other) = default;
self_t& operator=(self_t&& other) = default;
self_t& operator=(const self_t& other) = default;
self_t& operator=(self_t&& other) = default;

/**
* Initializes the underlying value with desired.
* The initialization is not atomic
*/
constexpr Atomic(T value)
: _value(value) { }
: _value(value)
{
}

/**
* Disabled assignment as this violates the atomic semantics
Expand All @@ -87,38 +88,35 @@ class Atomic
* As \c Atomic is implemented as phantom type,
* the value has to be queried using the \c dash::GlobRef
*/
operator T() = delete;
operator T() = delete;

constexpr bool operator==(const self_t & other) const {
constexpr bool operator==(const self_t& other) const
{
return _value == other._value;
}

constexpr bool operator!=(const self_t & other) const {
constexpr bool operator!=(const self_t& other) const
{
return !(*this == other);
}

template<typename T_>
friend std::ostream & operator<<(
std::ostream & os,
const Atomic<T_> & at);
template <typename T_>
friend std::ostream& operator<<(std::ostream& os, const Atomic<T_>& at);

}; // class Atomic
}; // class Atomic

template<typename T>
std::ostream & operator<<(
std::ostream & os,
const Atomic<T> & at)
template <typename T>
std::ostream& operator<<(std::ostream& os, const Atomic<T>& at)
{
std::ostringstream ss;
ss << dash::typestr(at) << "<phantom>";
return operator<<(os, ss.str());
}

} // namespace dash
} // namespace dash

#include <dash/atomic/Type_traits.h>
#include <dash/atomic/GlobAtomicRef.h>
#include <dash/atomic/GlobAtomicAsyncRef.h>
#include <dash/atomic/GlobAtomicRef.h>
#include <dash/atomic/Operation.h>

#endif // DASH__ATOMIC_H__INCLUDED
#endif // DASH__ATOMIC_H__INCLUDED
2 changes: 0 additions & 2 deletions dash/include/dash/Coarray.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

#include <dash/Dimensional.h>

#include <dash/atomic/Type_traits.h>

/**
* \defgroup DashCoarrayConcept Coarray Concept
*
Expand Down
40 changes: 20 additions & 20 deletions dash/include/dash/GlobAsyncRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,43 +124,43 @@ class GlobAsyncRef
/**
* Copy constructor, implicit if at least one of the following conditions is
* satisfied:
* 1) value_type and _T are exactly the same types (including const and
* 1) value_type and From are exactly the same types (including const and
* volatile qualifiers
* 2) value_type and _T are the same types after removing const and volatile
* 2) value_type and From are the same types after removing const and volatile
* qualifiers and value_type itself is const.
*/
template<typename _T,
int = internal::enable_implicit_copy_ctor<value_type, _T>::value>
GlobAsyncRef(const GlobAsyncRef<_T>& gref)
template<typename From,
int = detail::enable_implicit_copy_ctor<From, value_type>::value>
GlobAsyncRef(const GlobAsyncRef<From>& gref)
: GlobAsyncRef(gref.dart_gptr())
{ }

/**
* Copy constructor, explicit if the following conditions are satisfied.
* 1) value_type and _T are the same types after excluding const and
* 1) value_type and From are the same types after excluding const and
* volatile qualifiers
* 2) value_type is const and _T is non-const
* 2) value_type is const and From is non-const
*/
template <
typename _T,
long = internal::enable_explicit_copy_ctor<value_type, _T>::value>
explicit GlobAsyncRef(const GlobAsyncRef<_T>& gref)
typename From,
long = detail::enable_explicit_copy_ctor<From, value_type>::value>
explicit GlobAsyncRef(const GlobAsyncRef<From>& gref)
: GlobAsyncRef(gref.dart_gptr())
{
}

template <
typename _T,
int = internal::enable_implicit_copy_ctor<value_type, _T>::value>
GlobAsyncRef(const GlobRef<_T>& gref)
typename From,
int = detail::enable_implicit_copy_ctor<From, value_type>::value>
GlobAsyncRef(const GlobRef<From>& gref)
: GlobAsyncRef(gref.dart_gptr())
{
}

template <
typename _T,
long = internal::enable_explicit_copy_ctor<value_type, _T>::value>
explicit GlobAsyncRef(const GlobRef<_T>& gref)
typename From,
long = detail::enable_explicit_copy_ctor<From, value_type>::value>
explicit GlobAsyncRef(const GlobRef<From>& gref)
: GlobAsyncRef(gref.dart_gptr())
{
}
Expand Down Expand Up @@ -192,20 +192,20 @@ class GlobAsyncRef
* specified offset
*/
template<typename MEMTYPE>
GlobAsyncRef<typename internal::add_const_from_type<T, MEMTYPE>::type>
GlobAsyncRef<typename detail::add_const_from_type<T, MEMTYPE>::type>
member(size_t offs) const {
return GlobAsyncRef<typename internal::add_const_from_type<T, MEMTYPE>::type>(*this, offs);
return GlobAsyncRef<typename detail::add_const_from_type<T, MEMTYPE>::type>(*this, offs);
}

/**
* Get the member via pointer to member
*/
template<class MEMTYPE, class P=T>
GlobAsyncRef<typename internal::add_const_from_type<T, MEMTYPE>::type>
GlobAsyncRef<typename detail::add_const_from_type<T, MEMTYPE>::type>
member(
const MEMTYPE P::*mem) const {
auto offs = (size_t) & (reinterpret_cast<P*>(0)->*mem);
return member<typename internal::add_const_from_type<T, MEMTYPE>::type>(offs);
return member<typename detail::add_const_from_type<T, MEMTYPE>::type>(offs);
}

/**
Expand Down
Loading