# How to understand MapReduce

**URL:** <https://discourse.julialang.org/t/how-to-understand-mapreduce/67418>\
**Category:** GPU\
**Created:** [August 31, 2021, 10:50am UTC](https://discourse.julialang.org/t/how-to-understand-mapreduce/67418 "2021-08-31T10:50:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jakub\_Mitura](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jakub_mitura/32/19496_2.png) [@Jakub\_Mitura](https://discourse.julialang.org/u/Jakub_Mitura)\
**Post date:** [August 31, 2021, 10:50am UTC](https://discourse.julialang.org/t/how-to-understand-mapreduce/67418/1 "2021-08-31T10:50:53Z")

</div>

Hello I am analyzing CUDA.jl mapReduce.jl file and I see two things that I do not understand

First I see that function shfl\_down\_sync is avoided when type of data is another than Bool, Int32, Int64, Float32, Float64, ComplexF32, ComplexF64  
"With the cuda\_fp16.h header included, T can also be \_\_half or \_\_half2. Similarly, with the cuda\_bf16.h header included, T can also be \_\_nv\_bfloat16 or \_\_nv\_bfloat162. "

- can this header be included in CUDA.jl?

[@JuliaRegistrator](https://github.com/JuliaRegistrator) regist

secondly in documentation - ([Programming Guide :: CUDA Toolkit Documentation](https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html)) \_\_shfl\_xor\_sync() is suggested for reduction If I understand correctly why in this use case shfl\_down\_sync is better?

For reference  
[https://github.com/JuliaGPU/CUDA.jl/blob/afe81794038dddbda49639c8c26469496543d831/src/mapreduce.jl](https://github.com/JuliaGPU/CUDA.jl/blob/afe81794038dddbda49639c8c26469496543d831/src/mapreduce.jl)

---

<div class="post-metadata">

**Author:** ![Jakub\_Mitura](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jakub_mitura/32/19496_2.png) [@Jakub\_Mitura](https://discourse.julialang.org/u/Jakub_Mitura)\
**Post date:** [August 31, 2021, 11:23am UTC](https://discourse.julialang.org/t/how-to-understand-mapreduce/67418/3 "2021-08-31T11:23:45Z")

</div>

CUDA.jl directly calls PTX IRs. You could check [https://github.com/JuliaGPU/CUDA.jl/blob/d87ee1cb4049ad45cb5d5b29fd5e872901ee2878/src/device/intrinsics/warp\_shuffle.jl#L40-L73](https://github.com/JuliaGPU/CUDA.jl/blob/d87ee1cb4049ad45cb5d5b29fd5e872901ee2878/src/device/intrinsics/warp_shuffle.jl#L40-L73).
