#[repr(C, align(8))]pub struct SystemAtomicF64 { /* private fields */ }Expand description
A 64-bit float type which can be safely shared between threads and synchronizes across a single device (GPU).
This type is guaranteed to have the same memory representation as the underlying integer
type f64.
The functions on this type map to hardware instructions on CUDA platforms, and are emulated with a CAS loop on the CPU (non-CUDA targets).
Implementations§
Source§impl SystemAtomicF64
impl SystemAtomicF64
Sourcepub const fn new(v: f64) -> SystemAtomicF64
pub const fn new(v: f64) -> SystemAtomicF64
Creates a new atomic float.
Sourcepub fn into_inner(self) -> f64
pub fn into_inner(self) -> f64
Consumes the atomic and returns the contained value.
Sourcepub fn fetch_add(&self, val: f64, order: Ordering) -> f64
pub fn fetch_add(&self, val: f64, order: Ordering) -> f64
Adds to the current value, returning the previous value before the addition.
Sourcepub fn fetch_sub(&self, val: f64, order: Ordering) -> f64
pub fn fetch_sub(&self, val: f64, order: Ordering) -> f64
Subtracts from the current value, returning the previous value before the subtraction.
Note, this is actually implemented as old + (-new), CUDA does not have a specialized sub instruction.
Sourcepub fn fetch_and(&self, val: f64, order: Ordering) -> f64
pub fn fetch_and(&self, val: f64, order: Ordering) -> f64
Bitwise “and” with the current value. Returns the value before the “and”.
Sourcepub fn fetch_or(&self, val: f64, order: Ordering) -> f64
pub fn fetch_or(&self, val: f64, order: Ordering) -> f64
Bitwise “or” with the current value. Returns the value before the “or”.
Sourcepub fn fetch_xor(&self, val: f64, order: Ordering) -> f64
pub fn fetch_xor(&self, val: f64, order: Ordering) -> f64
Bitwise “xor” with the current value. Returns the value before the “xor”.
Sourcepub fn load(&self, order: Ordering) -> f64
pub fn load(&self, order: Ordering) -> f64
Atomically loads the value behind this atomic.
load takes an Ordering argument which describes the memory ordering of this operation.
Possible values are Ordering::SeqCst, Ordering::Acquire, and Ordering::Relaxed.
§Panics
Panics if order is Ordering::Release or Ordering::AcqRel.
Sourcepub fn store(&self, val: f64, order: Ordering)
pub fn store(&self, val: f64, order: Ordering)
Atomically stores a value into this atomic.
store takes an Ordering argument which describes the memory ordering of this operation.
Possible values are Ordering::SeqCst, Ordering::Release, and Ordering::Relaxed.
§Panics
Panics if order is Ordering::Acquire or Ordering::AcqRel.