Reductions with CUDA are sometimes wrong

Abierto
#892 10 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
18/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
julia

Línea de trabajo

No se nombra ningún archivo fuente ni ninguna prueba. Comienza con la llamada MPI.Reduce! en el reproductor e investiga su interacción con los datos del dispositivo CUDA, comparando las versiones y los commits de MPI y CUDA indicados. El trabajo estará terminado cuando se identifiquen una causa reproducible y una corrección validada para los resultados incorrectos de la reducción.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug CUDA :flower_playing_cards:

Starting mid December, sometimes, some of my MPI reductions produce wrong results when I am working with CUDA (and only when working with CUDA).

I came to this conclusion via printf-debugging:

println("PRE", mypid, " ", Array(remapper._interpolated_values)[end, end, end, 1]); flush(stdout)
MPI.Barrier(remapper.comms_ctx.mpicomm)
MPI.Reduce!(remapper._interpolated_values[:, :, :, 1], dest, +, mpicomm)
MPI.Barrier(remapper.comms_ctx.mpicomm)
println("POST", mypid, " ", Array(dest)[end, end, end]); flush(stdout)

that produces:

PRE1 0.0
PRE2 500.0
POST1 249.99999999999997 
POST2 0.0 

The value 249.99999999999997 is wrong and it should be 500 (0.0 + 500.0 = 500.0). I tried forcing CUDA.synchronize and/or CUDA.sync, and sometimes results change (for example, I can get 450.0 instead of 250). Note also that 250 could be the correct value for another point.

The code above is embedded in a more complex test case, and I can reproduce the problem reliably when running in a relatively isolated environment. When I work interactively or when I change the test, the test becomes very flaky and extremely hard to reproduce. To ensure consistent results, I have to clean the depot.

I initially thought it was a buggy MPI implementation, but it seems that this problem also appears in production on a different machine (with simulations that run for multiple days). On that machine, the same test never triggers the bug (as checked by running the test 100 times)

Considering the bug is hard to reproduce, this is what I think I concluded:

  • With CUDA 5.6, MPI 0.20.21 is fine MPI 0.20.22 is not (build)
  • With CUDA 5.6, commit aac9688e6961bc7e3aeeba7600f5e7d0b10596a3 is not fine (build) but commit 9584ac8775bfd674eee74cb4b1c8dbe130a246ec is fine (build)
  • Adding local in front of datatype as suggested on Slack does not fix the issue (build)
  • With CUDA 5.5, MPI 0.20.22 is fine (build)
  • Both Julia 1.10 and Julia 1.11 have the problem
Lenguaje dominante
Julia
Estrellas
441
Forks
129
Merge medio
50 min
PR fusionados (30 d)
1

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de JuliaParallel/MPI.jl

Todos los issues de JuliaParallel/MPI.jl

Issues similares

Más issues de Julia

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.