Struct SystemAtomicF64

Source
#[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

Source

pub const fn new(v: f64) -> SystemAtomicF64

Creates a new atomic float.

Source

pub fn into_inner(self) -> f64

Consumes the atomic and returns the contained value.

Source

pub fn fetch_add(&self, val: f64, order: Ordering) -> f64

Adds to the current value, returning the previous value before the addition.

Source

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.

Source

pub fn fetch_and(&self, val: f64, order: Ordering) -> f64

Bitwise “and” with the current value. Returns the value before the “and”.

Source

pub fn fetch_or(&self, val: f64, order: Ordering) -> f64

Bitwise “or” with the current value. Returns the value before the “or”.

Source

pub fn fetch_xor(&self, val: f64, order: Ordering) -> f64

Bitwise “xor” with the current value. Returns the value before the “xor”.

Source

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.

Source

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.

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.