Commit 59a4d824 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Added sequential device to atomic operations.

parent d82fd0bd
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -41,6 +41,21 @@ struct AtomicOperations< Devices::Host >
   }
};

template<>
struct AtomicOperations< Devices::Sequential >
{
   // this is __cuda_callable__ only to silence nvcc warnings (all methods inside class
   // template specializations must have the same execution space specifier, otherwise
   // nvcc complains)
   TNL_NVCC_HD_WARNING_DISABLE
   template< typename Value >
   __cuda_callable__
   static void add( Value& v, const Value& a )
   {
      v += a;
   }
};

template<>
struct AtomicOperations< Devices::Cuda >
{
+12 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
#include <atomic>  // std::atomic

#include <TNL/Devices/Host.h>
#include <TNL/Devices/Sequential.h>
#include <TNL/Devices/Cuda.h>

// double-precision atomicAdd function for Maxwell and older GPUs
@@ -96,6 +97,17 @@ public:
   }
};

template< typename T >
class Atomic< T, Devices::Sequential > : public Atomic< T, Devices::Host >
{
   public:

   using Atomic;
   using operator=;
   using fetch_max;
   using fetch_min;
};

template< typename T >
class Atomic< T, Devices::Cuda >
{