<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Atomic on icyveins7's blog</title><link>https://icyveins7.github.io/tags/atomic/</link><description>Recent content in Atomic on icyveins7's blog</description><generator>Hugo</generator><language>en-us</language><copyright>This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.</copyright><lastBuildDate>Sun, 16 Mar 2025 20:00:00 +0800</lastBuildDate><atom:link href="https://icyveins7.github.io/tags/atomic/index.xml" rel="self" type="application/rss+xml"/><item><title>AtomicMinFloat; overloading integer-only atomics for floating-point numbers in CUDA</title><link>https://icyveins7.github.io/posts/2025/03/atomicminfloat-overloading-integer-only-atomics-for-floating-point-numbers-in-cuda/</link><pubDate>Sun, 16 Mar 2025 20:00:00 +0800</pubDate><guid>https://icyveins7.github.io/posts/2025/03/atomicminfloat-overloading-integer-only-atomics-for-floating-point-numbers-in-cuda/</guid><description>&lt;blockquote&gt;&#10;&lt;p&gt;Convincing you (and myself) that with some minor edits, we can still use atomicMin for floats in CUDA..&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;p&gt;CUDA has a set of atomic functions for &lt;em&gt;safely&lt;/em&gt; updating the same memory address with different threads. There&amp;rsquo;s a whole list of them in the programming guide &lt;a href="https://docs.nvidia.com/cuda/cuda-c-programming-guide/#atomic-functions"&gt;here&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;However, for &lt;code&gt;atomicMin&lt;/code&gt; (and also &lt;code&gt;atomicMax&lt;/code&gt;), there isn&amp;rsquo;t an overload that works with &lt;code&gt;float&lt;/code&gt;s (or &lt;code&gt;double&lt;/code&gt;s , but who uses those in CUDA anyway..). For this discussion we&amp;rsquo;ll just focus on &lt;code&gt;atomicMin&lt;/code&gt;, but all the points we discuss can be inverted to explain &lt;code&gt;atomicMax&lt;/code&gt;.&lt;/p&gt;</description></item></channel></rss>