@@ -798,8 +798,9 @@ \section{Atomics}
798798 \end {minted }
799799 \end {column }
800800 \begin {column }{0.5\linewidth }
801- \begin {itemize }
802- \item Either:
801+ \noindent Either:
802+
803+ \vspace {0.5em}
803804 \SetTblrInner {rowsep=0pt}
804805 \begin {tblr }{colspec={cccc},rowspec={Q[lightmain]Q[white]Q[thread1]Q[thread6]}}
805806 \textbf {Thread 1 } & \textbf {Thread 6 } & & \textbf {res } \\
@@ -809,7 +810,11 @@ \section{Atomics}
809810 & & & 7 \\
810811 \end {tblr }
811812 \pause
812- \item Or:
813+ \vspace {0.5em}
814+
815+ \noindent Or:
816+
817+ \vspace {0.5em}
813818 \SetTblrInner {rowsep=0pt}
814819 \begin {tblr }{colspec={cccc},rowspec={Q[lightmain]Q[white]Q[thread6]Q[thread1]}}
815820 \textbf {Thread 1 } & \textbf {Thread 6 } & & \textbf {res } \\
@@ -818,7 +823,6 @@ \section{Atomics}
818823 atomic add & & ←→ & 7 \\
819824 & & & 7 \\
820825 \end {tblr }
821- \end {itemize }
822826 \end {column }
823827 \end {columns }
824828\end {frame }
@@ -851,6 +855,33 @@ \section{Atomics}
851855 \end {columns }
852856\end {frame }
853857
858+ \begin {frame }[fragile]{Atomic Memory Trait}
859+ \begin {columns }
860+ \begin {column }{0.50\linewidth }
861+ \begin {itemize }
862+ \item If you need to access a View exclusively through atomic operation, you
863+ can also create an alias for this View with the \texttt {Atomic } \texttt {MemoryTraits }
864+ \item It guaranties that any operation done through the alias are done atomically
865+ \end {itemize }
866+ \end {column }
867+ \begin {column }{0.50\linewidth }
868+ \begin {minted }{C++}
869+ Kokkos::View<double*> histo(5);
870+ Kokkos::deep_copy(histo, 0);
871+
872+ View<int*, MemoryTraits<Atomic>>
873+ histo_atomic = histo;
874+
875+ Kokkos::parallel_for(
876+ Kokkos::RangePolicy(0,N),
877+ KOKKOS_LAMBDA(int i) {
878+ histo_atomic(i% 5) += i;
879+ });
880+ \end {minted }
881+ \end {column }
882+ \end {columns }
883+ \end {frame }
884+
854885\begin {frame }[fragile]{Performances}
855886 \begin {columns }
856887 \begin {column }{0.45\linewidth }
@@ -862,15 +893,16 @@ \section{Atomics}
862893 \end {itemize }
863894 \end {column }
864895 \begin {column }{0.55\linewidth }
865- \begin {exampleblock }{\vspace *{-3ex}}
896+ \begin {block }
897+ {\vspace *{-3ex}} % hide the title box of the block
866898 \begin {itemize }
867899 \item Atomics should be used with care and only when strictly
868900 necessary
869901 \item Algorithm can sometime be changed when porting from CPU to GPU
870902 in order to remove the need for atomics (colouring, replacing in
871903 place algorithm with out of place algorithm,~…)
872904 \end {itemize }
873- \end {exampleblock }
905+ \end {block }
874906 \end {column }
875907 \end {columns }
876908\end {frame }
0 commit comments