Skip to content
Snippets Groups Projects
Commit 59a4d824 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Added sequential device to atomic operations.

parent d82fd0bd
No related branches found
No related tags found
1 merge request!116Documentation for linear solvers and preconditioners
......@@ -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 >
{
......
......@@ -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 >
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment