AUTH's THMMY "Parallel and distributed systems" course assignments.
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

123456789101112131415161718192021222324252627
  1. # distributed bitonic sort using elbow merge locally except for the first step
  2. function distbitonic!(p)
  3. q = Int(log2(p))
  4. pid = 0:p-1
  5. ascending = mod.(pid,2) .== 0
  6. println("ascending: $ascending")
  7. # local full sort here
  8. for k = 1:q
  9. kk = 1 << k
  10. for j = k-1:-1:0
  11. jj = 1 << j
  12. partnerid = pid .⊻ jj
  13. direction = (pid .& kk) .== 0 .& (pid .< partnerid)
  14. keepsmall = ((pid .< partnerid) .& direction) .| ((pid .> partnerid) .& .!direction)
  15. println("k: $k | j: $j | partner: $partnerid | keepsmall: $keepsmall")
  16. # exchange with partner and keep small or large
  17. end
  18. ascending = (pid .& kk) .== 0
  19. println("ascending: $ascending")
  20. # local elbowmerge here
  21. end
  22. nothing
  23. end